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.
This commit is contained in:
parent
d6937c195f
commit
adaff713dc
2 changed files with 20 additions and 37 deletions
27
Makefile
27
Makefile
|
@ -1,8 +1,21 @@
|
|||
include config.mk
|
||||
.POSIX:
|
||||
|
||||
NAME = stagit
|
||||
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.c\
|
||||
stagit-index.c
|
||||
|
@ -31,16 +44,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 favicon.png logo.png style.css \
|
||||
Makefile favicon.png logo.png style.css \
|
||||
example_create.sh example_post-receive.sh \
|
||||
${NAME}-${VERSION}
|
||||
# make tarball
|
||||
|
@ -48,13 +61,13 @@ dist:
|
|||
gzip -c > ${NAME}-${VERSION}.tar.gz
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
|
||||
${OBJ}: config.mk ${HDR}
|
||||
${OBJ}: ${HDR}
|
||||
|
||||
stagit: stagit.o ${COMPATOBJ}
|
||||
${CC} -o $@ stagit.o ${COMPATOBJ} ${LDFLAGS}
|
||||
${CC} -o $@ stagit.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
|
||||
|
||||
stagit-index: stagit-index.o ${COMPATOBJ}
|
||||
${CC} -o $@ stagit-index.o ${COMPATOBJ} ${LDFLAGS}
|
||||
${CC} -o $@ stagit-index.o ${COMPATOBJ} ${STAGIT_LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f ${BIN} ${OBJ} ${NAME}-${VERSION}.tar.gz
|
||||
|
|
30
config.mk
30
config.mk
|
@ -1,30 +0,0 @@
|
|||
# customize below to fit your system
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
MANPREFIX = ${PREFIX}/man
|
||||
DOCPREFIX = ${PREFIX}/share/doc/stagit
|
||||
|
||||
# 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}
|
Loading…
Reference in a new issue