summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.rules17
1 files changed, 17 insertions, 0 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 43402330ac..775212a24b 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -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...
#---------------------------------------------------------