Skip to content

Commit

Permalink
Document new hsc2hs flags, and use the --cross-safe flag when we're c…
Browse files Browse the repository at this point in the history
…ompiling

Patch from Brian Bloniarz
  • Loading branch information
igfoo committed Mar 23, 2011
1 parent 90d7a88 commit 4a2a508
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/users_guide/utils.xml
Expand Up @@ -269,6 +269,34 @@ tags:
</listitem>
</varlistentry>

<varlistentry>
<term><literal>-k</literal> or
<literal>&ndash;&ndash;keep-files</literal></term>
<listitem>
<para>Proceed as normal, but do not delete any intermediate files.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><literal>-x</literal> or
<literal>&ndash;&ndash;cross-compile</literal></term>
<listitem>
<para>Activate cross-compilation mode (see <xref linkend="hsc2hs_cross"/>).</para>
</listitem>
</varlistentry>

<varlistentry>
<term><literal>&ndash;&ndash;cross-safe</literal></term>
<listitem>
<para>Restrict the .hsc directives to those supported by the
<literal>--cross-compile</literal> mode (see <xref linkend="hsc2hs_cross"/>).
This should be useful if your <literal>.hsc</literal> files
must be safely cross-compiled and you wish to keep
non-cross-compilable constructs from creeping into them.</para>
</listitem>
</varlistentry>


<varlistentry>
<term><literal>-?</literal> or <literal>&ndash;&ndash;help</literal></term>
<listitem>
Expand Down Expand Up @@ -544,6 +572,29 @@ tags:

</sect2>

<sect2 id="hsc2hs_cross">
<title>Cross-compilation</title>

<para><command>hsc2hs</command> 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 <command>hsc2hs --cross-compile</command> which can generate
the .hs by extracting information from compilations only -- specifically,
whether or not compilation fails.
</para>

<para>Only a subset of <literal>.hsc</literal> syntax is supported by
<literal>--cross-compile</literal>. The following are unsupported:
<itemizedlist>
<listitem><literal>#{const_str}</literal></listitem>
<listitem><literal>#{let}</literal></listitem>
<listitem><literal>#{def}</literal></listitem>
<listitem>Custom constructs</listitem>
</itemizedlist>
</para>
</sect2>

</sect1>

</chapter>
Expand Down
1 change: 1 addition & 0 deletions mk/config.mk.in
Expand Up @@ -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))

Expand Down

0 comments on commit 4a2a508

Please sign in to comment.