diff --git a/Makefile b/Makefile index 12035172..fb7efd08 100644 --- a/Makefile +++ b/Makefile @@ -224,6 +224,10 @@ ifndef USE_RENDERER_DLOPEN USE_RENDERER_DLOPEN=1 endif +ifndef USE_YACC +USE_YACC=0 +endif + ifndef DEBUG_CFLAGS DEBUG_CFLAGS=-ggdb -O0 endif @@ -1351,6 +1355,10 @@ ifndef TOOLS_CC TOOLS_CC = gcc endif +ifndef YACC + YACC = yacc +endif + TOOLS_OPTIMIZE = -g -Wall -fno-strict-aliasing TOOLS_CFLAGS += $(TOOLS_OPTIMIZE) \ -DTEMPDIR=\"$(TEMPDIR)\" -DSYSTEM=\"\" \ @@ -1363,6 +1371,12 @@ ifeq ($(GENERATE_DEPENDENCIES),1) TOOLS_CFLAGS += -MMD endif +define DO_YACC +$(echo_cmd) "YACC $<" +$(Q)$(YACC) $< +$(Q)mv -f y.tab.c $@ +endef + define DO_TOOLS_CC $(echo_cmd) "TOOLS_CC $<" $(Q)$(TOOLS_CC) $(TOOLS_CFLAGS) -o $@ -c $< @@ -1384,6 +1398,12 @@ LBURGOBJ= \ $(B)/tools/lburg/lburg.o \ $(B)/tools/lburg/gram.o +# override GNU Make built-in rule for converting gram.y to gram.c +%.c: %.y +ifeq ($(USE_YACC),1) + $(DO_YACC) +endif + $(B)/tools/lburg/%.o: $(LBURGDIR)/%.c $(DO_TOOLS_CC) diff --git a/README.md b/README.md index a5dacc9c..3e004ad8 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ Makefile.local: SERVERBIN - rename 'ioq3ded' server binary CLIENTBIN - rename 'ioquake3' client binary USE_RENDERER_DLOPEN - build and use the renderer in a library + USE_YACC - use yacc to update code/tools/lcc/lburg/gram.c BASEGAME - rename 'baseq3' BASEGAME_CFLAGS - custom CFLAGS for basegame MISSIONPACK - rename 'missionpack'