* Remove cleandeps target
[oota-llvm.git] / Makefile.common
index 915cd8a3f4a51ab5d4e31d3cfd4a3cd03e5d6b17..95fa3b2758d70e73c7d5370027e153b5e19772ef 100644 (file)
@@ -48,6 +48,7 @@
 # For building,
 #      LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT, and
 #      LLVM_OBJ_ROOT = BUILD_OBJ_ROOT.
+#
 #===-----------------------------------------------------------------------====
 
 #
@@ -160,13 +161,24 @@ bytecode::
 
 # Print out the directories used for building
 prdirs::
-       echo "Home Offset      : " $(HOME_OBJ_ROOT);
-       echo "Build Source Root: " $(BUILD_SRC_ROOT);
-       echo "Build Source Dir : " $(BUILD_SRC_DIR);
-       echo "Build Object Root: " $(BUILD_OBJ_ROOT);
-       echo "Build Object Dir : " $(BUILD_OBJ_DIR);
-       echo "LLVM  Source Root: " $(LLVM_SRC_ROOT);
-       echo "LLVM  Object Root: " $(LLVM_OBJ_ROOT);
+       echo "Home Offset      : " $(HOME_OBJ_ROOT)
+       echo "Build Source Root: " $(BUILD_SRC_ROOT)
+       echo "Build Source Dir : " $(BUILD_SRC_DIR)
+       echo "Build Object Root: " $(BUILD_OBJ_ROOT)
+       echo "Build Object Dir : " $(BUILD_OBJ_DIR)
+       echo "LLVM  Source Root: " $(LLVM_SRC_ROOT)
+       echo "LLVM  Object Root: " $(LLVM_OBJ_ROOT)
+
+###########################################################################
+# Suffixes and implicit rules:
+#      Empty out the list of suffixes, generate a list that is only
+#      used by this Makefile, and cancel useless implicit rules.   This
+#      will hopefully speed up compilation a little bit.
+###########################################################################
+.SUFFIXES:
+.SUFFIXES: .c .cpp .h .hpp .y .l
+.SUFFIXES: .lo .o .a .so .bc
+.SUFFIXES: .ps .dot .d
 
 #
 # Mark all of these targets as phony.  This will hopefully speed up builds
@@ -211,11 +223,6 @@ ifdef ENABLE_PROFILING
   PROFILE = -pg
 endif
 
-#
-# Suffixes for library compilation rules
-#
-.SUFFIXES: .so
-
 ###########################################################################
 # Library Locations:
 #      These variables describe various library locations:
@@ -312,10 +319,10 @@ TBLGEN  := $(LLVMTOOLCURRENT)/tblgen
 #--------------------------------------------------------------------------
 # The LLVM GCC front-end in C and C++ flavors
 #
-LLVMGCC := $(LLVMGCCDIR)/bin/gcc
-LCC1    := $(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH)/cc1
-LLVMGXX := $(LLVMGCCDIR)/bin/g++
-LCC1XX  := $(LLVMGCCDIR)/lib/gcc-lib/$(LLVMGCCARCH)/cc1plus
+LLVMGCC := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/gcc
+LCC1    := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1
+LLVMGXX := PATH=$(LLVMTOOLCURRENT):$(PATH) $(LLVMGCCDIR)/bin/g++
+LCC1XX  := $(LLVMGCCDIR)/libexec/gcc/$(LLVMGCCARCH)/cc1plus
 
 #--------------------------------------------------------------------------
 # Some of the compiled LLVM tools which are used for compilation of runtime
@@ -379,9 +386,6 @@ LinkP    := $(Link) -O3 -L$(PROJLIBPROFILESOURCE) -L$(LLVMLIBPROFILESOURCE) $(PR
 
 # Create one .o file from a bunch of .o files...
 Relink := ${LIBTOOL} --mode=link $(CXX)
-ifndef SHARED_LIBRARY
-Relink += -only-static
-endif
 
 #
 # Configure where the item being compiled should go.
@@ -537,7 +541,7 @@ endif
 
 
 # Rule for building bytecode libraries.
-$(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs)
+$(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs) $(DESTLIBBYTECODE)/.dir
        @echo ======= Linking $(LIBRARYNAME) bytecode library =======
        $(VERB) $(LinkBCLib) -o $@ $(ObjectsBC) $(LibSubDirs) $(LibLinkOpts)
 #
@@ -545,18 +549,18 @@ $(LIBNAME_BC): $(ObjectsBC) $(LibSubDirs)
 #
 $(LIBNAME_O): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
        @echo ======= Linking $(LIBRARYNAME) dynamic release library =======
-       $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts);
-       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+       $(VERB) $(Link) -o $*.la $(ObjectsO) $(LibSubDirs) $(LibLinkOpts)
+       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
 
 $(LIBNAME_P): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
        @echo ======= Linking $(LIBRARYNAME) dynamic profile library =======
-       $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts);
-       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+       $(VERB) $(Link) -o $*.la $(ObjectsP) $(LibSubDirs) $(LibLinkOpts)
+       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
 
 $(LIBNAME_G): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
        @echo ======= Linking $(LIBRARYNAME) dynamic debug library =======
-       $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts);
-       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT);
+       $(VERB) $(Link) -o $*.la $(ObjectsG) $(LibSubDirs) $(LibLinkOpts)
+       $(VERB) $(LIBTOOL) --mode=install $(INSTALL) $*.la $(DESTLIBCURRENT)
 
 #
 # Rules for building static archive libraries.
@@ -660,7 +664,6 @@ STATICUSEDLIBS   := $(patsubst %.a.o, lib%.a, $(addsuffix .o, $(USEDLIBS)))
 USED_LIB_PATHS_G := $(addprefix $(DESTLIBDEBUG)/, $(STATICUSEDLIBS))
 USED_LIB_PATHS_O := $(addprefix $(DESTLIBRELEASE)/, $(STATICUSEDLIBS))
 USED_LIB_PATHS_P := $(addprefix $(DESTLIBPROFILE)/, $(STATICUSEDLIBS))
-#LINK_OPTS        := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
 
 #
 # Libtool link options:
@@ -736,7 +739,7 @@ $(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Bytecode/.dir $
        @echo "Compiling $< to bytecode"
        $(VERB) $(LLVMGCC) $(CPPFLAGS) -c $< -o $@
 
-$(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
+$(BUILD_OBJ_DIR)/Bytecode/%.bc: $(SourceDir)%.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
        @echo "Compiling $< to bytecode"
        $(VERB) $(LLVMAS) $< -f -o $@
 
@@ -756,7 +759,7 @@ YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
 # The last line is a gross hack to work around flex aparently not being able to
 # resize the buffer on a large token input.  Currently, for uninitialized string
 # buffers in LLVM we can generate very long tokens, so this is a hack around it.
-# FIXME.  (f.e. char Buffer[10000]; )
+# FIXME.  (f.e. char Buffer[10000] )
 #
 %.cpp: %.l
        @echo Flex\'ing $<...
@@ -816,14 +819,14 @@ SourceBaseNames := $(basename $(notdir $(filter-out Debug/%, $(Source))))
 SourceDepend := $(SourceBaseNames:%=$(BUILD_OBJ_DIR)/Depend/%.d)
 
 # Create dependencies for the *.cpp files...
-#$(SourceDepend): \x
 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.cpp $(BUILD_OBJ_DIR)/Depend/.dir
        $(VERB) $(Depend) $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
+       $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.cpp||' | $(SED) 's|[^\]$$|&::|' >> $@
 
 # Create dependencies for the *.c files...
-#$(SourceDepend): \x
 $(BUILD_OBJ_DIR)/Depend/%.d: $(SourceDir)%.c $(BUILD_OBJ_DIR)/Depend/.dir
        $(VERB) $(DependC) -o $@ $< | $(SED) 's|\.o|\.lo|' | $(SED) 's|$*\.lo *|$(BUILD_OBJ_DIR)/Release/& $(BUILD_OBJ_DIR)/Profile/& $(BUILD_OBJ_DIR)/Debug/& $(BUILD_OBJ_DIR)/Depend/$(@F)|g' > $@
+       $(VERB) $(Depend) $< | $(SED) 's|$*.o: $*.c||' | $(SED) 's|[^\]$$|&::|' >> $@
 
 #
 # Include dependencies generated from C/C++ source files, but not if we
@@ -836,3 +839,7 @@ ifneq ($(SourceDepend),)
 endif
 endif
 endif
+
+cleandeps::
+       $(VERB) rm -f $(SourceDepend)
+