aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Liodden <eriklio@stud.ntnu.no>2017-12-04 11:05:38 +0100
committerErik Liodden <eriklio@stud.ntnu.no>2017-12-04 11:05:38 +0100
commite8fd7d216688880a5cfefb249c68f3ac30cbd00f (patch)
treee8dd4891c9f0dcb203c361210fc9b51258f6dfca
parent13eb9ceb1168010e1e329bc049f469b46540326b (diff)
downloadalgdat-e8fd7d216688880a5cfefb249c68f3ac30cbd00f.tar.gz
add make install and make uninstall
`make install` will put the compiled library in /usr/local/lib so it can be included using -lalgdat. it will also put the library header files in /usr/local/include/algdat. to use the library use for examle: /* source.c */ #include <algdat/sort.h> ... gcc source.c -lalgdat header files available for now: sort.h io.h structures.h misc.h
-rw-r--r--Makefile14
1 files changed, 14 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 86bafe3..e4843af 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,9 @@ LIB_FILE=libalgdat.a
LIB_H=structure.h misc.h io.h sort.h
LIBS = $(LIB_FILE)
+LIB_PATH=/usr/local/lib
+LIB_H_PATH=/usr/local/include/algdat
+
all: $(PROG)
test: test.c
debug: CFLAGS += -O0 -g
@@ -29,6 +32,17 @@ $(LIB_FILE): $(LIB_OBJS)
@echo \ [CC] $@
@$(CC) $(CFLAGS) -o $@ -c $<
+.PHONY:
+ clean install uninstall
+
+install: lib
+ cp $(LIB_FILE) $(LIB_PATH)
+ mkdir -p $(LIB_H_PATH)
+ cp $(LIB_H) $(LIB_H_PATH)
+
+uninstall:
+ rm -rf $(LIB_H_PATH)
+ rm -f $(LIB_PATH)/$(LIB_FILE)
clean:
rm -rf *.o $(PROG) $(LIB_FILE) *.dSYM test