logo

stagit

STAtic GIT web view generator (in C)

Makefile (2130B)


      1 include config.mk
      2 
      3 NAME = stagit
      4 VERSION = 0.9.1
      5 
      6 SRC = \
      7 	stagit.c\
      8 	stagit-index.c
      9 COMPATSRC = \
     10 	reallocarray.c\
     11 	strlcat.c\
     12 	strlcpy.c
     13 BIN = \
     14 	stagit\
     15 	stagit-index
     16 MAN1 = \
     17 	stagit.1\
     18 	stagit-index.1
     19 DOC = \
     20 	LICENSE\
     21 	README
     22 HDR = compat.h
     23 
     24 COMPATOBJ = \
     25 	reallocarray.o\
     26 	strlcat.o\
     27 	strlcpy.o
     28 
     29 OBJ = ${SRC:.c=.o} ${COMPATOBJ}
     30 
     31 all: ${BIN}
     32 
     33 .o:
     34 	${CC} ${LDFLAGS} -o $@ ${LIBS}
     35 
     36 .c.o:
     37 	${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
     38 
     39 dist:
     40 	rm -rf ${NAME}-${VERSION}
     41 	mkdir -p ${NAME}-${VERSION}
     42 	cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \
     43 		Makefile config.mk favicon.png logo.png style.css \
     44 		example_create.sh example_post-receive.sh \
     45 		${NAME}-${VERSION}
     46 	# make tarball
     47 	tar -cf - ${NAME}-${VERSION} | \
     48 		gzip -c > ${NAME}-${VERSION}.tar.gz
     49 	rm -rf ${NAME}-${VERSION}
     50 
     51 ${OBJ}: config.mk ${HDR}
     52 
     53 stagit: stagit.o ${COMPATOBJ}
     54 	${CC} -o $@ stagit.o ${COMPATOBJ} ${LDFLAGS}
     55 
     56 stagit-index: stagit-index.o ${COMPATOBJ}
     57 	${CC} -o $@ stagit-index.o ${COMPATOBJ} ${LDFLAGS}
     58 
     59 clean:
     60 	rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
     61 
     62 install: all
     63 	# installing executable files.
     64 	mkdir -p ${DESTDIR}${PREFIX}/bin
     65 	cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
     66 	for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
     67 	# installing example files.
     68 	mkdir -p ${DESTDIR}${DOCPREFIX}
     69 	cp -f style.css\
     70 		favicon.png\
     71 		logo.png\
     72 		example_create.sh\
     73 		example_post-receive.sh\
     74 		README\
     75 		${DESTDIR}${DOCPREFIX}
     76 	# installing manual pages.
     77 	mkdir -p ${DESTDIR}${MANPREFIX}/man1
     78 	cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
     79 	for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done
     80 
     81 uninstall:
     82 	# removing executable files.
     83 	for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
     84 	# removing example files.
     85 	rm -f \
     86 		${DESTDIR}${DOCPREFIX}/style.css\
     87 		${DESTDIR}${DOCPREFIX}/favicon.png\
     88 		${DESTDIR}${DOCPREFIX}/logo.png\
     89 		${DESTDIR}${DOCPREFIX}/example_create.sh\
     90 		${DESTDIR}${DOCPREFIX}/example_post-receive.sh\
     91 		${DESTDIR}${DOCPREFIX}/README
     92 	-rmdir ${DESTDIR}${DOCPREFIX}
     93 	# removing manual pages.
     94 	for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done
     95 
     96 .PHONY: all clean dist install uninstall