X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=Makefile;h=fe4691f31bd220a5f074536464054eb4ad5be01f;hb=8cf18d84c5d5c49cfab0e181e9bb3c2777554da2;hp=5722ba5359a9539ac2a5b0bdc0c7e1c7c25020d4;hpb=fff174451c104dd5dab4517a71b660263ffd8b4e;p=blerg.git diff --git a/Makefile b/Makefile index 5722ba5..fe4691f 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,66 @@ -CFLAGS = -g -Ilibmicrohttpd-0.9.3/src/include -Iyajl/build/yajl-1.0.11/include -LDFLAGS = -Llibmicrohttpd-0.9.3/src/daemon/.libs -Lyajl/build/yajl-1.0.11/lib +include libs.mk -targets = blerg.a blergtool http_blerg -blerg_a_objects = database.o tags.o -blergtool_objects = blergtool.o blerg.a -http_blerg_objects = http_blerg.o canned_responses.o auth.o blerg.a +ARCH=$(shell uname -m) +CFLAGS ?= -g +ifeq ($(ARCH),x86_64) + CFLAGS += -fPIC +endif +INCLUDES = -I. -Idatabase -Icommon -Ibuilddeps/scrypt-1.1.6/lib/crypto $(YAJL_INCLUDES) +HTTP_INCLUDES = -Ihttp $(MHD_INCLUDES) +CGI_INCLUDES = -Icgi $(CGI_UTIL_INCLUDES) +LDFLAGS ?= +HTTP_LIBDIRS = $(MHD_LIBDIR) $(YAJL_LIBDIR) +CGI_LIBDIRS = $(CGI_UTIL_LIBDIR) $(YAJL_LIBDIR) + +targets = blerg.a blerg_auth.a blergtool blerglatest blerg.cgi www/build/enyo-blerg.js +blerg_a_objects = database/database.o database/tags.o database/util.o database/subscription.o common/stringbucket.o +blerg_auth_a_objects = common/auth.o common/md5.o +blergtool_objects = tools/blergtool.o blerg.a +blerglatest_objects = tools/blerglatest.o blerg.a common/json.o +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 +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 all: $(targets) clean: - rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects) + rm -f $(targets) $(blerg_a_objects) $(blerg_auth_a_objects) $(blergtool_objects) $(blerglatest_objects) $(http_blerg_objects) $(cgi_blerg_objects) builddeps/*.a + @make -C builddeps/scrypt-1.1.6 distclean + @make -C builddeps/scrypt-1.1.6/lib/crypto clean blerg.a: $(blerg_a_objects) ar rcu $@ $(blerg_a_objects) +blerg_auth.a: builddeps/scrypt.a $(blerg_auth_a_objects) + ar rcu $@ $(blerg_auth_a_objects) + blergtool: $(blergtool_objects) - gcc $^ -o $@ + gcc $(LDFLAGS) $^ -o $@ + +blerglatest: $(blerglatest_objects) + gcc $(YAJL_LIBDIR) $(LDFLAGS) $^ -lyajl_s -o $@ + +blerg.httpd: $(http_blerg_objects) + gcc $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@ + +blerg.cgi: $(cgi_blerg_objects) + gcc $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@ -http_blerg: $(http_blerg_objects) - gcc $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@ +http/%.o: http/%.c + gcc $(INCLUDES) $(HTTP_INCLUDES) $(CFLAGS) -c $< -o $@ + +cgi/%.o: cgi/%.c + gcc $(INCLUDES) $(CGI_INCLUDES) $(CFLAGS) -c $< -o $@ %.o: %.c - gcc $(CFLAGS) $(LIBS) -c $< -o $@ + gcc $(INCLUDES) $(CFLAGS) -c $< -o $@ + +www/build/enyo-blerg.js: www/jssrc/blerg/* www/jssrc/package.js www/jssrc/package-min.js + which node >/dev/null # Please install Node.js to re-minify the JS + cd www/jssrc && enyo/tools/minify.sh -output ../build/enyo-blerg -no-alias package-min.js + +builddeps/scrypt-1.1.6/config.h: + cd builddeps/scrypt-1.1.6 && ./configure + +builddeps/scrypt.a: builddeps/scrypt-1.1.6/config.h + make -C builddeps/scrypt-1.1.6/lib/crypto CFLAGS="$(CFLAGS)" + cp builddeps/scrypt-1.1.6/lib/crypto/scrypt.a builddeps/