X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Makefile.common;h=6d1698e2bab9c9969fa6350e65e9412add84b90c;hb=2c08dcc276e218193beffbddf2a30f4d88e8af58;hp=5151135a553661de4c9aea64065bb5193e36dcd0;hpb=41e7891e07443082e63d1b41ddc33188ca0afaae;p=oota-llvm.git diff --git a/Makefile.common b/Makefile.common index 5151135a553..6d1698e2bab 100644 --- a/Makefile.common +++ b/Makefile.common @@ -126,7 +126,7 @@ endif # Special tools used while building the LLVM tree. Burg is built as part of the # utils directory. # -BURG := $(LEVEL)/utils/Burg/burg +BURG := $(TOOLDEBUG)/burg RunBurg := $(BURG) $(BURG_OPTS) @@ -142,8 +142,10 @@ endif # By default, strip symbol information from executable ifdef KEEP_SYMBOLS STRIP = +WARN_MSG = else STRIP = -s +WARN_MSG = "(without symbols) " endif # Allow gnu extensions... @@ -152,12 +154,19 @@ CPPFLAGS += -D_GNU_SOURCE # -Wno-unused-parameter CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused -I$(LEVEL)/include -# Compile a file, don't link... +# Compile a cpp file, don't link... Compile := $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CompileCommonOpts) CompileG := $(Compile) -g -D_DEBUG CompileO := $(Compile) -O3 -DNDEBUG -finline-functions -felide-constructors -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug CompileP := $(CompileO) $(PROFILE) +# Compile a c file, don't link... +CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts) +CompileCG := $(CompileC) -g -D_DEBUG +CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug +CompileCP := $(CompileCO) $(PROFILE) + + # Link final executable ifdef ENABLE_PURIFY # To enable purify, build with 'gmake ENABLE_PURIFY=1' @@ -167,7 +176,7 @@ Link := $(CXX) endif LinkG := $(Link) -g -L $(LIBDEBUG) $(STRIP) LinkO := $(Link) -O3 -L $(LIBRELEASE) -LinkP := $(LinkO) $(PROFILE) +LinkP := $(Link) -O3 -L $(LIBPROFILE) $(PROFILE) # Create one .o file from a bunch of .o files... Relink = ld -r @@ -179,9 +188,11 @@ MakeSOP := $(MakeSOO) $(PROFILE) # Create dependancy file from CPP file, send to stdout. Depend := $(CXX) -MM -I$(LEVEL)/include $(CPPFLAGS) +DependC := $(CC) -MM -I$(LEVEL)/include $(CPPFLAGS) # Archive a bunch of .o files into a .a file... AR = ar cq +BISON = bison #---------------------------------------------------------- @@ -189,7 +200,9 @@ AR = ar cq # source files... # The local Makefile can list other Source files via ExtraSource = ... # +ifndef Source Source := $(ExtraSource) $(wildcard *.cpp *.c *.y *.l) +endif Objs := $(sort $(patsubst Debug/%.o, %.o, $(addsuffix .o,$(basename $(Source))))) ObjectsO := $(addprefix $(BUILD_ROOT)/Release/,$(Objs)) @@ -324,6 +337,7 @@ $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(LIBPROFILE)/.dir $(VERB) $(Relink) -o $@ $(ObjectsP) $(LibSubDirs) $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(LIBDEBUG)/.dir + @echo "Linking $@" $(VERB) $(Relink) -o $@ $(ObjectsG) $(LibSubDirs) endif @@ -358,9 +372,9 @@ ifndef ENABLE_OPTIMIZED TOOLEXENAMES := $(TOOLEXENAME_G) else ifdef ENABLE_PROFILING - TOOLEXENAMES := $(TOOLEXENAME_O) - else TOOLEXENAMES := $(TOOLEXENAME_P) + else + TOOLEXENAMES := $(TOOLEXENAME_O) endif endif @@ -379,22 +393,23 @@ STATICUSEDLIBS := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS))) USED_LIB_PATHS_G := $(addprefix $(LIBDEBUG)/, $(STATICUSEDLIBS)) USED_LIB_PATHS_O := $(addprefix $(LIBRELEASE)/, $(STATICUSEDLIBS)) USED_LIB_PATHS_P := $(addprefix $(LIBPROFILE)/, $(STATICUSEDLIBS)) +LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS) all:: $(TOOLEXENAMES) clean:: $(VERB) rm -f $(TOOLEXENAMES) $(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(BUILD_ROOT_TOP)/tools/Debug/.dir - @echo ======= Linking $(TOOLNAME) debug executable ======= - $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(TOOLLINKOPTS) + @echo ======= Linking $(TOOLNAME) debug executable $(WARN_MSG) ======= + $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(LINK_OPTS) $(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(BUILD_ROOT_TOP)/tools/Release/.dir @echo ======= Linking $(TOOLNAME) release executable ======= - $(VERB) $(LinkO) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_O) $(TOOLLINKOPTS) + $(VERB) $(LinkO) -o $@ $(ObjectsO) $(USED_LIBS_OPTIONS_O) $(LINK_OPTS) $(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(BUILD_ROOT_TOP)/tools/Profile/.dir @echo ======= Linking $(TOOLNAME) profile executable ======= - $(VERB) $(LinkP) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_P) $(TOOLLINKOPTS) + $(VERB) $(LinkP) -o $@ $(ObjectsP) $(USED_LIBS_OPTIONS_P) $(LINK_OPTS) endif @@ -410,26 +425,30 @@ $(BUILD_ROOT)/Depend/%.d: %.cpp $(BUILD_ROOT)/Depend/.dir # Create dependencies for the *.c files... $(BUILD_ROOT)/Depend/%.d: %.c $(BUILD_ROOT)/Depend/.dir - $(VERB) $(Depend) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@ + $(VERB) $(DependC) $< | sed 's|$*\.o *|Release/& Profile/& Debug/& Depend/$(@F)|g' > $@ # Create .o files in the ObjectFiles directory from the .cpp and .c files... $(BUILD_ROOT)/Release/%.o: %.cpp $(BUILD_ROOT)/Release/.dir @echo "Compiling $<" $(VERB) $(CompileO) $< -o $@ -#Release/%.o: %.c Release/.dir Depend/.dir -# $(CompileOC) $< -o $@ +$(BUILD_ROOT)/Release/%.o: %.c $(BUILD_ROOT)/Release/.dir + $(VERB) $(CompileCO) $< -o $@ $(BUILD_ROOT)/Profile/%.o: %.cpp $(BUILD_ROOT)/Profile/.dir @echo "Compiling $<" $(VERB) $(CompileP) $< -o $@ +$(BUILD_ROOT)/Profile/%.o: %.c $(BUILD_ROOT)/Profile/.dir + @echo "Compiling $<" + $(VERB) $(CompileCP) $< -o $@ + $(BUILD_ROOT)/Debug/%.o: %.cpp $(BUILD_ROOT)/Debug/.dir @echo "Compiling $<" $(VERB) $(CompileG) $< -o $@ -#Debug/%.o: %.c Debug/.dir -# $(CompileGC) $< -o $@ +$(BUILD_ROOT)/Debug/%.o: %.c $(BUILD_ROOT)/Debug/.dir + $(VERB) $(CompileCG) $< -o $@ # Create a .cpp source file from a flex input file... this uses sed to cut down # on the warnings emited by GCC... @@ -439,7 +458,7 @@ $(BUILD_ROOT)/Debug/%.o: %.cpp $(BUILD_ROOT)/Debug/.dir # Rule for building the bison parsers... %.cpp %.h : %.y - $(VERB) bison -v -d -p $(<:%Parser.y=%) $(basename $@).y + $(VERB) $(BISON) -v -d -p $(<:%Parser.y=%) $(basename $@).y $(VERB) mv -f $(basename $@).tab.c $(basename $@).cpp $(VERB) mv -f $(basename $@).tab.h $(basename $@).h @@ -448,7 +467,7 @@ $(BUILD_ROOT)/Debug/%.o: %.cpp $(BUILD_ROOT)/Debug/.dir $(VERB) mkdir -p $(@D) @date > $@ -# Clean nukes the tree +# 'make clean' nukes the tree clean:: $(VERB) rm -rf $(BUILD_ROOT)/Debug $(BUILD_ROOT)/Release $(BUILD_ROOT)/Profile $(BUILD_ROOT)/Depend $(VERB) rm -f core *.o *.d *.so *~ *.flc @@ -458,5 +477,5 @@ clean:: # SourceDepend := $(addsuffix .d,$(addprefix $(BUILD_ROOT)/Depend/,$(basename $(filter-out Debug/%, $(Source))))) ifneq ($(SourceDepend),) -include $(SourceDepend) +-include $(SourceDepend) endif