From 4a2a508bb6adf33f9f3e99baa85f73f0fc18c832 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Wed, 23 Mar 2011 21:16:51 +0000 Subject: [PATCH] Document new hsc2hs flags, and use the --cross-safe flag when we're compiling Patch from Brian Bloniarz --- docs/users_guide/utils.xml | 51 ++++++++++++++++++++++++++++++++++++++++++++ mk/config.mk.in | 1 + 2 files changed, 52 insertions(+) diff --git a/docs/users_guide/utils.xml b/docs/users_guide/utils.xml index 0c7f0f6..109cc01 100644 --- a/docs/users_guide/utils.xml +++ b/docs/users_guide/utils.xml @@ -270,6 +270,34 @@ tags: + -k or + ––keep-files + + Proceed as normal, but do not delete any intermediate files. + + + + + -x or + ––cross-compile + + Activate cross-compilation mode (see ). + + + + + ––cross-safe + + Restrict the .hsc directives to those supported by the + --cross-compile mode (see ). + This should be useful if your .hsc files + must be safely cross-compiled and you wish to keep + non-cross-compilable constructs from creeping into them. + + + + + -? or ––help Display a summary of the available flags and exit successfully. @@ -544,6 +572,29 @@ tags: + + Cross-compilation + + hsc2hs normally operates by creating, compiling, + and running a C program. That approach doesn't work when cross-compiling -- + in this case, the C compiler's generates code for the target machine, + not the host machine. For this situation, there's + a special mode hsc2hs --cross-compile which can generate + the .hs by extracting information from compilations only -- specifically, + whether or not compilation fails. + + + Only a subset of .hsc syntax is supported by + --cross-compile. The following are unsupported: + + #{const_str} + #{let} + #{def} + Custom constructs + + + + diff --git a/mk/config.mk.in b/mk/config.mk.in index 4204c7b..948f805 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -560,6 +560,7 @@ ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux" CONF_CC_OPTS += -G0 endif +SRC_HSC2HS_OPTS += --cross-safe SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0))) SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d)) -- 1.7.10.4