mirror of https://github.com/python/cpython
Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor
directives, which is the role of CPPFLAGS. Closes SF patch #414991.
This commit is contained in:
parent
f4b33f61fb
commit
89e90d67aa
|
@ -15,7 +15,8 @@ VERSION= 2.1
|
||||||
# Compiler flags
|
# Compiler flags
|
||||||
OPT= -g
|
OPT= -g
|
||||||
INCLUDES= -I$(srcdir)/Include -I$(blddir)
|
INCLUDES= -I$(srcdir)/Include -I$(blddir)
|
||||||
CFLAGS= $(OPT) $(INCLUDES)
|
CFLAGS= $(OPT)
|
||||||
|
CPPFLAGS= $(INCLUDES)
|
||||||
|
|
||||||
# The Python library
|
# The Python library
|
||||||
LIBPYTHON= $(blddir)/libpython$(VERSION).a
|
LIBPYTHON= $(blddir)/libpython$(VERSION).a
|
||||||
|
|
|
@ -31,7 +31,8 @@ RLLIBS=-lreadline -ltermcap
|
||||||
OTHERLIBS=-lnsl -lpthread -ldl -lm -ldb -lutil
|
OTHERLIBS=-lnsl -lpthread -ldl -lm -ldb -lutil
|
||||||
|
|
||||||
# Compilation and link flags -- no need to change normally
|
# Compilation and link flags -- no need to change normally
|
||||||
CFLAGS=$(PYINCL) $(OPT)
|
CFLAGS=$(OPT)
|
||||||
|
CPPFLAGS=$(PYINCL)
|
||||||
LIBS=$(PYLIBS) $(RLLIBS) $(OTHERLIBS)
|
LIBS=$(PYLIBS) $(RLLIBS) $(OTHERLIBS)
|
||||||
|
|
||||||
# Default port for the pysvr application
|
# Default port for the pysvr application
|
||||||
|
|
|
@ -55,7 +55,8 @@ MAKESETUP= $(srcdir)/Modules/makesetup
|
||||||
# Compiler options
|
# Compiler options
|
||||||
OPT= @OPT@
|
OPT= @OPT@
|
||||||
DEFS= @DEFS@
|
DEFS= @DEFS@
|
||||||
CFLAGS= $(OPT) -I. -I$(srcdir)/Include $(DEFS)
|
CFLAGS= $(OPT)
|
||||||
|
CPPFLAGS= -I. -I$(srcdir)/Include $(DEFS)
|
||||||
LDFLAGS= @LDFLAGS@
|
LDFLAGS= @LDFLAGS@
|
||||||
LDLAST= @LDLAST@
|
LDLAST= @LDLAST@
|
||||||
SGI_ABI= @SGI_ABI@
|
SGI_ABI= @SGI_ABI@
|
||||||
|
@ -64,7 +65,7 @@ LINKFORSHARED= @LINKFORSHARED@
|
||||||
# Extra C flags added for building the interpreter object files.
|
# Extra C flags added for building the interpreter object files.
|
||||||
CFLAGSFORSHARED=@CFLAGSFORSHARED@
|
CFLAGSFORSHARED=@CFLAGSFORSHARED@
|
||||||
# C flags used for building the interpreter object files
|
# C flags used for building the interpreter object files
|
||||||
PY_CFLAGS= $(CFLAGS) $(CFLAGSFORSHARED)
|
PY_CFLAGS= $(CFLAGS) $(CPPFLAGS) $(CFLAGSFORSHARED)
|
||||||
|
|
||||||
|
|
||||||
# Machine-dependent subdirectories
|
# Machine-dependent subdirectories
|
||||||
|
@ -283,7 +284,8 @@ platform: $(PYTHON)
|
||||||
|
|
||||||
# Build the shared modules
|
# Build the shared modules
|
||||||
sharedmods: $(PYTHON)
|
sharedmods: $(PYTHON)
|
||||||
PYTHONPATH= ./$(PYTHON) $(srcdir)/setup.py build
|
unset PYTHONPATH PYTHONHOME PYTHONSTARTUP; \
|
||||||
|
./$(PYTHON) $(srcdir)/setup.py build
|
||||||
|
|
||||||
# buildno should really depend on something like LIBRARY_SRC
|
# buildno should really depend on something like LIBRARY_SRC
|
||||||
buildno: $(PARSER_OBJS) \
|
buildno: $(PARSER_OBJS) \
|
||||||
|
@ -399,10 +401,10 @@ Parser/metagrammar.o: $(srcdir)/Parser/metagrammar.c
|
||||||
Python/compile.o Python/symtable.o: $(GRAMMAR_H)
|
Python/compile.o Python/symtable.o: $(GRAMMAR_H)
|
||||||
|
|
||||||
Python/getplatform.o: $(srcdir)/Python/getplatform.c
|
Python/getplatform.o: $(srcdir)/Python/getplatform.c
|
||||||
$(CC) -c $(CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
|
||||||
|
|
||||||
Python/importdl.o: $(srcdir)/Python/importdl.c
|
Python/importdl.o: $(srcdir)/Python/importdl.c
|
||||||
$(CC) -c $(CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
|
$(CC) -c $(CFLAGS) $(CPPFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
|
||||||
|
|
||||||
Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
|
Objects/object.o: $(srcdir)/Objects/object.c $(srcdir)/Objects/obmalloc.c
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,8 @@ TARGET= python
|
||||||
PYTHON= python
|
PYTHON= python
|
||||||
|
|
||||||
# Add more -I and -D options here
|
# Add more -I and -D options here
|
||||||
CFLAGS= $(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
|
CFLAGS= $(OPT)
|
||||||
|
CPPFLAGS= -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS)
|
||||||
|
|
||||||
# These two variables can be set in Setup to merge extensions.
|
# These two variables can be set in Setup to merge extensions.
|
||||||
# See example[23].
|
# See example[23].
|
||||||
|
@ -228,7 +229,7 @@ do-it-again:
|
||||||
|
|
||||||
# Make config.o from the config.c created by makesetup
|
# Make config.o from the config.c created by makesetup
|
||||||
config.o: config.c
|
config.o: config.c
|
||||||
$(CC) $(CFLAGS) -c config.c
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c config.c
|
||||||
|
|
||||||
# Setup is copied from Setup.in *only* if it doesn't yet exist
|
# Setup is copied from Setup.in *only* if it doesn't yet exist
|
||||||
Setup:
|
Setup:
|
||||||
|
|
|
@ -216,7 +216,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
|
||||||
*) src='$(srcdir)/'"$srcdir/$src";;
|
*) src='$(srcdir)/'"$srcdir/$src";;
|
||||||
esac
|
esac
|
||||||
case $doconfig in
|
case $doconfig in
|
||||||
no) cc="$cc \$(CCSHARED) \$(CFLAGS)";;
|
no) cc="$cc \$(CCSHARED) \$(CFLAGS) \$(CPPFLAGS)";;
|
||||||
*)
|
*)
|
||||||
cc="$cc \$(PY_CFLAGS)";;
|
cc="$cc \$(PY_CFLAGS)";;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -424,7 +424,8 @@ def main():
|
||||||
outfp.close()
|
outfp.close()
|
||||||
infp.close()
|
infp.close()
|
||||||
|
|
||||||
cflags = defines + includes + ['$(OPT)']
|
cflags = ['$(OPT)']
|
||||||
|
cppflags = defines + includes
|
||||||
libs = [os.path.join(binlib, 'libpython$(VERSION).a')]
|
libs = [os.path.join(binlib, 'libpython$(VERSION).a')]
|
||||||
|
|
||||||
somevars = {}
|
somevars = {}
|
||||||
|
@ -434,6 +435,7 @@ def main():
|
||||||
somevars[key] = makevars[key]
|
somevars[key] = makevars[key]
|
||||||
|
|
||||||
somevars['CFLAGS'] = string.join(cflags) # override
|
somevars['CFLAGS'] = string.join(cflags) # override
|
||||||
|
somevars['CPPFLAGS'] = string.join(cppflags) # override
|
||||||
files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \
|
files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \
|
||||||
files + supp_sources + addfiles + libs + \
|
files + supp_sources + addfiles + libs + \
|
||||||
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
|
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
|
||||||
|
|
|
@ -19,7 +19,7 @@ def makemakefile(outfp, makevars, files, target):
|
||||||
base = os.path.basename(file)
|
base = os.path.basename(file)
|
||||||
dest = base[:-2] + '.o'
|
dest = base[:-2] + '.o'
|
||||||
outfp.write("%s: %s\n" % (dest, file))
|
outfp.write("%s: %s\n" % (dest, file))
|
||||||
outfp.write("\t$(CC) $(CFLAGS) -c %s\n" % file)
|
outfp.write("\t$(CC) $(CFLAGS) $(CPPFLAGS) -c %s\n" % file)
|
||||||
files[i] = dest
|
files[i] = dest
|
||||||
deps.append(dest)
|
deps.append(dest)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue