# see config.h for application level config, config.make is created from it
include config.make
+CPPFLAGS=
CFLAGS=-Og -g -Wall -Wno-unused-function $(DEBUG_CFLAGS)
+LDLIBS=
-dist_VERSION=0.3
+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 \
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):
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) {
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) {
// Whether to create a FastCGI binary
#define USE_FCGI 1
-// Name of main installed binary
-#define blog_bin "blog.fcgi"
-//#define blog_bin "blog"
-// If cgi mode is used, name of command that handles tag urls (softlink to blog_bin)
-#define tag_bin "tag"
-// If cgi mode is used, name of command that handles post urls (softlink to blog_bin)
-#define post_bin "post"
-
+// 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"
+#define TAG_SCRIPT "/tag"
+#define POST_SCRIPT "/post"