# Depend on the specific file (.c for each .o) and on all headers
src/%.o: src/%.c ${HEADERS}
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}
echo "LINK i3"
src/cfgparse.yy.o: src/cfgparse.l src/cfgparse.y.o ${HEADERS}
echo "LEX $<"
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}
echo "LEX $<"
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}
echo "YACC $<"
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}
echo "YACC $<"
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
CFLAGS += -Iinclude
CFLAGS += $(call cflags_for_lib, xcb-keysyms)
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-aux)
else
CFLAGS += $(call cflags_for_lib, x11)
CFLAGS += $(call cflags_for_lib, yajl)
CFLAGS += $(call cflags_for_lib, libev)
-CFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
-CFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
-CFLAGS += -DTERM_EMU=\"$(TERM_EMU)\"
+CPPFLAGS += -DI3_VERSION=\"${GIT_VERSION}\"
+CPPFLAGS += -DSYSCONFDIR=\"${SYSCONFDIR}\"
+CPPFLAGS += -DTERM_EMU=\"$(TERM_EMU)\"
LDFLAGS += -lm
LDFLAGS += $(call ldflags_for_lib, xcb-event, xcb-event)
CFLAGS += -idirafter yajl-fallback
ifneq (,$(filter Linux GNU GNU/%, $(UNAME)))
-CFLAGS += -D_GNU_SOURCE
+CPPFLAGS += -D_GNU_SOURCE
endif
ifeq ($(DEBUG),1)
# Depend on the specific file (.c for each .o) and on all headers
%.o: %.c ${HEADERS}
echo "CC $<"
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
all: cfgparse.y.o cfgparse.yy.o ${FILES}
echo "LINK i3-config-wizard"
cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS}
echo "LEX $<"
flex -i -o$(@:.o=.c) $<
- $(CC) $(CFLAGS) -c -o $@ $(@:.o=.c)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(@:.o=.c)
cfgparse.y.o: cfgparse.y ${HEADERS}
echo "YACC $<"
bison --debug --verbose -b $(basename $< .y) -d $<
- $(CC) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)
install: all
# Depend on the specific file (.c for each .o) and on all headers
%.o: %.c ${HEADERS}
echo "CC $<"
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
all: ${FILES}
echo "LINK i3-input"
# Depend on the specific file (.c for each .o) and on all headers
%.o: %.c ${HEADERS}
echo "CC $<"
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
all: ${FILES}
echo "LINK i3-msg"
# Depend on the specific file (.c for each .o) and on all headers
%.o: %.c ${HEADERS}
echo "CC $<"
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
all: ${FILES}
echo "LINK i3-nagbar"