Minor makefile cleanup
[blerg.git] / Makefile
index 761b2bb..137844b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,26 @@
-libmicrohttpd_a = libmicrohttpd-0.9.3/src/daemon/.libs/libmicrohttpd.a
-
-CFLAGS = -g -Ilibmicrohttpd-0.9.3/src/include
-LIBS =
+CFLAGS ?= -g
+INCLUDES = -Ilibmicrohttpd-0.9.3/src/include -Iyajl/build/yajl-1.0.11/include
+LDFLAGS ?=
+LIBDIRS = -Llibmicrohttpd-0.9.3/src/daemon/.libs -Lyajl/build/yajl-1.0.11/lib
 
 targets = blerg.a blergtool http_blerg
 blerg_a_objects = database.o tags.o
 blergtool_objects = blergtool.o blerg.a
-http_blerg_objects = http_blerg.o auth.o blerg.a
+http_blerg_objects = http_blerg.o canned_responses.o auth.o blerg.a
 
 all: $(targets)
 
 clean:
        rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects)
-       -cd libmicrohttpd-0.9.3 && make distclean
 
 blerg.a: $(blerg_a_objects)
        ar rcu $@ $(blerg_a_objects)
 
-$(libmicrohttpd_a):
-       cd libmicrohttpd-0.9.3 && ./configure --disable-https --disable-shared && make
-
 blergtool: $(blergtool_objects)
-       gcc $^ -o $@
+       gcc $(LDFLAGS) $^ -o $@
 
-http_blerg: $(http_blerg_objects) $(libmicrohttpd_a)
-       gcc $(http_blerg_objects) -lpthread $(libmicrohttpd_a) -o $@
+http_blerg: $(http_blerg_objects)
+       gcc $(LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
 
 %.o: %.c
-       gcc $(CFLAGS) $(LIBS) -c $< -o $@
+       gcc $(INCLUDES) $(CFLAGS) -c $< -o $@