From ffc9680653cfacd56cc884db9dafcf61fc08dcae Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 4 Jan 2012 13:17:57 +0900 Subject: [PATCH] Add an option to prevent the use of default paths. Despair has things locked down such that running qfcc during a build fails due to lack of read access to /usr/local/lib. This is actually a good thing as accidentally hitting old includes/libs (when a file gets deleted in the tree) hides bugs. Thus, --no-default-paths to turn off default search paths. --- ruamoko/cl_menu/Makefile.am | 2 +- ruamoko/game/Makefile.am | 2 +- ruamoko/gui/Makefile.am | 2 +- ruamoko/lib/Makefile.am | 2 +- ruamoko/scheme/Makefile.am | 2 +- tools/qfcc/doc/man/qfcc.1 | 3 +++ tools/qfcc/include/options.h | 1 + tools/qfcc/source/options.c | 11 +++++++++-- tools/qwaq/Makefile.am | 2 +- 9 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ruamoko/cl_menu/Makefile.am b/ruamoko/cl_menu/Makefile.am index be09a6ace..0a84ec944 100644 --- a/ruamoko/cl_menu/Makefile.am +++ b/ruamoko/cl_menu/Makefile.am @@ -5,7 +5,7 @@ pkgdatadir=@sharepath@/QF QFCC_DEP=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) QFCC=$(QFCC_DEP) -QCFLAGS=-qq -g -Wall -Werror -Wno-integer-divide +QCFLAGS=-qq -g -Wall -Werror -Wno-integer-divide --no-default-paths QCPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/ruamoko/include -I$(top_srcdir)/ruamoko/include -I$(top_builddir)/include -I$(top_srcdir)/include GZIP=if echo $@ | grep -q .gz; then gzip -f `basename $@ .gz`; if test -f `basename $@ .dat.gz`.sym; then gzip -f `basename $@ .dat.gz`.sym; fi; fi if HAVE_ZLIB diff --git a/ruamoko/game/Makefile.am b/ruamoko/game/Makefile.am index e955caa1c..1f3fece7b 100644 --- a/ruamoko/game/Makefile.am +++ b/ruamoko/game/Makefile.am @@ -7,7 +7,7 @@ pkgdatadir=@sharepath@/id1 QFCC_DEP=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) QFCC=$(QFCC_DEP) -QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide +QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide --no-default-paths QCPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/ruamoko/include -I$(top_srcdir)/ruamoko/include GZIP=if echo $@ | grep -q .gz; then gzip -f `basename $@ .gz`; if test -f `basename $@ .dat.gz`.sym; then gzip -f `basename $@ .dat.gz`.sym; fi; fi if HAVE_ZLIB diff --git a/ruamoko/gui/Makefile.am b/ruamoko/gui/Makefile.am index 2debef885..3848270e1 100644 --- a/ruamoko/gui/Makefile.am +++ b/ruamoko/gui/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS= foreign pkglibdir=$(libdir)/qfcc/lib QFCC=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) -QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide +QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide --no-default-paths QCPPFLAGS=$(INCLUDES) PAK=$(top_builddir)/tools/pak/pak$(EXEEXT) RANLIB=touch diff --git a/ruamoko/lib/Makefile.am b/ruamoko/lib/Makefile.am index 92ede7a79..ed21e5b57 100644 --- a/ruamoko/lib/Makefile.am +++ b/ruamoko/lib/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS= foreign pkglibdir=$(libdir)/qfcc/lib QFCC=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) -QCFLAGS=-qq -g -Wall -Wno-integer-divide -Werror +QCFLAGS=-qq -g -Wall -Wno-integer-divide -Werror --no-default-paths QCPPFLAGS=$(INCLUDES) PAK=$(top_builddir)/tools/pak/pak$(EXEEXT) RANLIB=touch diff --git a/ruamoko/scheme/Makefile.am b/ruamoko/scheme/Makefile.am index ad9f40894..258c741e5 100644 --- a/ruamoko/scheme/Makefile.am +++ b/ruamoko/scheme/Makefile.am @@ -4,7 +4,7 @@ pkglibdir=$(libdir)/qfcc/lib QFCC_DEP=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) QFCC=$(QFCC_DEP) -QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide +QCFLAGS=-qq -g -Werror -Wall -Wno-integer-divide --no-default-paths QCPPFLAGS=$(INCLUDES) PAK=$(top_builddir)/tools/pak/pak$(EXEEXT) GZIP=if echo $@ | grep -q .gz; then gzip -f `basename $@ .gz`; if test -f `basename $@ .dat.gz`.sym; then gzip -f `basename $@ .dat.gz`.sym; fi; fi diff --git a/tools/qfcc/doc/man/qfcc.1 b/tools/qfcc/doc/man/qfcc.1 index 0e24df0cc..fba7fab7f 100644 --- a/tools/qfcc/doc/man/qfcc.1 +++ b/tools/qfcc/doc/man/qfcc.1 @@ -101,6 +101,9 @@ object files built using the \fBpak\fP utility. Generate dependency info. Dependent on \*[cpp] version, so check \*[cpp]'s documentation. .TP +.B \-\-no\-default\-paths +Do not use default paths for include files or libraries. +.TP .B \-N, \-\-notice OPTION,... Set notice options. See \fBNOTICE OPTIONS\fP for details. diff --git a/tools/qfcc/include/options.h b/tools/qfcc/include/options.h index 96e249021..eb0714139 100644 --- a/tools/qfcc/include/options.h +++ b/tools/qfcc/include/options.h @@ -76,6 +76,7 @@ typedef struct { qboolean single_cpp; // process progs.src into a series of // #include directives and then compile // that + qboolean no_default_paths; // no default -I or -L qboolean save_temps; // save temporary files qboolean files_dat; // generate files.dat qboolean progdefs_h; // generate progdefs.h diff --git a/tools/qfcc/source/options.c b/tools/qfcc/source/options.c index c7cb912e9..8f55dceac 100644 --- a/tools/qfcc/source/options.c +++ b/tools/qfcc/source/options.c @@ -65,6 +65,7 @@ enum { OPT_ADVANCED, OPT_CPP, OPT_INCLUDE, + OPT_NO_DEFAULT_PATHS, OPT_PROGDEFS, OPT_QCCX_ESCAPES, OPT_TRADITIONAL, @@ -78,6 +79,7 @@ static struct option const long_options[] = { {"files", no_argument, 0, 'F'}, {"help", no_argument, 0, 'h'}, {"include", required_argument, 0, OPT_INCLUDE}, + {"no-default-paths", no_argument, 0, OPT_NO_DEFAULT_PATHS}, {"notice", required_argument, 0, 'N'}, {"output-file", required_argument, 0, 'o'}, {"progdefs", no_argument, 0, OPT_PROGDEFS}, @@ -537,6 +539,9 @@ DecodeArgs (int argc, char **argv) add_cpp_def (nva ("-M")); } break; + case OPT_NO_DEFAULT_PATHS: + options.no_default_paths = 1; + break; default: usage (1); } @@ -579,8 +584,10 @@ DecodeArgs (int argc, char **argv) add_cpp_def ("-D__VERSION6__=1"); // add the default paths - add_cpp_def (nva ("-I%s", QFCC_INCLUDE_PATH)); - linker_add_path (QFCC_LIB_PATH); + if (!options.no_default_paths) { + add_cpp_def (nva ("-I%s", QFCC_INCLUDE_PATH)); + linker_add_path (QFCC_LIB_PATH); + } if (options.verbosity >= 3) yydebug = 1; diff --git a/tools/qwaq/Makefile.am b/tools/qwaq/Makefile.am index edffc3302..b440ccab7 100644 --- a/tools/qwaq/Makefile.am +++ b/tools/qwaq/Makefile.am @@ -6,7 +6,7 @@ INCLUDES= -I$(top_srcdir)/include $(QWAQ_INCS) QFCC_DEP=$(top_builddir)/tools/qfcc/source/qfcc$(EXEEXT) QFCC=$(top_builddir)/tools/qfcc/source/qfcc -QCFLAGS=-qq -g -Werror --advanced +QCFLAGS=-qq -g -Werror --advanced --no-default-paths if BUILD_QWAQ qwaq=qwaq