Skip to content

Commit

Permalink
Add install target to Makefile
Browse files Browse the repository at this point in the history
Bug: #97
  • Loading branch information
oxr463 authored May 6, 2019
1 parent 7cc8e9d commit c2ddf09
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
all: sds-test
LIBVERSION = 2.0.0

SDS_SRC = sds.c sds.h sdsalloc.h

PREFIX ?= /usr/local
INCLUDE_PATH ?= include/sds
LIBRARY_PATH ?= lib

INSTALL_INCLUDE_PATH = $(DESTDIR)$(PREFIX)/$(INCLUDE_PATH)
INSTALL_LIBRARY_PATH = $(DESTDIR)$(PREFIX)/$(LIBRARY_PATH)

INSTALL ?= cp -a

.PHONY: all

all: sds-test sds-install

sds-install: sds-lib
mkdir -p $(INSTALL_INCLUDE_PATH) $(INSTALL_LIBRARY_PATH)
$(INSTALL) libsds.so.$(LIBVERSION) $(INSTALL_LIBRARY_PATH)
$(INSTALL) sds.h $(INSTALL_INCLUDE_PATH)

sds-lib: sds.c sds.h sdsalloc.h
$(CC) -fPIC -fstack-protector -std=c99 -pedantic -Wall -Werror -shared \
-o libsds.so.$(LIBVERSION) -Wl,-soname=libsds.so.$(LIBVERSION) $(SDS_SRC)

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

0 comments on commit c2ddf09

Please sign in to comment.