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 define utils/hsc2hs_dist_SHELL_WRAPPER_EXTRA
25 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE0)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE0)) -I$(TOP)/includes"' >> "$(WRAPPER)"
26 endef
27 define utils/hsc2hs_dist-install_SHELL_WRAPPER_EXTRA
28 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
29 endef
30
31 ifneq "$(BINDIST)" "YES"
32
33 $(hsc2hs_INPLACE) : | $(utils/hsc2hs_template)
34
35 # When invoked in the source tree, hsc2hs will try to link in
36 # extra-libs from the packages, including libgmp.a. So we need a
37 # dependency to ensure these libs are built before we invoke hsc2hs:
38 $(hsc2hs_INPLACE) : $(OTHER_LIBS)
39
40 $(utils/hsc2hs_template) : utils/hsc2hs/template-hsc.h | $$(dir $$@)/.
41 "$(CP)" $< $@
42
43 endif
44
45 install: install_utils/hsc2hs_dist_install
46
47 .PHONY: install_utils/hsc2hs_dist_install
48 install_utils/hsc2hs_dist_install: utils/hsc2hs/template-hsc.h
49 $(call INSTALL_HEADER,$(INSTALL_OPTS),$<,"$(DESTDIR)$(topdir)")
50
51 BINDIST_EXTRAS += utils/hsc2hs/template-hsc.h
52