Makefile improvements - stagit-gopher - A git gopher frontend. (mirror) HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 9fcf880188ff2b8b8645f124cc497ea72451dc92 DIR parent 3a1f4248d1501107f9f252e507509b822af7b9f8 HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Sun, 22 Dec 2019 12:47:29 +0100 Makefile improvements - remove double -c in .c.o target. - remove config.mk abstraction. - change LIBS and INCS to LIBGIT_INC and LIBGIT_LIB. - use system cflags and ldflags, but allow the same override rules for porters. Diffstat: M Makefile | 27 ++++++++++++++++++++------- D config.mk | 30 ------------------------------ 2 files changed, 20 insertions(+), 37 deletions(-) --- DIR diff --git a/Makefile b/Makefile @@ -1,8 +1,21 @@ -include config.mk +.POSIX: NAME = stagit-gopher VERSION = 0.9.2 +# paths +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/man +DOCPREFIX = ${PREFIX}/share/doc/${NAME} + +LIBGIT_INC = -I/usr/local/include +LIBGIT_LIB = -L/usr/local/lib -lgit2 + +# use system flags. +STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS} +STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS} +STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE + SRC = \ stagit-gopher.c\ stagit-gopher-index.c @@ -29,16 +42,16 @@ OBJ = ${SRC:.c=.o} ${COMPATOBJ} all: ${BIN} .o: - ${CC} ${LDFLAGS} -o $@ ${LIBS} + ${CC} -o $@ ${LDFLAGS} .c.o: - ${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $< + ${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS} dist: rm -rf ${NAME}-${VERSION} mkdir -p ${NAME}-${VERSION} cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \ - Makefile config.mk \ + Makefile \ example_create.sh example_post-receive.sh \ ${NAME}-${VERSION} # make tarball @@ -46,13 +59,13 @@ dist: gzip -c > ${NAME}-${VERSION}.tar.gz rm -rf ${NAME}-${VERSION} -${OBJ}: config.mk ${HDR} +${OBJ}: ${HDR} stagit-gopher: stagit-gopher.o ${COMPATOBJ} - ${CC} -o $@ stagit-gopher.o ${COMPATOBJ} ${LDFLAGS} + ${CC} -o $@ stagit-gopher.o ${COMPATOBJ} ${STAGIT_LDFLAGS} stagit-gopher-index: stagit-gopher-index.o ${COMPATOBJ} - ${CC} -o $@ stagit-gopher-index.o ${COMPATOBJ} ${LDFLAGS} + ${CC} -o $@ stagit-gopher-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS} clean: rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz DIR diff --git a/config.mk b/config.mk @@ -1,30 +0,0 @@ -# customize below to fit your system - -# paths -PREFIX = /usr/local -MANPREFIX = ${PREFIX}/man -DOCPREFIX = ${PREFIX}/share/doc/stagit-gopher - -# compiler and linker -#CC = cc - -GITINC = /usr/local/include -GITLIB = /usr/local/lib - -# includes and libs -INCS = -I${GITINC} -LIBS = -L${GITLIB} -lgit2 - -# debug -#CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic ${INCS} -#LDFLAGS = ${LIBS} - -# optimized -CFLAGS = -O2 -std=c99 ${INCS} -LDFLAGS = -s ${LIBS} - -# optimized static -#CFLAGS = -static -O2 -std=c99 ${INCS} -#LDFLAGS = -static -s ${LIBS} - -CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}