Drop Paths_hsc2hs module from ghc.mk
[hsc2hs.git] / ghc.mk
1 utils/hsc2hs_USES_CABAL = YES
2 utils/hsc2hs_PACKAGE = hsc2hs
3
4 utils/hsc2hs_dist_PROGNAME = hsc2hs
5 utils/hsc2hs_dist-install_PROGNAME = hsc2hs
6
7 utils/hsc2hs_dist_SHELL_WRAPPER = YES
8 utils/hsc2hs_dist_INSTALL = NO
9 utils/hsc2hs_dist_INSTALL_INPLACE = YES
10
11 utils/hsc2hs_dist-install_SHELL_WRAPPER = YES
12 utils/hsc2hs_dist-install_INSTALL = YES
13 utils/hsc2hs_dist-install_INSTALL_INPLACE = NO
14
15 $(eval $(call build-prog,utils/hsc2hs,dist,0))
16
17 # When CrossCompiling, we want to ship the binary for the
18 # host, not for the target. As such we need to compile
19 # with the Bootstrap compiler rather than with the in-tree
20 # stage1 compiler, which would result in a binary that
21 # won't run on the host.
22 ifeq "$(CrossCompiling)" "YES"
23 # compile with stage 0 (bootstrap compiler)
24 $(eval $(call build-prog,utils/hsc2hs,dist-install,0))
25 else
26 $(eval $(call build-prog,utils/hsc2hs,dist-install,1))
27 endif
28
29 # After build-prog above
30 utils/hsc2hs_dist-install_MODULES = $(utils/hsc2hs_dist_MODULES)
31
32 utils/hsc2hs_template=$(INPLACE_TOPDIR)/template-hsc.h
33
34 # Here we encode the cc and linker options into the wrapper for the released
35 # hsc2hs binary using a HSC2HS_EXTRA variable.
36 # For the stage0 wrapper (built in dist), we don't do this, because the build
37 # system uses it for all stages and passes the right options for each stage
38 # on the command line
39 define utils/hsc2hs_dist-install_SHELL_WRAPPER_EXTRA
40 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
41 endef
42
43 ifneq "$(BINDIST)" "YES"
44
45 $(hsc2hs_INPLACE) : | $(utils/hsc2hs_template)
46
47 # When invoked in the source tree, hsc2hs will try to link in
48 # extra-libs from the packages, including libgmp.a. So we need a
49 # dependency to ensure these libs are built before we invoke hsc2hs:
50 $(hsc2hs_INPLACE) : $(OTHER_LIBS)
51
52 $(utils/hsc2hs_template) : utils/hsc2hs/template-hsc.h | $$(dir $$@)/.
53 "$(CP)" $< $@
54
55 endif
56
57 install: install_utils/hsc2hs_dist_install
58
59 .PHONY: install_utils/hsc2hs_dist_install
60 install_utils/hsc2hs_dist_install: utils/hsc2hs/template-hsc.h
61 $(INSTALL_HEADER) $(INSTALL_OPTS) $< "$(DESTDIR)$(topdir)"
62
63 BINDIST_EXTRAS += utils/hsc2hs/template-hsc.h
64