Organize source tree
[blerg.git] / Makefile
1 CFLAGS ?= -g
2 INCLUDES = -I. -Idatabase -Imisc -Ilibmicrohttpd-0.9.3/src/include -Iyajl/build/yajl-1.0.11/include
3 LDFLAGS ?=
4 LIBDIRS = -Llibmicrohttpd-0.9.3/src/daemon/.libs -Lyajl/build/yajl-1.0.11/lib
5
6 targets = blerg.a blergtool http_blerg
7 blerg_a_objects = database/database.o database/tags.o
8 blergtool_objects = tools/blergtool.o blerg.a
9 http_blerg_objects = http/http_blerg.o http/canned_responses.o misc/auth.o blerg.a
10
11 all: $(targets)
12
13 clean:
14         rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects)
15
16 blerg.a: $(blerg_a_objects)
17         ar rcu $@ $(blerg_a_objects)
18
19 blergtool: $(blergtool_objects)
20         gcc $(LDFLAGS) $^ -o $@
21
22 http_blerg: $(http_blerg_objects)
23         gcc $(LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
24
25 %.o: %.c
26         gcc $(INCLUDES) $(CFLAGS) -c $< -o $@