stagit

static git page generator  https://git.ce9e.org
git clone https://git.ce9e.org/stagit.git

commit
adaff713dc3e9ff494632a44d5743cbc0e0e16c7
parent
d6937c195f3459194d5ab056397981e1ade54871
Author
Hiltjo Posthuma <hiltjo@codemadness.org>
Date
2019-12-01 17:26
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


diff --git a/Makefile b/Makefile

@@ -1,8 +1,21 @@
    1    -1 include config.mk
   -1     1 .POSIX:
    2     2 
    3     3 NAME = stagit
    4     4 VERSION = 0.9.2
    5     5 
   -1     6 # paths
   -1     7 PREFIX = /usr/local
   -1     8 MANPREFIX = ${PREFIX}/man
   -1     9 DOCPREFIX = ${PREFIX}/share/doc/${NAME}
   -1    10 
   -1    11 LIBGIT_INC = -I/usr/local/include
   -1    12 LIBGIT_LIB = -L/usr/local/lib -lgit2
   -1    13 
   -1    14 # use system flags.
   -1    15 STAGIT_CFLAGS = ${LIBGIT_INC} ${CFLAGS}
   -1    16 STAGIT_LDFLAGS = ${LIBGIT_LIB} ${LDFLAGS}
   -1    17 STAGIT_CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE
   -1    18 
    6    19 SRC = \
    7    20 	stagit.c\
    8    21 	stagit-index.c
@@ -31,16 +44,16 @@ OBJ = ${SRC:.c=.o} ${COMPATOBJ}
   31    44 all: ${BIN}
   32    45 
   33    46 .o:
   34    -1 	${CC} ${LDFLAGS} -o $@ ${LIBS}
   -1    47 	${CC} -o $@ ${LDFLAGS}
   35    48 
   36    49 .c.o:
   37    -1 	${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
   -1    50 	${CC} -o $@ -c $< ${STAGIT_CFLAGS} ${STAGIT_CPPFLAGS}
   38    51 
   39    52 dist:
   40    53 	rm -rf ${NAME}-${VERSION}
   41    54 	mkdir -p ${NAME}-${VERSION}
   42    55 	cp -f ${MAN1} ${HDR} ${SRC} ${COMPATSRC} ${DOC} \
   43    -1 		Makefile config.mk favicon.png logo.png style.css \
   -1    56 		Makefile favicon.png logo.png style.css \
   44    57 		example_create.sh example_post-receive.sh \
   45    58 		${NAME}-${VERSION}
   46    59 	# make tarball
@@ -48,13 +61,13 @@ dist:
   48    61 		gzip -c > ${NAME}-${VERSION}.tar.gz
   49    62 	rm -rf ${NAME}-${VERSION}
   50    63 
   51    -1 ${OBJ}: config.mk ${HDR}
   -1    64 ${OBJ}: ${HDR}
   52    65 
   53    66 stagit: stagit.o ${COMPATOBJ}
   54    -1 	${CC} -o $@ stagit.o ${COMPATOBJ} ${LDFLAGS}
   -1    67 	${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
   55    68 
   56    69 stagit-index: stagit-index.o ${COMPATOBJ}
   57    -1 	${CC} -o $@ stagit-index.o ${COMPATOBJ} ${LDFLAGS}
   -1    70 	${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
   58    71 
   59    72 clean:
   60    73 	rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz

diff --git a/config.mk b/config.mk

@@ -1,30 +0,0 @@
    1    -1 # customize below to fit your system
    2    -1 
    3    -1 # paths
    4    -1 PREFIX = /usr/local
    5    -1 MANPREFIX = ${PREFIX}/man
    6    -1 DOCPREFIX = ${PREFIX}/share/doc/stagit
    7    -1 
    8    -1 # compiler and linker
    9    -1 #CC = cc
   10    -1 
   11    -1 GITINC = /usr/local/include
   12    -1 GITLIB = /usr/local/lib
   13    -1 
   14    -1 # includes and libs
   15    -1 INCS = -I${GITINC}
   16    -1 LIBS = -L${GITLIB} -lgit2
   17    -1 
   18    -1 # debug
   19    -1 #CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic ${INCS}
   20    -1 #LDFLAGS = ${LIBS}
   21    -1 
   22    -1 # optimized
   23    -1 CFLAGS = -O2 -std=c99 ${INCS}
   24    -1 LDFLAGS = -s ${LIBS}
   25    -1 
   26    -1 # optimized static
   27    -1 #CFLAGS = -static -O2 -std=c99 ${INCS}
   28    -1 #LDFLAGS = -static -s ${LIBS}
   29    -1 
   30    -1 CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}