Include <cstdio> instead of <stdio.h>.
[oota-llvm.git] / Makefile.rules
index 47635c9b574a3619d92c2c214f8410c556b0bf7e..2cb9ea2b797c6cd0c161b59f35a03529761d85c8 100644 (file)
@@ -58,6 +58,9 @@ VPATH=$(SourceDir)
 #      building.
 ###########################################################################
 
+# Ensure people re-run configure when it gets updated
+all::$(LLVM_OBJ_ROOT)/config.status
+
 ifdef SHARED_LIBRARY
 # if SHARED_LIBRARY is specified, the default is to build the dynamic lib
 all:: dynamic
@@ -268,7 +271,9 @@ LLVMAS  := $(LLVMTOOLCURRENT)/llvm-as
 # LEVEL/include          : config.h files for the project
 # LLVM_SRC_ROOT/include  : Files global to LLVM.
 #
-CPPFLAGS += -I$(BUILD_OBJ_DIR) -I$(BUILD_SRC_DIR) -I$(LLVM_OBJ_ROOT)/include -I$(BUILD_SRC_ROOT)/include -I$(LEVEL)/include -I$(LLVM_SRC_ROOT)/include
+CPPFLAGS += -I$(BUILD_OBJ_DIR) -I$(BUILD_SRC_DIR) -I$(LLVM_OBJ_ROOT)/include \
+            -I$(BUILD_SRC_ROOT)/include -I$(LEVEL)/include \
+            -I$(LLVM_SRC_ROOT)/include
 
 # By default, strip symbol information from executable
 ifndef KEEP_SYMBOLS
@@ -342,7 +347,8 @@ AR       = ${AR_PATH} cq
 # The local Makefile can list other Source files via ExtraSource = ...
 # 
 ifndef Source
-Source  := $(notdir $(ExtraSource) $(wildcard $(SourceDir)/*.cpp $(SourceDir)/*.c $(SourceDir)/*.y $(SourceDir)/*.l))
+Source  := $(notdir $(ExtraSource) $(wildcard $(SourceDir)/*.cpp \
+                    $(SourceDir)/*.c $(SourceDir)/*.y $(SourceDir)/*.l))
 endif
 
 #
@@ -353,7 +359,7 @@ Objs := $(addsuffix .lo, $(Srcs))
 ObjectsO := $(addprefix $(BUILD_OBJ_DIR)/Release/,$(Objs))
 ObjectsP := $(addprefix $(BUILD_OBJ_DIR)/Profile/,$(Objs))
 ObjectsG := $(addprefix $(BUILD_OBJ_DIR)/Debug/,$(Objs))
-ObjectsBC := $(addprefix $(BUILD_OBJ_DIR)/Bytecode/,$(addsuffix .bc, $(Srcs)))
+ObjectsBC := $(addprefix $(BUILD_OBJ_DIR)/BytecodeObj/,$(addsuffix .bc, $(Srcs)))
 
 #
 # The real objects underlying the libtool objects
@@ -466,7 +472,11 @@ LinkBCLib := $(LLVMGCC) -shared
 ifdef EXPORTED_SYMBOL_LIST
 LinkBCLib += -Xlinker -internalize-public-api-list=$(EXPORTED_SYMBOL_LIST)
 else
+  ifdef EXPORTED_SYMBOL_FILE
+LinkBCLib += -Xlinker -internalize-public-api-file=$(EXPORTED_SYMBOL_FILE)
+  else
 LinkBCLib += -Xlinker -disable-internalize
+  endif
 endif
 
 
@@ -526,15 +536,15 @@ $(LIBNAME_AG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
 #      I think that is safe.
 #
 $(LIBNAME_OBJO): $(ObjectsO) $(LibSubDirs) $(DESTLIBRELEASE)/.dir
-       @echo "Linking $@"
+       @echo "Linking `basename $@`"
        $(VERB) $(Relink) -o $@ $(RObjectsO) $(LibSubDirs)
 
 $(LIBNAME_OBJP): $(ObjectsP) $(LibSubDirs) $(DESTLIBPROFILE)/.dir
-       @echo "Linking $@"
+       @echo "Linking `basename $@`"
        $(VERB) $(Relink) -o $@ $(RObjectsP) $(LibSubDirs)
 
 $(LIBNAME_OBJG): $(ObjectsG) $(LibSubDirs) $(DESTLIBDEBUG)/.dir
-       @echo "Linking $@"
+       @echo "Linking `basename $@`"
        $(VERB) $(Relink) -o $@ $(RObjectsG) $(LibSubDirs)
 
 endif
@@ -543,7 +553,7 @@ endif
 # Create a TAGS database for emacs
 #------------------------------------------------------------------------
 
-ifdef ETAGS
+ifneq ($(ETAGS),false)
 ifeq ($(LEVEL), .)
 SRCDIRS := $(wildcard $(SourceDir)/include $(SourceDir)/lib $(SourceDir)/tools)
 
@@ -635,44 +645,44 @@ endif
 
 
 #---------------------------------------------------------
-.PRECIOUS: $(BUILD_OBJ_DIR)/Depend/.dir $(BUILD_OBJ_DIR)/Bytecode/.dir
+.PRECIOUS: $(BUILD_OBJ_DIR)/Depend/.dir $(BUILD_OBJ_DIR)/BytecodeObj/.dir
 .PRECIOUS: $(BUILD_OBJ_DIR)/Debug/.dir $(BUILD_OBJ_DIR)/Release/.dir
 
 # Create .lo files in the ObjectFiles directory from the .cpp and .c files...
 $(BUILD_OBJ_DIR)/Release/%.lo: %.cpp $(BUILD_OBJ_DIR)/Release/.dir
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileO) $< -o $@
 
 $(BUILD_OBJ_DIR)/Release/%.lo: %.c $(BUILD_OBJ_DIR)/Release/.dir
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileCO) $< -o $@
 
 $(BUILD_OBJ_DIR)/Profile/%.lo: %.cpp $(BUILD_OBJ_DIR)/Profile/.dir
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileP) $< -o $@
 
 $(BUILD_OBJ_DIR)/Profile/%.lo: %.c $(BUILD_OBJ_DIR)/Profile/.dir
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileCP) $< -o $@
 
 $(BUILD_OBJ_DIR)/Debug/%.lo: %.cpp $(BUILD_OBJ_DIR)/Debug/.dir
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileG) $< -o $@
 
 $(BUILD_OBJ_DIR)/Debug/%.lo: %.c $(BUILD_OBJ_DIR)/Debug/.dir 
-       @echo "Compiling $<"
+       @echo "Compiling `basename $<`"
        $(VERB) $(CompileCG) $< -o $@
 
-$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.cpp $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1XX)
-       @echo "Compiling $< to bytecode"
+$(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.cpp $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1XX)
+       @echo "Compiling `basename $<` to bytecode"
        $(VERB) $(LLVMGXX) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
 
-$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.c $(BUILD_OBJ_DIR)/Bytecode/.dir $(LCC1)
-       @echo "Compiling $< to bytecode"
+$(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.c $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LCC1)
+       @echo "Compiling `basename $<` to bytecode"
        $(VERB) $(LLVMGCC) $(CompileWarnings) $(CPPFLAGS) -c $< -o $@
 
-$(BUILD_OBJ_DIR)/Bytecode/%.bc: %.ll $(BUILD_OBJ_DIR)/Bytecode/.dir $(LLVMAS)
-       @echo "Compiling $< to bytecode"
+$(BUILD_OBJ_DIR)/BytecodeObj/%.bc: %.ll $(BUILD_OBJ_DIR)/BytecodeObj/.dir $(LLVMAS)
+       @echo "Compiling `basename $<` to bytecode"
        $(VERB) $(LLVMAS) $< -f -o $@
 
 
@@ -722,7 +732,7 @@ YACC_OUTPUT = $(addprefix $(YACC_FILES:%.y=%), .h .cpp .output)
        @$(DATE) > $@
 
 # To create postscript files from dot files...
-ifdef DOT
+ifneq ($(DOT),false)
 %.ps: %.dot
        ${DOT} -Tps < $< > $@
 else
@@ -735,13 +745,13 @@ endif
 # which they can be "generated."  This allows make to ignore them and
 # reproduce the dependency lists.
 #
-%.h::
+%.h:: ;
 
 # 'make clean' nukes the tree
 clean::
        $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Debug $(BUILD_OBJ_DIR)/Release
        $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Profile $(BUILD_OBJ_DIR)/Depend
-       $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/Bytecode
+       $(VERB) $(RM) -rf $(BUILD_OBJ_DIR)/BytecodeObj
        $(VERB) $(RM) -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
        $(VERB) $(RM) -f $(LEX_OUTPUT) $(YACC_OUTPUT)
 
@@ -767,6 +777,16 @@ $(BUILD_OBJ_DIR)/Depend/%.d: %.cpp $(BUILD_OBJ_DIR)/Depend/.dir
 $(BUILD_OBJ_DIR)/Depend/%.d: %.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' > $@
 
+#
+# Autoconf Dependencies.
+#
+$(LLVM_OBJ_ROOT)/config.status:: $(LLVM_SRC_ROOT)/configure
+       @${ECHO} "****************************************************************"
+       @${ECHO} "   You need to re-run $(LLVM_SRC_ROOT)/configure"
+       @${ECHO} "   in directory $(LLVM_OBJ_ROOT)"
+       @${ECHO} "****************************************************************"
+       $(VERB) exit 1
+
 #
 # Include dependencies generated from C/C++ source files, but not if we
 # are cleaning (this example taken from the GNU Make Manual).