Move httpd port into config.h
[blerg.git] / Makefile
1 include libs.mk
2
3 CFLAGS ?= -g
4 INCLUDES = -I. -Idatabase -Icommon $(YAJL_INCLUDES)
5 HTTP_INCLUDES = -Ihttp $(MHD_INCLUDES)
6 CGI_INCLUDES = -Icgi $(CGI_UTIL_INCLUDES)
7 LDFLAGS ?=
8 HTTP_LIBDIRS = $(MHD_LIBDIR) $(YAJL_LIBDIR)
9 CGI_LIBDIRS = $(CGI_UTIL_LIBDIR) $(YAJL_LIBDIR)
10
11 targets = blerg.a blergtool blerg.httpd blerg.cgi rss.cgi
12 blerg_a_objects = database/database.o database/tags.o database/util.o
13 blergtool_objects = tools/blergtool.o blerg.a
14 rss_objects = cgi/rss.o cgi/canned_responses.o common/app.o common/escapery.o blerg.a
15 http_blerg_objects = http/http_blerg.o http/canned_responses.o common/app.o common/json.o common/auth.o blerg.a
16 cgi_blerg_objects = cgi/cgi_blerg.o cgi/canned_responses.o common/app.o common/json.o common/auth.o blerg.a
17
18 all: $(targets)
19
20 clean:
21         rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects) $(cgi_blerg_objects) $(rss_objects)
22
23 blerg.a: $(blerg_a_objects)
24         ar rcu $@ $(blerg_a_objects)
25
26 blergtool: $(blergtool_objects)
27         gcc $(LDFLAGS) $^ -o $@
28
29 blerg.httpd: $(http_blerg_objects)
30         gcc $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
31
32 blerg.cgi: $(cgi_blerg_objects)
33         gcc $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@
34
35 rss.cgi: $(rss_objects)
36         gcc $(CGI_LIBDIRS) $(LDFLAGS) $(rss_objects) -lcgi-util -o $@
37
38 http/%.o: http/%.c
39         gcc $(INCLUDES) $(HTTP_INCLUDES) $(CFLAGS) -c $< -o $@
40
41 cgi/%.o: cgi/%.c
42         gcc $(INCLUDES) $(CGI_INCLUDES) $(CFLAGS) -c $< -o $@
43
44 %.o: %.c
45         gcc $(INCLUDES) $(CFLAGS) -c $< -o $@