Whoops, shouldn't mix fd and FILE* methods
[blerg.git] / Makefile
1 CFLAGS ?= -g
2 INCLUDES = -I. -Ifcgi -Idatabase -Icommon -Icgi-util-2.2.1 -Ilibmicrohttpd-0.9.3/src/include -Iyajl/build/yajl-1.0.11/include
3 LDFLAGS ?=
4 HTTP_LIBDIRS = -Llibmicrohttpd-0.9.3/src/daemon/.libs -Lyajl/build/yajl-1.0.11/lib
5 CGI_LIBDIRS = -Lcgi-util-2.2.1 -Lyajl/build/yajl-1.0.11/lib
6
7 targets = blerg.a blergtool http_blerg cgi_blerg
8 blerg_a_objects = database/database.o database/tags.o database/util.o
9 blergtool_objects = tools/blergtool.o blerg.a
10 http_blerg_objects = http/http_blerg.o http/canned_responses.o common/app.o common/auth.o blerg.a
11 cgi_blerg_objects = cgi/cgi_blerg.o common/app.o common/auth.o blerg.a
12
13 all: $(targets)
14
15 clean:
16         rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects)
17
18 blerg.a: $(blerg_a_objects)
19         ar rcu $@ $(blerg_a_objects)
20
21 blergtool: $(blergtool_objects)
22         gcc $(LDFLAGS) $^ -o $@
23
24 http_blerg: $(http_blerg_objects)
25         gcc $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
26
27 cgi_blerg: $(cgi_blerg_objects)
28         gcc $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@
29
30 %.o: %.c
31         gcc $(INCLUDES) $(CFLAGS) -c $< -o $@