Do not expand config.mk variables on assignment

Fix a bug introduced in 678ea70 where since the CFLAGS variable was
simply expanded it ignored the VERSION variable which was initialized
later.

Unfortunately there is no way to prepend a value to a recursively
expanded variable so instead we have to split the hardcoded compiler
flags into separate variables and combine them all later in the
makefile.

Fixes #500
This commit is contained in:
Nikos Tsipinakis 2018-03-11 16:19:24 +02:00
parent 4c5c124e1e
commit 943b8c6785
2 changed files with 6 additions and 6 deletions

View File

@ -42,8 +42,8 @@ $(error "$(PKG_CONFIG) failed!")
endif endif
endif endif
CFLAGS += -I. ${INCS} CFLAGS := ${DEFAULT_CPPFLAGS} ${CPPFLAGS} ${DEFAULT_CFLAGS} ${CFLAGS} -I. ${INCS}
LDFLAGS+= -L. ${LIBS} LDFLAGS := ${DEFAULT_LDFLAGS} ${LDFLAGS} -L. ${LIBS}
SRC := $(sort $(shell find src/ -name '*.c')) SRC := $(sort $(shell find src/ -name '*.c'))
OBJ := ${SRC:.c=.o} OBJ := ${SRC:.c=.o}
@ -53,7 +53,7 @@ TEST_OBJ := $(TEST_SRC:.c=.o)
.PHONY: all debug .PHONY: all debug
all: doc dunst service all: doc dunst service
debug: CFLAGS += ${CFLAGS_DEBUG} debug: CFLAGS += ${CPPFLAGS_DEBUG} ${CFLAGS_DEBUG}
debug: LDFLAGS += ${LDFLAGS_DEBUG} debug: LDFLAGS += ${LDFLAGS_DEBUG}
debug: CPPFLAGS += ${CPPFLAGS_DEBUG} debug: CPPFLAGS += ${CPPFLAGS_DEBUG}
debug: all debug: all

View File

@ -13,9 +13,9 @@ PKG_CONFIG ?= pkg-config
#STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior #STATIC= -DSTATIC_CONFIG # Warning: This is deprecated behavior
# flags # flags
CPPFLAGS += -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\" DEFAULT_CPPFLAGS = -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
CFLAGS := -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC} ${CPPFLAGS} ${CFLAGS} DEFAULT_CFLAGS = -g --std=gnu99 -pedantic -Wall -Wno-overlength-strings -Os ${STATIC}
LDFLAGS := -lm ${LDFLAGS} DEFAULT_LDFLAGS = -lm
CPPFLAGS_DEBUG := -DDEBUG_BUILD CPPFLAGS_DEBUG := -DDEBUG_BUILD
CFLAGS_DEBUG := -O0 CFLAGS_DEBUG := -O0