Add some rules for building preprocessed files
authorChris Lattner <sabre@nondot.org>
Wed, 5 Oct 2005 00:28:41 +0000 (00:28 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 5 Oct 2005 00:28:41 +0000 (00:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23629 91177308-0d34-0410-b5e6-96231b3b80d8

Makefile.rules

index 43402330acc61d1a141868961254a410bb9adb1e..775212a24b02ea004b765a9e2c2d3562b848d899 100644 (file)
@@ -359,10 +359,13 @@ Compile.C     = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags)
 LTCompile.C   = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C)
 BCCompile.C   = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
                 $(C.Flags) -c
+Preprocess.C  = $(CC) $(CPP.Flags) $(CompileCommonOpts) -E $(C.Flags)
+
 Compile.CXX   = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c
 LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX)
 BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \
                 $(CXX.Flags) -c
+Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E
 Link          = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
                $(CompileCommonOpts) $(LD.Flags) $(Strip)
 Relink        = $(LIBTOOL) $(LibTool.Flags) --mode=link $(CXX) $(CPP.Flags) \
@@ -1002,6 +1005,20 @@ $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
 
 endif
 
+## Rules for building preprocessed (.i/.ii) outputs.
+$(BuildMode)/%.ii: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
+       $(Echo) "Compiling $*.cpp for $(BuildMode) build to .ii file"
+       $(Verb) $(Preprocess.CXX) $< -o $@
+
+$(BuildMode)/%.ii: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
+       $(Echo) "Compiling $*.cc for $(BuildMode) build to .ii file"
+       $(Verb) $(Preprocess.CXX) $< -o $@
+
+ $(BuildMode)/%.i: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
+       $(Echo) "Compiling $*.c for $(BuildMode) build to .i file"
+       $(Verb) $(Preprocess.C) $< -o $@
+
+
 #---------------------------------------------------------
 # Create .bc files in the ObjDir directory from .cpp .cc and .c files...
 #---------------------------------------------------------