Makefile: separate CPPFLAGS, compile optimized build by default

This commit is contained in:
Hiltjo Posthuma 2016-03-20 16:23:33 +01:00
parent 761417d254
commit cd6a519813
2 changed files with 11 additions and 10 deletions

View file

@ -1,7 +1,7 @@
include config.mk include config.mk
NAME = stagit NAME = stagit
VERSION = 0.3 VERSION = 0.3.1
SRC = \ SRC = \
stagit.c\ stagit.c\
stagit-index.c stagit-index.c
@ -30,8 +30,11 @@ OBJ = ${SRC:.c=.o} ${COMPATOBJ}
all: $(BIN) all: $(BIN)
.o:
${CC} ${LDFLAGS} -o $@ ${LIBS}
.c.o: .c.o:
${CC} -c ${CFLAGS} $< ${CC} -c ${CFLAGS} ${CPPFLAGS} -o $@ -c $<
dist: dist:
rm -rf stagit-${VERSION} rm -rf stagit-${VERSION}

View file

@ -12,19 +12,17 @@ INCS = -I${GITINC}
LIBS = -L${GITLIB} -lgit2 -lc LIBS = -L${GITLIB} -lgit2 -lc
# debug # debug
CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic \ #CFLAGS = -fstack-protector-all -O0 -g -std=c99 -Wall -Wextra -pedantic ${INCS}
-D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS} #LDFLAGS = ${LIBS}
LDFLAGS = ${LIBS}
# optimized # optimized
#CFLAGS = -O2 -std=c99 \ CFLAGS = -O2 -std=c99 ${INCS}
# -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS} LDFLAGS = -s ${LIBS}
#LDFLAGS = -s ${LIBS}
# optimized static # optimized static
#CFLAGS = -static -O2 -std=c99 \ #CFLAGS = -static -O2 -std=c99 ${INCS}
# -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
#LDFLAGS = -static -s ${LIBS} #LDFLAGS = -static -s ${LIBS}
CPPFLAGS= -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
# compiler and linker # compiler and linker
#CC = cc #CC = cc