Skip to content

Commit c2ddf09

Browse files
authored
Add install target to Makefile
Bug: #97
1 parent 7cc8e9d commit c2ddf09

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Makefile

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
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+
$(INSTALL) sds.h $(INSTALL_INCLUDE_PATH)
22+
23+
sds-lib: sds.c sds.h sdsalloc.h
24+
$(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
25+
-o libsds.so.$(LIBVERSION) -Wl,-soname=libsds.so.$(LIBVERSION) $(SDS_SRC)
226

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

0 commit comments

Comments
 (0)