set -O0 for debug builds
[project/uci.git] / Makefile
index bf194d1..c136915 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,25 @@
+COPTS=-O2
+CFLAGS=$(COPTS) -fPIC -Wall -pedantic -std=gnu99 -Wno-unused -Werror
+ifneq ($(DEBUG),)
+  COPTS = -O0
+  CFLAGS += -g3 -DDEBUG_ALL
+endif
+
+AR=ar
 CC=gcc
-CFLAGS=-O2 -Wall -pedantic -std=gnu99 -Wno-unused -Werror
+RANLIB=ranlib
+
+all: uci
 
-all: parsetest
-parsetest: libuci.o test.o
+cli.o: cli.c uci.h
+uci: cli.o libuci.a
        $(CC) $(CFLAGS) -o $@ $^
 
-libuci.o: libuci.c parse.c libuci.h list.c err.h
-test.o: test.c libuci.h
+libuci.o: libuci.c file.c uci.h list.c err.h util.c
+libuci.a: libuci.o
+       rm -f $@
+       $(AR) rc $@ $^
+       $(RANLIB) $@
 
 clean:
-       rm -f parsetest *.o
+       rm -f uci *.[oa]