projects/aports·blob master · refs

44 lines · 1.2 KiB

1From cb4e94a516a8c8231407c7193ffb32d94a0d780e Mon Sep 17 00:00:00 2001
2From: rage <[email protected]>
3Date: Mon, 6 May 2019 14:43:31 -0400
4Subject: [PATCH] Add install target to Makefile
5
6Bug: https://github.com/antirez/sds/issues/97
7---
8 Makefile | 27 ++++++++++++++++++++++++++-
9 1 file changed, 26 insertions(+), 1 deletion(-)
10
11diff --git a/Makefile b/Makefile
12index 045fa88..2d4f362 100644
13--- a/Makefile
14+++ b/Makefile
15@@ -1,4 +1,28 @@
16-all: sds-test
17+LIBVERSION = 2.0.0
18+
19+SDS_SRC = sds.c sds.h sdsalloc.h
20+
21+PREFIX ?= /usr/local
22+INCLUDE_PATH ?= include/sds
23+LIBRARY_PATH ?= lib
24+
25+INSTALL_INCLUDE_PATH = $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
26+INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
27+
28+INSTALL ?= cp -a
29+
30+.PHONY: all
31+
32+all: sds-test sds-install
33+
34+sds-install: sds-lib
35+ mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
36+ $(INSTALL) libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)
37+ $(INSTALL) sds.h $(INSTALL_INCLUDE_PATH)
38+
39+sds-lib: sds.c sds.h sdsalloc.h
40+ $(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
41+ -o libsds.so.$(LIBVERSION) -Wl,-soname=libsds.so.$(LIBVERSION) $(SDS_SRC)
42
43 sds-test: sds.c sds.h testhelp.h
44 $(CC) -o sds-test sds.c -Wall -std=c99 -pedantic -O2 -DSDS_TEST_MAIN