Put the generated Parser.y under compiler/stage<n>/build; fixes #7195
authorIan Lynagh <ian@well-typed.com>
Wed, 10 Oct 2012 01:12:56 +0000 (02:12 +0100)
committerIan Lynagh <ian@well-typed.com>
Wed, 10 Oct 2012 01:12:56 +0000 (02:12 +0100)
compiler/ghc.mk
rules/hs-suffix-rules-srcdir.mk

index a0754af..7556ace 100644 (file)
@@ -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)))
index b39b41a..94a41d5 100644 (file)
@@ -26,6 +26,12 @@ $1/$2/build/%.hs : $1/$4/%.ly | $$$$(dir $$$$@)/.
 $1/$2/build/%.hs : $1/$4/%.y | $$$$(dir $$$$@)/.
        $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
 
+$1/$2/build/%.hs : $1/$2/build/%.ly | $$$$(dir $$$$@)/.
+       $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
+
+$1/$2/build/%.hs : $1/$2/build/%.y | $$$$(dir $$$$@)/.
+       $$(call cmd,HAPPY) $$($1_$2_$3_ALL_HAPPY_OPTS) $$< -o $$@
+
 $1/$2/build/%.hs : $1/$4/%.x | $$$$(dir $$$$@)/.
        $$(call cmd,ALEX) $$($1_$2_$3_ALL_ALEX_OPTS) $$< -o $$@