[ioquake3] 03/59: Make using Yacc optional, disabled by default
Simon McVittie
smcv at debian.org
Wed Sep 21 19:56:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit 0ad4381a1185ed9ee964fbb8807eff66e8fe495d
Author: Zack Middleton <zturtleman at gmail.com>
Date: Wed Jun 15 12:17:58 2016 -0500
Make using Yacc optional, disabled by default
A built-in GNU Make rule causes code/tools/lcc/lburg/gram.y to replace
gram.c if gram.y has a newer modified time. This causes git diff to
pick up changes to gram.c, which seems to have been manually modified
to fix warnings and may vary by Yacc used to create it. It also
requires installing a program to generate a file that already exists
in a usable state in the code repository.
So replace the built-in rule so it is only used if USE_YACC is 1
(defaults to 0). The Yacc executable name can be overriden using
`make YACC=yacc` like before.
I preferred to touch gram.c instead of installing Yacc because of the
problems it causes. It doesn't really seem like a good idea to recommend
others do that instead of disabling Yacc the Makefile though.
---
Makefile | 20 ++++++++++++++++++++
README.md | 1 +
2 files changed, 21 insertions(+)
diff --git a/Makefile b/Makefile
index 1203517..fb7efd0 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 a5dacc9..3e004ad 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'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list