
On 04/02/13 11:52, Gabor Greif wrote:
Hi Simon, all,
here is me my new patch:
$ git show 95303e2b96f0630a051544b216cf4530d37dbaba commit 95303e2b96f0630a051544b216cf4530d37dbaba Author: Gabor Greif
Date: Fri Nov 23 17:54:00 2012 +0100 Allow different customizations per cross target by obtaining CrossCompilePrefix from mk/config.mk and using that to include mk/$(CrossCompilePrefix)build.mk instead of mk/build.mk when present.
diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index e64bb36..8de3450 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -5,7 +5,8 @@ ifeq "$(Validating)" "YES" include mk/validate-settings.mk -include mk/validate.mk else --include mk/build.mk +CrossCompilePrefix := $(word 3,$(shell grep -e "^CrossCompilePrefix *= " mk/config.mk)) +-include $(firstword $(wildcard mk/$(CrossCompilePrefix)build.mk) mk/build.mk) endif
ifeq "$(BINDIST)" "YES"
Sorry, but that's yucky! (the shell/grep hack) I don't get it - custom-settings.mk looks like it is always included after config.mk to me. It's supposed to be, because build.mk can override settings in config.mk. Cheers, Simon
This solution falls back to using mk/build.mk when building a cross compiler and mk/<my-cross-target>-build.mk is not present. A slight complication is that when mk/custom-settings.mk (the above file) get included from Makefile the mk/config.mk is not included (it gets read from the recursive make invocation by mk/ghc.mk). So I simply fish for CrossCompilePrefix with a grep line, but nothing bad happens when it is not found.
Okay to commit? Improvement suggestions? I'll add some lines of documentation if you think this is good to go.