Paranoia fix for reading password version
[blerg.git] / Makefile
1 include libs.mk
2
3 CFLAGS ?= -g
4 INCLUDES = -I. -Idatabase -Icommon -Ibuilddeps/scrypt-1.1.6/lib/crypto $(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 blerglatest blerg.cgi rss.cgi www/build/enyo-blerg.js
12 blerg_a_objects = database/database.o database/tags.o database/util.o database/subscription.o common/stringbucket.o
13 blergtool_objects = tools/blergtool.o blerg.a
14 blerglatest_objects = tools/blerglatest.o blerg.a common/json.o
15 rss_objects = cgi/rss.o cgi/canned_responses.o common/app.o common/escapery.o blerg.a
16 http_blerg_objects = http/http_blerg.o http/canned_responses.o common/app.o common/json.o common/auth.o common/md5.o blerg.a
17 cgi_blerg_objects = cgi/cgi_blerg.o cgi/canned_responses.o common/app.o common/json.o common/auth.o common/md5.o builddeps/scrypt.a blerg.a
18
19 all: $(targets)
20
21 clean:
22         rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(blerglatest_objects) $(http_blerg_objects) $(cgi_blerg_objects) $(rss_objects) builddeps/*.a
23         @make -C builddeps/scrypt-1.1.6 distclean
24         @make -C builddeps/scrypt-1.1.6/lib/crypto clean
25
26 blerg.a: $(blerg_a_objects)
27         ar rcu $@ $(blerg_a_objects)
28
29 blergtool: $(blergtool_objects)
30         gcc $(LDFLAGS) $^ -o $@
31
32 blerglatest: $(blerglatest_objects)
33         gcc $(YAJL_LIBDIR) $(LDFLAGS) $^ -lyajl_s -o $@
34
35 blerg.httpd: $(http_blerg_objects)
36         gcc $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
37
38 blerg.cgi: $(cgi_blerg_objects)
39         gcc $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@
40
41 rss.cgi: $(rss_objects)
42         gcc $(CGI_LIBDIRS) $(LDFLAGS) $(rss_objects) -lcgi-util -o $@
43
44 http/%.o: http/%.c
45         gcc $(INCLUDES) $(HTTP_INCLUDES) $(CFLAGS) -c $< -o $@
46
47 cgi/%.o: cgi/%.c
48         gcc $(INCLUDES) $(CGI_INCLUDES) $(CFLAGS) -c $< -o $@
49
50 %.o: %.c
51         gcc $(INCLUDES) $(CFLAGS) -c $< -o $@
52
53 www/build/enyo-blerg.js: www/jssrc/blerg/* www/jssrc/package.js www/jssrc/package-min.js
54         which node >/dev/null   # Please install Node.js to re-minify the JS
55         cd www/jssrc && enyo/tools/minify.sh -output ../build/enyo-blerg -no-alias package-min.js
56
57 builddeps/scrypt-1.1.6/config.h:
58         cd builddeps/scrypt-1.1.6 && ./configure
59
60 builddeps/scrypt.a: builddeps/scrypt-1.1.6/config.h
61         make -C builddeps/scrypt-1.1.6/lib/crypto
62         cp builddeps/scrypt-1.1.6/lib/crypto/scrypt.a builddeps/