Makefiles: introduce $(FLEX) and $(BISON)

This commit is contained in:
Michael Stapelberg 2011-11-22 00:01:01 +00:00
parent bf105e1d7d
commit acf29dbfd5
3 changed files with 8 additions and 6 deletions

View File

@ -55,23 +55,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 "[i3] LEX $<" echo "[i3] LEX $<"
flex -i -o$(@:.o=.c) $< $(FLEX) -i -o$(@:.o=.c) $<
$(CC) $(CPPFLAGS) $(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 "[i3] LEX $<" echo "[i3] LEX $<"
flex -Pcmdyy -i -o$(@:.o=.c) $< $(FLEX) -Pcmdyy -i -o$(@:.o=.c) $<
$(CC) $(CPPFLAGS) $(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 "[i3] YACC $<" echo "[i3] YACC $<"
bison --debug --verbose -b $(basename $< .y) -d $< $(BISON) --debug --verbose -b $(basename $< .y) -d $<
$(CC) $(CPPFLAGS) $(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 "[i3] YACC $<" echo "[i3] YACC $<"
bison -p cmdyy --debug --verbose -b $(basename $< .y) -d $< $(BISON) -p cmdyy --debug --verbose -b $(basename $< .y) -d $<
$(CC) $(CPPFLAGS) $(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)

View File

@ -2,6 +2,8 @@ UNAME=$(shell uname)
DEBUG=1 DEBUG=1
COVERAGE=0 COVERAGE=0
INSTALL=install INSTALL=install
FLEX=flex
BISON=bison
ifndef PREFIX ifndef PREFIX
PREFIX=/usr PREFIX=/usr
endif endif

View File

@ -26,12 +26,12 @@ $(TOPDIR)/libi3/%.a: $(TOPDIR)/libi3/*.c
cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS} cfgparse.yy.o: cfgparse.l cfgparse.y.o ${HEADERS}
echo "[i3-config-wizard] LEX $<" echo "[i3-config-wizard] LEX $<"
flex -i -o$(@:.o=.c) $< $(FLEX) -i -o$(@:.o=.c) $<
$(CC) $(CPPFLAGS) $(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 "[i3-config-wizard] YACC $<" echo "[i3-config-wizard] YACC $<"
bison --debug --verbose -b $(basename $< .y) -d $< $(BISON) --debug --verbose -b $(basename $< .y) -d $<
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(<:.y=.tab.c) $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(<:.y=.tab.c)