summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ghc.mk13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index a0754af5c2..7556acea64 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -247,7 +247,18 @@ PRIMOP_BITS = compiler/primop-data-decl.hs-incl \
compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
compiler_CPP_OPTS += ${GhcCppOpts}
-$(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
+define preprocessCompilerFiles
+# $0 = stage
+compiler/stage$1/build/Parser.y: compiler/parser/Parser.y.pp
+ $$(CPP) $$(RAWCPP_FLAGS) -P $$(compiler_CPP_OPTS) -x c $$< | grep -v '^#pragma GCC' > $$@
+endef
+
+$(eval $(call preprocessCompilerFiles,1))
+$(eval $(call preprocessCompilerFiles,2))
+$(eval $(call preprocessCompilerFiles,3))
+
+
+$(PRIMOPS_TXT): %: %.pp compiler/stage1/$(PLATFORM_H)
$(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
$(eval $(call clean-target,compiler,primop, $(PRIMOPS_TXT) compiler/parser/Parser.y $(PRIMOP_BITS)))