8 INCLUDES = -I. -Idatabase -Icommon -Ibuilddeps/scrypt-1.1.6/lib/crypto $(YAJL_INCLUDES)
9 HTTP_INCLUDES = -Ihttp $(MHD_INCLUDES)
10 CGI_INCLUDES = -Icgi $(CGI_UTIL_INCLUDES)
12 HTTP_LIBDIRS = $(MHD_LIBDIR) $(YAJL_LIBDIR)
13 CGI_LIBDIRS = $(CGI_UTIL_LIBDIR) $(YAJL_LIBDIR)
15 targets = blerg.a blerg_auth.a blergtool blerglatest blerg.cgi perl-lib www/build/enyo-blerg.js
16 blerg_a_objects = database/database.o database/tags.o database/util.o database/configuration.o database/subscription.o common/stringbucket.o common/stringring.o
17 blerg_auth_a_objects = common/auth.o common/md5.o
18 blergtool_objects = tools/blergtool.o blerg.a
19 blerglatest_objects = tools/blerglatest.o blerg.a common/json.o
20 http_blerg_objects = http/http_blerg.o http/canned_responses.o common/app.o common/json.o blerg_auth.a builddeps/scrypt.a blerg.a
21 cgi_blerg_objects = cgi/cgi_blerg.o cgi/canned_responses.o common/app.o common/json.o blerg_auth.a builddeps/scrypt.a blerg.a
26 rm -f $(targets) $(blerg_a_objects) $(blerg_auth_a_objects) $(blergtool_objects) $(blerglatest_objects) $(http_blerg_objects) $(cgi_blerg_objects) builddeps/*.a
27 @-make -C builddeps/scrypt-1.1.6 distclean
28 @-make -C builddeps/scrypt-1.1.6/lib/crypto clean
29 @-make -C lib/perl/Blerg-Database clean
33 cd lib/perl/Blerg-Database && perl Makefile.PL
34 make -C lib/perl/Blerg-Database
36 blerg.a: $(blerg_a_objects)
37 ar rcu $@ $(blerg_a_objects)
39 blerg_auth.a: builddeps/scrypt.a $(blerg_auth_a_objects)
40 ar rcu $@ $(blerg_auth_a_objects)
42 blergtool: $(blergtool_objects)
43 $(CC) $(LDFLAGS) $^ -o $@
45 blerglatest: $(blerglatest_objects)
46 $(CC) $(YAJL_LIBDIR) $(LDFLAGS) $^ -lyajl_s -o $@
48 blerg.httpd: $(http_blerg_objects)
49 $(CC) $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@
51 blerg.cgi: $(cgi_blerg_objects)
52 $(CC) $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@
55 $(CC) $(INCLUDES) $(HTTP_INCLUDES) $(CFLAGS) -c $< -o $@
58 $(CC) $(INCLUDES) $(CGI_INCLUDES) $(CFLAGS) -c $< -o $@
61 $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
63 www/build/enyo-blerg.js: www/jssrc/blerg/* www/jssrc/package.js www/jssrc/package-min.js
64 which node >/dev/null # Please install Node.js to re-minify the JS
65 cd www/jssrc && enyo/tools/minify.sh -output ../build/enyo-blerg -no-alias package-min.js
67 builddeps/scrypt-1.1.6/config.h:
68 cd builddeps/scrypt-1.1.6 && ./configure
70 builddeps/scrypt.a: builddeps/scrypt-1.1.6/config.h
71 make -C builddeps/scrypt-1.1.6/lib/crypto CFLAGS="$(CFLAGS)"
72 cp builddeps/scrypt-1.1.6/lib/crypto/scrypt.a builddeps/
75 docs: www/doc/perl www/doc/perl/Blerg-Database.html
80 www/doc/perl/Blerg-Database.html: lib/perl/Blerg-Database/lib/Blerg/Database.pm
85 @echo "Please use 'make install-environment' to install Blërg to an environment"
87 .PHONY: install-environment
88 install-environment: all docs
89 @if [ -z "$(ENV_DIR)" ]; then \
90 echo "Specify the install directory in the ENV_DIR variable"; \
93 install --mode 755 -d \
95 $(ENV_DIR)/lib/cgi-bin \
97 $(ENV_DIR)/data/data \
98 $(ENV_DIR)/data/hash_tags \
99 $(ENV_DIR)/data/ref_tags \
100 $(ENV_DIR)/www/build \
102 $(ENV_DIR)/www/doc/perl \
103 $(ENV_DIR)/www/images
104 install --mode 755 blerg.cgi rss.cgi $(ENV_DIR)/lib/cgi-bin/
105 install --mode 755 blergtool blerglatest $(ENV_DIR)/bin/
106 install --mode 644 www/favicon.gif www/favicon.ico www/index.html \
109 install --mode 644 www/build/enyo-blerg.js www/build/enyo-blerg.css \
110 $(ENV_DIR)/www/build/
111 install --mode 644 www/css/blerg.css www/css/doc.css \
113 install --mode 644 www/doc/changelog.html www/doc/index.html \
114 www/doc/post_help.html www/doc/privacy_data.html \
115 www/doc/contact.html \
117 install --mode 644 www/doc/perl/Blerg-Database.html \
118 $(ENV_DIR)/www/doc/perl/
119 install --mode 644 www/images/blerglogo.png www/images/corner.svg \
120 www/images/play.png www/images/rss.png \
121 $(ENV_DIR)/www/images/
122 www/jssrc/lib/onyx/deploy.sh $(ENV_DIR)/www/jssrc/lib/onyx
123 cd lib/perl/Blerg-Database && perl Makefile.PL INSTALL_BASE="$(ENV_DIR)"
124 make -C lib/perl/Blerg-Database install
125 perl scripts/write-environment-configs.pl $(ENV_DIR)