timekeeper

My first (abandoned unfinished) web application for time tracking
git clone git://jacobedwards.org/timekeeper
Log | Files | Refs | README

Makefile (1500B)


      1 name = timekeeper
      2 cc = ${CC}
      3 cflags = ${CFLAGS} -O0 -Wall -Wextra -I/usr/local/include
      4 lddflags = ${LDDFLAGS} -static -L/usr/local/lib -lkcgi -lkcgihtml -lz -lsqlbox -lsqlite3 -lm -lpthread
      5 prefix = /var/www/htdocs/${name}
      6 datadir = /var/www/var/timekeeper
      7 
      8 pages = pages/index.c pages/login.c pages/logout.c pages/account.c \
      9     pages/main.c pages/export.c pages/archive.c pages/frag.c
     10 hdrsrc = page.c html.c user.c stmt.c key.c times.c menu.c frag.c \
     11     pages/util.c pages/common.c
     12 src = ${hdrsrc} ${pages}
     13 hdr = ${hdrsrc:.c=.h} util.h pages/util.h pages/pages.h config.h
     14 obj = ${src:.c=.o}
     15 
     16 tests =
     17 
     18 all: ${name}
     19 
     20 .c.o:
     21 	${cc} ${cflags} -c -o $@ $<
     22 
     23 ${name}.o ${obj}: ${hdr}
     24 
     25 ${name}: ${name}.o ${obj}
     26 	${cc} -o $@ $@.o ${obj} ${lddflags}
     27 
     28 clean:
     29 	rm -f ${name} ${name}.o ${obj}
     30 	rm -f ${tests}
     31 
     32 install: ${name}
     33 	mkdir -p ${prefix} ${datadir}
     34 	cp -r scripts css ${prefix}
     35 	cp -r frags ${datadir}
     36 	cp -af ${name} ${prefix}
     37 
     38 install-run-pre:
     39 	pkill kfcgi || true
     40 
     41 install-run-post:
     42 	kfcgi -n 1 -N 1 -u www -U www -- /htdocs/${name}/${name}
     43 
     44 install-run: install-run-pre install install-run-post
     45 
     46 uninstall:
     47 	rm -rf ${prefix}/css ${prefix}/scripts
     48 	rm -rf ${datadir}/frags
     49 	rm -f ${prefix}/${name}
     50 
     51 ${tests}: ${tests:=.c} ${obj}
     52 	${cc} ${cflags} -I.  -o $@ $@.c ${obj} ${lddflags}
     53 
     54 test: ${tests}
     55 	for test in ${tests}; do \
     56 		if $$test; then echo $$test; else echo $$test FAILURE; fi ;\
     57 	done
     58 
     59 .PHONY: all clean install uninstall install-run-pre install-run-post install-run test
     60 .SUFFIX: .c .o