makefiles: respect and use the CPPFLAGS variable (Thanks Kacper)
See also: http://stackoverflow.com/questions/2754966/cflags-vs-cppflags
This commit is contained in:
parent
f1190bef44
commit
93f906308d
10
Makefile
10
Makefile
@ -21,7 +21,7 @@ endif
|
|||||||
# Depend on the specific file (.c for each .o) and on all headers
|
# Depend on the specific file (.c for each .o) and on all headers
|
||||||
src/%.o: src/%.c ${HEADERS}
|
src/%.o: src/%.c ${HEADERS}
|
||||||
echo "CC $<"
|
echo "CC $<"
|
||||||
$(CC) $(CFLAGS) -DLOGLEVEL="((uint64_t)1 << $(shell awk '/$(shell basename $< .c)/ { print NR; exit 0; }' loglevels.tmp))" -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="((uint64_t)1 << $(shell awk '/$(shell basename $< .c)/ { print NR; exit 0; }' loglevels.tmp))" -c -o $@ $<
|
||||||
|
|
||||||
all: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES}
|
all: src/cfgparse.y.o src/cfgparse.yy.o src/cmdparse.y.o src/cmdparse.yy.o ${FILES}
|
||||||
echo "LINK i3"
|
echo "LINK i3"
|
||||||
@ -42,23 +42,23 @@ loglevels.h:
|
|||||||
src/cfgparse.yy.o: src/cfgparse.l src/cfgparse.y.o ${HEADERS}
|
src/cfgparse.yy.o: src/cfgparse.l src/cfgparse.y.o ${HEADERS}
|
||||||
echo "LEX $<"
|
echo "LEX $<"
|
||||||
flex -i -o$(@:.o=.c) $<
|
flex -i -o$(@:.o=.c) $<
|
||||||
$(CC) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cfgparse.l/ { print NR }' loglevels.tmp))" -c -o $@ $(@:.o=.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cfgparse.l/ { print NR }' loglevels.tmp))" -c -o $@ $(@:.o=.c)
|
||||||
|
|
||||||
src/cmdparse.yy.o: src/cmdparse.l src/cmdparse.y.o ${HEADERS}
|
src/cmdparse.yy.o: src/cmdparse.l src/cmdparse.y.o ${HEADERS}
|
||||||
echo "LEX $<"
|
echo "LEX $<"
|
||||||
flex -Pcmdyy -i -o$(@:.o=.c) $<
|
flex -Pcmdyy -i -o$(@:.o=.c) $<
|
||||||
$(CC) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cmdparse.l/ { print NR }' loglevels.tmp))" -c -o $@ $(@:.o=.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cmdparse.l/ { print NR }' loglevels.tmp))" -c -o $@ $(@:.o=.c)
|
||||||
|
|
||||||
|
|
||||||
src/cfgparse.y.o: src/cfgparse.y ${HEADERS}
|
src/cfgparse.y.o: src/cfgparse.y ${HEADERS}
|
||||||
echo "YACC $<"
|
echo "YACC $<"
|
||||||
bison --debug --verbose -b $(basename $< .y) -d $<
|
bison --debug --verbose -b $(basename $< .y) -d $<
|
||||||
$(CC) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cfgparse.y/ { print NR }' loglevels.tmp))" -c -o $@ $(<:.y=.tab.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cfgparse.y/ { print NR }' loglevels.tmp))" -c -o $@ $(<:.y=.tab.c)
|
||||||
|
|
||||||
src/cmdparse.y.o: src/cmdparse.y ${HEADERS}
|
src/cmdparse.y.o: src/cmdparse.y ${HEADERS}
|
||||||
echo "YACC $<"
|
echo "YACC $<"
|
||||||
bison -p cmdyy --debug --verbose -b $(basename $< .y) -d $<
|
bison -p cmdyy --debug --verbose -b $(basename $< .y) -d $<
|
||||||
$(CC) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cmdparse.y/ { print NR }' loglevels.tmp))" -c -o $@ $(<:.y=.tab.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DLOGLEVEL="(1 << $(shell awk '/cmdparse.y/ { print NR }' loglevels.tmp))" -c -o $@ $(<:.y=.tab.c)
|
||||||
|
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
10
common.mk
10
common.mk
@ -31,7 +31,7 @@ CFLAGS += -Wunused-value
|
|||||||
CFLAGS += -Iinclude
|
CFLAGS += -Iinclude
|
||||||
CFLAGS += $(call cflags_for_lib, xcb-keysyms)
|
CFLAGS += $(call cflags_for_lib, xcb-keysyms)
|
||||||
ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
|
ifeq ($(shell pkg-config --exists xcb-util || echo 1),1)
|
||||||
CFLAGS += -DXCB_COMPAT
|
CPPFLAGS += -DXCB_COMPAT
|
||||||
CFLAGS += $(call cflags_for_lib, xcb-atom)
|
CFLAGS += $(call cflags_for_lib, xcb-atom)
|
||||||
CFLAGS += $(call cflags_for_lib, xcb-aux)
|
CFLAGS += $(call cflags_for_lib, xcb-aux)
|
||||||
else
|
else
|
||||||
@ -45,9 +45,9 @@ CFLAGS += $(call cflags_for_lib, xcursor)
|
|||||||
CFLAGS += $(call cflags_for_lib, x11)
|
CFLAGS += $(call cflags_for_lib, x11)
|
||||||
CFLAGS += $(call cflags_for_lib, yajl)
|
CFLAGS += $(call cflags_for_lib, yajl)
|
||||||
CFLAGS += $(call cflags_for_lib, libev)
|
CFLAGS += $(call cflags_for_lib, libev)
|
||||||
CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
|
CPPFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
|
||||||
CFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
|
CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
|
||||||
CFLAGS += -DTERM_EMU=\"$(TERM_EMU)\"
|
CPPFLAGS += -DTERM_EMU=\"$(TERM_EMU)\"
|
||||||
|
|
||||||
LDFLAGS += -lm
|
LDFLAGS += -lm
|
||||||
LDFLAGS += $(call ldflags_for_lib, xcb-event, xcb-event)
|
LDFLAGS += $(call ldflags_for_lib, xcb-event, xcb-event)
|
||||||
@ -88,7 +88,7 @@ endif
|
|||||||
CFLAGS += -idirafter yajl-fallback
|
CFLAGS += -idirafter yajl-fallback
|
||||||
|
|
||||||
ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
|
ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
|
||||||
CFLAGS += -D_GNU_SOURCE
|
CPPFLAGS += -D_GNU_SOURCE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
|
@ -11,7 +11,7 @@ HEADERS:=$(wildcard *.h)
|
|||||||
# Depend on the specific file (.c for each .o) and on all headers
|
# Depend on the specific file (.c for each .o) and on all headers
|
||||||
%.o: %.c ${HEADERS}
|
%.o: %.c ${HEADERS}
|
||||||
echo "CC $<"
|
echo "CC $<"
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
all: cfgparse.y.o cfgparse.yy.o ${FILES}
|
all: cfgparse.y.o cfgparse.yy.o ${FILES}
|
||||||
echo "LINK i3-config-wizard"
|
echo "LINK i3-config-wizard"
|
||||||
@ -20,12 +20,12 @@ all: cfgparse.y.o cfgparse.yy.o ${FILES}
|
|||||||
cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS}
|
cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS}
|
||||||
echo "LEX $<"
|
echo "LEX $<"
|
||||||
flex -i -o$(@:.o=.c) $<
|
flex -i -o$(@:.o=.c) $<
|
||||||
$(CC) $(CFLAGS) -c -o $@ $(@:.o=.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(@:.o=.c)
|
||||||
|
|
||||||
cfgparse.y.o: cfgparse.y ${HEADERS}
|
cfgparse.y.o: cfgparse.y ${HEADERS}
|
||||||
echo "YACC $<"
|
echo "YACC $<"
|
||||||
bison --debug --verbose -b $(basename $< .y) -d $<
|
bison --debug --verbose -b $(basename $< .y) -d $<
|
||||||
$(CC) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)
|
||||||
|
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
@ -10,7 +10,7 @@ HEADERS=$(wildcard *.h)
|
|||||||
# Depend on the specific file (.c for each .o) and on all headers
|
# Depend on the specific file (.c for each .o) and on all headers
|
||||||
%.o: %.c ${HEADERS}
|
%.o: %.c ${HEADERS}
|
||||||
echo "CC $<"
|
echo "CC $<"
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
all: ${FILES}
|
all: ${FILES}
|
||||||
echo "LINK i3-input"
|
echo "LINK i3-input"
|
||||||
|
@ -12,7 +12,7 @@ HEADERS=$(wildcard *.h)
|
|||||||
# Depend on the specific file (.c for each .o) and on all headers
|
# Depend on the specific file (.c for each .o) and on all headers
|
||||||
%.o: %.c ${HEADERS}
|
%.o: %.c ${HEADERS}
|
||||||
echo "CC $<"
|
echo "CC $<"
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
all: ${FILES}
|
all: ${FILES}
|
||||||
echo "LINK i3-msg"
|
echo "LINK i3-msg"
|
||||||
|
@ -10,7 +10,7 @@ HEADERS=$(wildcard *.h)
|
|||||||
# Depend on the specific file (.c for each .o) and on all headers
|
# Depend on the specific file (.c for each .o) and on all headers
|
||||||
%.o: %.c ${HEADERS}
|
%.o: %.c ${HEADERS}
|
||||||
echo "CC $<"
|
echo "CC $<"
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
all: ${FILES}
|
all: ${FILES}
|
||||||
echo "LINK i3-nagbar"
|
echo "LINK i3-nagbar"
|
||||||
|
Loading…
Reference in New Issue
Block a user