X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=Makefile;h=640be85a90ef48fe6024abbaefb196f52be6bf70;hb=213e6e64dd863fd39d0db7c6fb4ccf1970a868fb;hp=0b99b0df19c664386668810a98c957ba4e6218f2;hpb=c18e5d36dc4788195df4bdaf536efde3a1a3d780;p=blerg.git diff --git a/Makefile b/Makefile index 0b99b0d..640be85 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,43 @@ -CFLAGS = -g -LIBS = +CFLAGS ?= -g +INCLUDES = -I. -Idatabase -Icommon -Iyajl/build/yajl-1.0.11/include +HTTP_INCLUDES = -Ihttp -Ilibmicrohttpd-0.9.3/src/include +CGI_INCLUDES = -Icgi -Icgi-util-2.2.1 +LDFLAGS ?= +HTTP_LIBDIRS = -Llibmicrohttpd-0.9.3/src/daemon/.libs -Lyajl/build/yajl-1.0.11/lib +CGI_LIBDIRS = -Lcgi-util-2.2.1 -Lyajl/build/yajl-1.0.11/lib -targets = blergtool -blergtool_objects = blergtool.o database.o +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) $(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 $@