stagit

Fork of hiltjo's stagit (see http://codemadness.org/stagit.html)
git clone git://git.vgx.fr/stagit
Log | Files | Refs | README | LICENSE

Makefile (2675B)


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