stagit

- static git page generator
git clone git://git.acid.vegas/stagit.git
Log | Files | Refs | Archive | README | LICENSE

Makefile (2641B)

      1 .POSIX:
      2 
      3 NAME = stagit
      4 VERSION = 1.2
      5 
      6 # paths
      7 PREFIX = /usr/local
      8 MANPREFIX = ${PREFIX}/man
      9 DOCPREFIX = ${PREFIX}/share/doc/${NAME}
     10 
     11 LIB_INC = -I/usr/local/include
     12 LIB_LIB = -L/usr/local/lib -lgit2 -lmd4c-html
     13 
     14 # use system flags.
     15 STAGIT_CFLAGS = ${LIB_INC} ${CFLAGS}
     16 STAGIT_LDFLAGS = ${LIB_LIB} ${LDFLAGS}
     17 STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE
     18 
     19 # Uncomment to enable workaround for older libgit2 which don't support this
     20 # option. This workaround will be removed in the future *pinky promise*.
     21 #STAGIT_CFLAGS += -DGIT_OPT_SET_OWNER_VALIDATION=-1
     22 
     23 SRC = \
     24 	stagit.c\
     25 	stagit-index.c
     26 COMPATSRC = \
     27 	reallocarray.c\
     28 	strlcat.c\
     29 	strlcpy.c
     30 BIN = \
     31 	stagit\
     32 	stagit-index
     33 MAN1 = \
     34 	stagit.1\
     35 	stagit-index.1
     36 DOC = \
     37 	LICENSE\
     38 	README.md
     39 HDR = compat.h
     40 
     41 COMPATOBJ = \
     42 	reallocarray.o\
     43 	strlcat.o\
     44 	strlcpy.o
     45 
     46 OBJ = ${SRC:.c=.o} ${COMPATOBJ}
     47 
     48 all: ${BIN}
     49 
     50 .o:
     51 	${CC} -o $@ ${LDFLAGS}
     52 
     53 .c.o:
     54 	${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS}
     55 
     56 dist:
     57 	rm -rf ${NAME}-${VERSION}
     58 	mkdir -p ${NAME}-${VERSION}
     59 	cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \
     60 		Makefile assets/favicon.png assets/logo.png assets/style.css assets/helper ${NAME}-${VERSION}
     61 	# make tarball
     62 	tar -cf - ${NAME}-${VERSION} | \
     63 		gzip -c > ${NAME}-${VERSION}.tar.gz
     64 	rm -rf ${NAME}-${VERSION}
     65 
     66 ${OBJ}: ${HDR}
     67 
     68 stagit: stagit.o ${COMPATOBJ}
     69 	${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
     70 
     71 stagit-index: stagit-index.o ${COMPATOBJ}
     72 	${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
     73 
     74 clean:
     75 	rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
     76 
     77 install: all
     78 	# installing executable files.
     79 	mkdir -p ${DESTDIR}${PREFIX}/bin
     80 	cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
     81 	for f in ${BIN}; do chmod 755 ${DESTDIR}${PREFIX}/bin/$$f; done
     82 	# installing example files.
     83 	mkdir -p ${DESTDIR}${DOCPREFIX}
     84 	cp -f assets/style.css\
     85 		assets/favicon.png\
     86 		assets/logo.png\
     87 		assets/helper\
     88 		README.md\
     89 		${DESTDIR}${DOCPREFIX}
     90 	# installing manual pages.
     91 	mkdir -p ${DESTDIR}${MANPREFIX}/man1
     92 	cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1
     93 	for m in ${MAN1}; do chmod 644 ${DESTDIR}${MANPREFIX}/man1/$$m; done
     94 
     95 uninstall:
     96 	# removing executable files.
     97 	for f in ${BIN}; do rm -f ${DESTDIR}${PREFIX}/bin/$$f; done
     98 	# removing example files.
     99 	rm -f \
    100 		${DESTDIR}${DOCPREFIX}/style.css\
    101 		${DESTDIR}${DOCPREFIX}/favicon.png\
    102 		${DESTDIR}${DOCPREFIX}/logo.png\
    103 		${DESTDIR}${DOCPREFIX}/example_create.sh\
    104 		${DESTDIR}${DOCPREFIX}/example_post-receive.sh\
    105 		${DESTDIR}${DOCPREFIX}/README.md
    106 	-rmdir ${DESTDIR}${DOCPREFIX}
    107 	# removing manual pages.
    108 	for m in ${MAN1}; do rm -f ${DESTDIR}${MANPREFIX}/man1/$$m; done
    109 
    110 .PHONY: all clean dist install uninstall