X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=Makefile;h=ed19b522059d843963b568b8507290a2d350e06d;hb=4e824b6fa432f65753fd00323375c6bbdde7a7f9;hp=a1164073785d530bd821add454094e8f05198f86;hpb=7a48489bbc0cfafdc2a55b0e479454f8d8c965ae;p=blerg.git diff --git a/Makefile b/Makefile index a116407..ed19b52 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,45 @@ -CFLAGS = -g -LIBS = +include libs.mk -targets = blerg.a blergtool tag_test -blerg_a_objects = database.o tags.o -blergtool_objects = blergtool.o blerg.a +CFLAGS ?= -g +INCLUDES = -I. -Idatabase -Icommon $(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 blergtool http_blerg cgi_blerg rss +blerg_a_objects = database/database.o database/tags.o database/util.o +blergtool_objects = tools/blergtool.o blerg.a +rss_objects = cgi/rss.o cgi/canned_responses.o common/app.o common/escapery.o blerg.a +http_blerg_objects = http/http_blerg.o http/canned_responses.o common/app.o common/json.o common/auth.o blerg.a +cgi_blerg_objects = cgi/cgi_blerg.o cgi/canned_responses.o common/app.o common/json.o common/auth.o blerg.a all: $(targets) clean: - rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) + rm -f $(targets) $(blerg_a_objects) $(blergtool_objects) $(http_blerg_objects) $(cgi_blerg_objects) $(rss_objects) blerg.a: $(blerg_a_objects) ar rcu $@ $(blerg_a_objects) blergtool: $(blergtool_objects) - gcc $^ -o $@ + gcc $(LDFLAGS) $^ -o $@ + +http_blerg: $(http_blerg_objects) + gcc $(HTTP_LIBDIRS) $(LDFLAGS) $(http_blerg_objects) -lpthread -lmicrohttpd -lyajl_s -o $@ + +cgi_blerg: $(cgi_blerg_objects) + gcc $(CGI_LIBDIRS) $(LDFLAGS) $(cgi_blerg_objects) -lcgi-util -lyajl_s -o $@ + +rss: $(rss_objects) + gcc $(CGI_LIBDIRS) $(LDFLAGS) $(rss_objects) -lcgi-util -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 $@