Skip to content

Commit cb4e94a

Browse files
committed
Add install target to Makefile
Bug: #97
1 parent 0bb446e commit cb4e94a

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

Makefile

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
all: sds-test
1+
LIBVERSION = 2.0.0
2+
3+
SDS_SRC = sds.c sds.h sdsalloc.h
4+
5+
PREFIX ?= /usr/local
6+
INCLUDE_PATH ?= include/sds
7+
LIBRARY_PATH ?= lib
8+
9+
INSTALL_INCLUDE_PATH = $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
10+
INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)
11+
12+
INSTALL ?= cp -a
13+
14+
.PHONY: all
15+
16+
all: sds-test sds-install
17+
18+
sds-install: sds-lib
19+
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
20+
$(INSTALL) libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)
21+
ln -s $(INSTALL_LIBRARY_PATH)/libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)/libsds.so
22+
$(INSTALL) sds.h $(INSTALL_INCLUDE_PATH)
23+
24+
sds-lib: sds.c sds.h sdsalloc.h
25+
$(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
26+
-o libsds.so.$(LIBVERSION) -Wl,-soname=libsds.so.$(LIBVERSION) $(SDS_SRC)
227

328
sds-test: sds.c sds.h testhelp.h
429
$(CC) -o sds-test sds.c -Wall -std=c99 -pedantic -O2 -DSDS_TEST_MAIN

0 commit comments

Comments
 (0)