Don't modify user vars because they will get passed down (modified) to

sub-makes and recursively append causing huge command lines and incorrect
compilation results.

Also, fix the printvars target to align its output and ensure that the
contents of variables can't get interpreted by the shell.

llvm-svn: 17348
This commit is contained in:
Reid Spencer 2004-10-29 22:14:56 +00:00
parent b87e08e0ef
commit bd44bbdc0e
1 changed files with 47 additions and 42 deletions

View File

@ -144,25 +144,29 @@ install-local:: all-local
ifdef ENABLE_PROFILING ifdef ENABLE_PROFILING
CONFIGURATION := Profile CONFIGURATION := Profile
CXXFLAGS += -O3 -DNDEBUG -felide-constructors -finline-functions -pg LLVMCXXFLAGS := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
CFLAGS += -O3 -DNDEBUG -pg LLVMCFLAGS := -O3 -DNDEBUG -pg
LDFLAGS += -O3 -DNDEBUG -pg LLVMLDFLAGS := -O3 -DNDEBUG -pg
else else
ifdef ENABLE_OPTIMIZED ifdef ENABLE_OPTIMIZED
CONFIGURATION := Release CONFIGURATION := Release
CXXFLAGS += -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer LLVMCXXFLAGS := -O3 -DNDEBUG -finline-functions -felide-constructors -fomit-frame-pointer
CFLAGS += -O3 -DNDEBUG -fomit-frame-pointer LLVMCFLAGS := -O3 -DNDEBUG -fomit-frame-pointer
LDFLAGS += -O3 -DNDEBUG LLVMLDFLAGS := -O3 -DNDEBUG
else else
CONFIGURATION := Debug CONFIGURATION := Debug
CXXFLAGS += -g -D_DEBUG LLVMCXXFLAGS := -g -D_DEBUG
CFLAGS += -g -D_DEBUG LLVMCFLAGS := -g -D_DEBUG
LDFLAGS += -g -D_DEBUG LLVMLDFLAGS := -g -D_DEBUG
KEEP_SYMBOLS := 1 KEEP_SYMBOLS := 1
endif endif
endif endif
ARFLAGS := cru LLVMCXXFLAGS += $(CXXFLAGS)
LLVMCFLAGS += $(CFLAGS)
LLVMCPPFLAGS += $(CPPFLAGS)
LLVMLDFLAGS += $(LDFLAGS)
LLVMARFLAGS := cru
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Directory locations # Directory locations
@ -195,7 +199,7 @@ LLVMGCCLIBDIR := $(dir $(shell $(LLVMGCC) -print-file-name=libgcc.a))/
ifndef SHARED_LIBRARY ifndef SHARED_LIBRARY
LIBTOOL += --tag=disable-shared LIBTOOL += --tag=disable-shared
else else
LDFLAGS += -rpath $(LIBDIR) LLVMLDFLAGS += -rpath $(LIBDIR)
endif endif
# Adjust settings for verbose mode # Adjust settings for verbose mode
@ -216,7 +220,7 @@ endif
# Adjust linker flags for building an executable # Adjust linker flags for building an executable
ifdef TOOLNAME ifdef TOOLNAME
LDFLAGS += -rpath $(TOOLDIR) -export-dynamic LLVMLDFLAGS += -rpath $(TOOLDIR) -export-dynamic
endif endif
#---------------------------------------------------------- #----------------------------------------------------------
@ -225,8 +229,8 @@ endif
CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused
LDFLAGS += -L$(LIBDIR) -L$(LLVMLIBDIR) LLVMLDFLAGS += -L$(LIBDIR) -L$(LLVMLIBDIR)
CPPFLAGS += -I$(BUILD_OBJ_DIR) \ LLVMCPPFLAGS += -I$(BUILD_OBJ_DIR) \
-I$(BUILD_SRC_DIR) \ -I$(BUILD_SRC_DIR) \
-I$(BUILD_SRC_ROOT)/include \ -I$(BUILD_SRC_ROOT)/include \
-I$(BUILD_OBJ_ROOT)/include \ -I$(BUILD_OBJ_ROOT)/include \
@ -234,20 +238,20 @@ CPPFLAGS += -I$(BUILD_OBJ_DIR) \
-I$(LLVM_SRC_ROOT)/include \ -I$(LLVM_SRC_ROOT)/include \
-D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
Compile.C = $(CC) $(CPPFLAGS) $(CompileCommonOpts) -c $(CFLAGS) Compile.C = $(CC) $(LLVMCPPFLAGS) $(CompileCommonOpts) -c $(LLVMCFLAGS)
Compile.CXX = $(CXX) $(CPPFLAGS) $(CompileCommonOpts) $(CXXFLAGS) -c
LTCompile.C = $(LIBTOOL) --mode=compile $(Compile.C) LTCompile.C = $(LIBTOOL) --mode=compile $(Compile.C)
BCCompile.C = $(LLVMGCC) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCFLAGS) -c
Compile.CXX = $(CXX) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCXXFLAGS) -c
LTCompile.CXX = $(LIBTOOL) --tag=CXX --mode=compile $(Compile.CXX) LTCompile.CXX = $(LIBTOOL) --tag=CXX --mode=compile $(Compile.CXX)
BCCompile.CXX = $(LLVMGXX) $(CPPFLAGS) $(CompileCommonOpts) $(CXXFLAGS) -c BCCompile.CXX = $(LLVMGXX) $(LLVMCPPFLAGS) $(CompileCommonOpts) $(LLVMCXXFLAGS) -c
BCCompile.C = $(LLVMGCC) $(CPPFLAGS) $(CompileCommonOpts) $(CFLAGS) -c Link = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LLVMCPPFLAGS) \
Link = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CPPFLAGS) \ $(CompileCommonOpts) $(LLVMLDFLAGS) $(STRIP)
$(CompileCommonOpts) $(LDFLAGS) $(STRIP) Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(LLVMCPPFLAGS) \
Relink = $(LIBTOOL) --tag=CXX --mode=link $(CXX) $(CPPFLAGS) \
$(CompileCommonOpts) $(CompileCommonOpts)
BCLinkLib = $(LLVMGCC) -shared -nostdlib BCLinkLib = $(LLVMGCC) -shared -nostdlib
Burg = $(BURG) -I $(BUILD_SRC_DIR) Burg = $(BURG) -I $(BUILD_SRC_DIR)
TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR) TableGen = $(TBLGEN) -I $(BUILD_SRC_DIR)
Archive = $(AR) $(ARFLAGS) Archive = $(AR) $(LLVMARFLAGS)
ifdef RANLIB ifdef RANLIB
Ranlib = $(RANLIB) Ranlib = $(RANLIB)
else else
@ -1064,24 +1068,25 @@ endif
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# Print out the directories used for building # Print out the directories used for building
printvars:: printvars::
@$(ECHO) "CONFIGURATION : " $(CONFIGURATION) @$(ECHO) "CONFIGURATION : " '$(CONFIGURATION)'
@$(ECHO) "BUILD_SRC_ROOT: " $(BUILD_SRC_ROOT) @$(ECHO) "BUILD_SRC_ROOT : " '$(BUILD_SRC_ROOT)'
@$(ECHO) "BUILD_SRC_DIR : " $(BUILD_SRC_DIR) @$(ECHO) "BUILD_SRC_DIR : " '$(BUILD_SRC_DIR)'
@$(ECHO) "BUILD_OBJ_ROOT: " $(BUILD_OBJ_ROOT) @$(ECHO) "BUILD_OBJ_ROOT : " '$(BUILD_OBJ_ROOT)'
@$(ECHO) "BUILD_OBJ_DIR : " $(BUILD_OBJ_DIR) @$(ECHO) "BUILD_OBJ_DIR : " '$(BUILD_OBJ_DIR)'
@$(ECHO) "LLVM_SRC_ROOT : " $(LLVM_SRC_ROOT) @$(ECHO) "LLVM_SRC_ROOT : " '$(LLVM_SRC_ROOT)'
@$(ECHO) "LLVM_OBJ_ROOT : " $(LLVM_OBJ_ROOT) @$(ECHO) "LLVM_OBJ_ROOT : " '$(LLVM_OBJ_ROOT)'
@$(ECHO) "libdir : " $(libdir) @$(ECHO) "libdir : " '$(libdir)'
@$(ECHO) "bindir : " $(bindir) @$(ECHO) "bindir : " '$(bindir)'
@$(ECHO) "sysconfdir : " $(sysconfdir) @$(ECHO) "sysconfdir : " '$(sysconfdir)'
@$(ECHO) "bytecode_libdir : " $(bytecode_libdir) @$(ECHO) "bytecode_libdir: " '$(bytecode_libdir)'
@$(ECHO) "USER_TARGETS : " $(USER_TARGETS) @$(ECHO) "USER_TARGETS : " '$(USER_TARGETS)'
@$(ECHO) "OBJMKFILES: $(OBJMKFILES)" @$(ECHO) "OBJMKFILES : " '$(OBJMKFILES)'
@$(ECHO) "SRCMKFILES: $(SRCMKFILES)" @$(ECHO) "SRCMKFILES : " '$(SRCMKFILES)'
@$(ECHO) "OBJDIR: " $(OBJDIR) @$(ECHO) "OBJDIR : " '$(OBJDIR)'
@$(ECHO) "LIBDIR: " $(LIBDIR) @$(ECHO) "LIBDIR : " '$(LIBDIR)'
@$(ECHO) "TOOLDIR: " $(TOOLDIR) @$(ECHO) "TOOLDIR : " '$(TOOLDIR)'
@$(ECHO) "TDFILES:" '$(TDFILES)' @$(ECHO) "TDFILES : " '$(TDFILES)'
@$(ECHO) "Compile.CXX: " '$(Compile.CXX)' @$(ECHO) "Compile.CXX : " '$(Compile.CXX)'
@$(ECHO) "Compile.C: " '$(Compile.C)' @$(ECHO) "Compile.C : " '$(Compile.C)'
@$(ECHO) "Archive : " '$(Archive)'