Follow changes in GHC build system
[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 $(eval $(call build-prog,utils/hsc2hs,dist-install,1))
17
18 # After build-prog above
19 utils/hsc2hs_dist_MODULES += Paths_hsc2hs
20 utils/hsc2hs_dist-install_MODULES = $(utils/hsc2hs_dist_MODULES)
21
22 utils/hsc2hs_template=$(INPLACE_TOPDIR)/template-hsc.h
23
24 # Here we encode the cc and linker options into the wrapper for the released
25 # hsc2hs binary using a HSC2HS_EXTRA variable.
26 # For the stage0 wrapper (built in dist), we don't do this, because the build
27 # system uses it for all stages and passes the right options for each stage
28 # on the command line
29 define utils/hsc2hs_dist-install_SHELL_WRAPPER_EXTRA
30 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
31 endef
32
33 ifneq "$(BINDIST)" "YES"
34
35 $(hsc2hs_INPLACE) : | $(utils/hsc2hs_template)
36
37 # When invoked in the source tree, hsc2hs will try to link in
38 # extra-libs from the packages, including libgmp.a. So we need a
39 # dependency to ensure these libs are built before we invoke hsc2hs:
40 $(hsc2hs_INPLACE) : $(OTHER_LIBS)
41
42 $(utils/hsc2hs_template) : utils/hsc2hs/template-hsc.h | $$(dir $$@)/.
43 "$(CP)" $< $@
44
45 endif
46
47 install: install_utils/hsc2hs_dist_install
48
49 .PHONY: install_utils/hsc2hs_dist_install
50 install_utils/hsc2hs_dist_install: utils/hsc2hs/template-hsc.h
51 $(INSTALL_HEADER) $(INSTALL_OPTS) $< "$(DESTDIR)$(topdir)"
52
53 BINDIST_EXTRAS += utils/hsc2hs/template-hsc.h
54