Made the binary names configurable.
authorNot Zed <notzed@gmail.com>
Thu, 2 May 2019 22:41:18 +0000 (08:11 +0930)
committerNot Zed <notzed@gmail.com>
Thu, 2 May 2019 22:41:18 +0000 (08:11 +0930)
Fixed some errors in the Makefile.
Fixed url path bugs in generator.

Makefile
blog.c
config.h.in

index 482cf2b..839e8c9 100644 (file)
--- a/Makefile
+++ b/Makefile
 # see config.h for application level config, config.make is created from it
 include config.make
 
-CPPFLAGS=-I../libeze
+CPPFLAGS=
 CFLAGS=-Og -g -Wall -Wno-unused-function $(DEBUG_CFLAGS)
-LDLIBS=-L../libeze -leze
+LDLIBS=
 
 dist_VERSION=0.3.99
 
 tools=newpost
-cgis=$(if $(USE_FCGI),blog.fcgi,blog.cgi)
+cgis=$(if $(USE_FCGI),$(BLOGZ_FCGI),$(BLOGZ_CGI))
 
 # these are the intermediate targets, not the sources
 blogz_TEMPLATES=blog-header.c blog-footer.c
 
 blogz_PROGRAMS= $(cgis) $(tools)
 
-blog.fcgi_SRCS=blog.c posts.c $(blogz_TEMPLATES) blogio-fcgi.c fcgi.c
-blog.cgi_SRCS=blog.c posts.c $(blogz_TEMPLATES)  blogio-stdio.c
+$(BLOGZ_FCGI)_SRCS=blog.c posts.c $(blogz_TEMPLATES) blogio-fcgi.c fcgi.c
+$(BLOGZ_CGI)_SRCS=blog.c posts.c $(blogz_TEMPLATES)  blogio-stdio.c
 newpost_SRCS=newpost.c
 
 built_SRCS=$(sort $(foreach prog,$(blogz_PROGRAMS),$($(prog)_SRCS)))
 
-dist_PROGRAMS=blog.cgi blog.fcgi newpost
+dist_PROGRAMS=$(BLOGZ_CGI) $(BLOGZ_FCGI) newpost
 dist_SRCS=$(sort $(foreach prog,$(dist_PROGRAMS),$($(prog)_SRCS)))
 dist_EXTRA=Makefile                                                    \
        README COPYING                                                  \
@@ -74,11 +74,13 @@ blog-%.c: template/blog-%.html maketemplate.pl
 etag.h: posts-tables.h $(blogz_TEMPLATES)
        date --rfc-3339 ns | md5sum  | awk '{ printf "static const char* etag = \"%s\";\n",$$1 }' > etag.h
 
+blog.o: etag.h
+
 clean:
        rm -f posts-tables.h $(blogz_TEMPLATES) config.make
        rm -f *.o
        rm -rf .deps
-       rm -f blog.cgi blog.fcgi
+       rm -f $(BLOGZ_CGI) $(BLOGZ_FCGI)
        rm -rf newpost
 
 $(DB_POST):
@@ -130,6 +132,3 @@ config.make: config.h Makefile
 ifeq (,$(filter clean install-db dist,$(MAKECMDGOALS)))
 -include $(patsubst %.c,.deps/%.d,$(built_SRCS))
 endif
-
-articledb: articledb.o
-       $(CC) -o $@ $^ -llmdb ../libeze/libeze.a
diff --git a/blog.c b/blog.c
index 4b787d7..4bea800 100644 (file)
--- a/blog.c
+++ b/blog.c
@@ -283,9 +283,9 @@ static void print_blog(const char *how, const char *path, postid_t *ids, int cou
        for (i=0;i<count;i++) {
                sprintf(file, "%s/%012lx", db, ids[i]);
 
-               post_header("post", ids[i]);
+               post_header(POST_SCRIPT, ids[i]);
                sendpath(file);
-               post_footer("blog", ids[i]);
+               post_footer(BLOG_SCRIPT, ids[i]);
        }
 
        if (newer || older) {
@@ -410,9 +410,9 @@ static void dopost(const char *path, const char *query) {
        page_header(blog_time(id));
        print_tags();
        
-       post_header("blog", id);
+       post_header(BLOG_SCRIPT, id);
        sendpath(file);
-       post_footer("blog", id);
+       post_footer(BLOG_SCRIPT, id);
 
        // TODO: Once I have a proper index this should output the post name
        if (newer || older) {
index 95c344f..c4028e8 100644 (file)
 // Whether to create a FastCGI binary
 #define USE_FCGI 1
 
+// Name of the backend binary
+#define BLOGZ_FCGI "blogz.fcgi"
+#define BLOGZ_CGI "blogz.cgi"
+
 // The name of the script from cgi SCRIPT_NAME variable.
 // This must match the ScriptAlias key
 #define BLOG_SCRIPT "/blog"