Support long longs in const and enum in template-hsc.h
[hsc2hs.git] / ghc.mk
1 utils/hsc2hs_USES_CABAL = YES
2 utils/hsc2hs_PACKAGE = hsc2hs
3
4 utils/hsc2hs_dist_PROG = $(GHC_HSC2HS_PGM)
5 utils/hsc2hs_dist-install_PROG = $(GHC_HSC2HS_PGM)
6
7 utils/hsc2hs_dist_SHELL_WRAPPER = YES
8 utils/hsc2hs_dist_INSTALL_SHELL_WRAPPER = NO
9
10 utils/hsc2hs_dist-install_SHELL_WRAPPER = YES
11 utils/hsc2hs_dist-install_INSTALL_SHELL_WRAPPER = YES
12 utils/hsc2hs_dist-install_INSTALL_INPLACE = NO
13
14 $(eval $(call build-prog,utils/hsc2hs,dist,0))
15 $(eval $(call build-prog,utils/hsc2hs,dist-install,1))
16
17 # After build-prog above
18 utils/hsc2hs_dist_MODULES += Paths_hsc2hs
19 utils/hsc2hs_dist-install_MODULES = $(utils/hsc2hs_dist_MODULES)
20
21 utils/hsc2hs_template=$(INPLACE_TOPDIR)/template-hsc.h
22
23 define utils/hsc2hs_dist_SHELL_WRAPPER_EXTRA
24 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE0)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE0)) -I$(TOP)/includes"' >> "$(WRAPPER)"
25 endef
26 define utils/hsc2hs_dist-install_SHELL_WRAPPER_EXTRA
27 echo 'HSC2HS_EXTRA="$(addprefix --cflag=,$(CONF_CC_OPTS_STAGE1)) $(addprefix --lflag=,$(CONF_GCC_LINKER_OPTS_STAGE1))"' >> "$(WRAPPER)"
28 endef
29
30 ifneq "$(BINDIST)" "YES"
31
32 $(HSC2HS_INPLACE) : | $(utils/hsc2hs_template)
33
34 # When invoked in the source tree, hsc2hs will try to link in
35 # extra-libs from the packages, including libgmp.a. So we need a
36 # dependency to ensure these libs are built before we invoke hsc2hs:
37 $(HSC2HS_INPLACE) : $(OTHER_LIBS)
38
39 $(utils/hsc2hs_template) : utils/hsc2hs/template-hsc.h | $$(dir $$@)/.
40 "$(CP)" $< $@
41
42 endif
43
44 install: install_utils/hsc2hs_dist_install
45
46 .PHONY: install_utils/hsc2hs_dist_install
47 install_utils/hsc2hs_dist_install: utils/hsc2hs/template-hsc.h
48 $(call INSTALL_HEADER,$(INSTALL_OPTS),$<,"$(DESTDIR)$(topdir)")
49
50 BINDIST_EXTRAS += utils/hsc2hs/template-hsc.h
51