Skip to content

Commit

Permalink
build: move $CFLAGS_DEBUG into config.mk
Browse files Browse the repository at this point in the history
This allows inclusion in other Makefiles (e.g. for C unit tests).
  • Loading branch information
martanne committed Dec 15, 2016
1 parent f2ea65a commit 518b400
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ CFLAGS_VIS += -DCONFIG_LUA=${CONFIG_LUA}
CFLAGS_VIS += -DCONFIG_LPEG=${CONFIG_LPEG}
CFLAGS_VIS += -DCONFIG_SELINUX=${CONFIG_SELINUX}
CFLAGS_VIS += -DCONFIG_ACL=${CONFIG_ACL}
CFLAGS_VIS += ${CFLAGS_DEBUG}

LDFLAGS_VIS = $(LDFLAGS_AUTO) $(LDFLAGS_TERMKEY) $(LDFLAGS_CURSES) $(LDFLAGS_ACL) \
$(LDFLAGS_SELINUX) $(LDFLAGS_LUA) $(LDFLAGS_LPEG) $(LDFLAGS_STD)

CFLAGS_DEBUG_ENABLE = -U_FORTIFY_SOURCE -UNDEBUG -O0 -g -ggdb -Wall -Wextra -pedantic \
-Wno-missing-field-initializers -Wno-unused-parameter

STRIP?=strip

all: vis vis-menu
Expand All @@ -51,19 +47,19 @@ config.mk:
@touch $@

vis: config.h config.mk *.c *.h
${CC} ${CFLAGS} ${CFLAGS_VIS} ${SRC} ${LDFLAGS} ${LDFLAGS_VIS} -o $@
${CC} ${CFLAGS} ${CFLAGS_VIS} ${CFLAGS_EXTRA} ${SRC} ${LDFLAGS} ${LDFLAGS_VIS} -o $@

vis-menu: vis-menu.c
${CC} ${CFLAGS} ${CFLAGS_STD} ${CFLAGS_AUTO} ${CFLAGS_DEBUG} $< ${LDFLAGS} ${LDFLAGS_STD} ${LDFLAGS_AUTO} -o $@
${CC} ${CFLAGS} ${CFLAGS_AUTO} ${CFLAGS_STD} ${CFLAGS_EXTRA} $< ${LDFLAGS} ${LDFLAGS_STD} ${LDFLAGS_AUTO} -o $@

debug: clean
@$(MAKE) CFLAGS_DEBUG='${CFLAGS_DEBUG_ENABLE}'
@$(MAKE) CFLAGS_EXTRA='${CFLAGS_DEBUG}'

profile: clean
@$(MAKE) CFLAGS_DEBUG='${CFLAGS_DEBUG_ENABLE} -pg'
@$(MAKE) CFLAGS_EXTRA='${CFLAGS_DEBUG} -pg'

coverage: clean
@$(MAKE) CFLAGS_DEBUG='--coverage'
@$(MAKE) CFLAGS_EXTRA='--coverage'

test-update:
git submodule init
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ CFLAGS_STD = $CFLAGS_STD
LDFLAGS_STD = $LDFLAGS_STD
CFLAGS_AUTO = $CFLAGS_AUTO
LDFLAGS_AUTO = $LDFLAGS_AUTO
CFLAGS_DEBUG = -U_FORTIFY_SOURCE -UNDEBUG -O0 -g -ggdb -Wall -Wextra -pedantic -Wno-missing-field-initializers -Wno-unused-parameter
EOF
exec 1>&3 3>&-

Expand Down

0 comments on commit 518b400

Please sign in to comment.