aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 32 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b3fd009
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+CC ?= cc
+CFLAGS ?= -O2 -g
+PREFIX ?= /usr/local
+
+__CFLAGS := -I./include/ -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wextra
+
+all: libuconfig.a test/uconfig_test
+
+libuconfig.a: src/uconfig.o
+ ar rcs $@ $^
+
+src/uconfig.o: src/uconfig.c include/uconfig.h
+ $(CC) $(__CFLAGS) -c -fPIC $(CFLAGS) -o $@ $<
+
+test/uconfig_test: test/uconfig_test.o libuconfig.a
+ $(CC) -o $@ $^
+
+test/uconfig_test.o: test/uconfig_test.c include/uconfig.h
+ $(CC) $(__CFLAGS) -c -o $@ $<
+
+check: all
+ ./test/uconfig_test
+
+clean:
+ rm -f libuconfig.a src/uconfig.o
+
+install: libuconfig.a
+ mkdir -p $(PREFIX)/lib $(PREFIX)/include
+ cp libuconfig.a $(PREFIX)/lib/
+ cp include/uconfig.h $(PREFIX)/include/
+
+.PHONY: all check clean install