configure: Remove --with-curses-includes flag
[ghc.git] / rules / build-perl.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 # http://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13
14 # Build a perl script. Invoke like this:
15 #
16 # driver/mangler_PERL_SRC = ghc-asm.pl
17 # driver/mangler_dist_PROGNAME = ghc-asm
18 #
19 # $(eval $(call build-perl,driver/mangler,dist))
20
21 define build-perl
22 $(call trace, build-perl($1,$2))
23 $(call profStart, build-perl($1,$2))
24 # $1 = dir
25 # $2 = distdir
26
27 ifeq "$$($1_$2_PROGNAME)" ""
28 $$(error $1_$2_PROGNAME is not set)
29 endif
30 ifneq "$$($1_$2_PROG)" ""
31 $$(error $1_$2_PROG is set)
32 endif
33 $1_$2_PROG = $$($1_$2_PROGNAME)
34
35 ifneq "$$($$($1_$2_PROG)_INPLACE)" ""
36 $$(error $$($1_$2_PROG)_INPLACE defined twice)
37 endif
38 ifeq "$$($1_$2_TOPDIR)" "YES"
39 $$($1_$2_PROG)_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
40 else
41 $$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
42 endif
43
44 $1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE)
45
46 $(call all-target,$1_$2,$$($1_$2_INPLACE))
47
48 $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
49 .PHONY: clean_$1
50 clean_$1 : clean_$1_$2
51
52 ifneq "$$(BINDIST)" "YES"
53
54 $1/$2/$$($1_$2_PROG): $1/$$/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/.
55 $$(call removeFiles,$$@)
56 echo '#!$$(PERL)' >> $$@
57 echo 'my $$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@
58 echo 'my $$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@
59 cat $$< >> $$@
60
61 $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
62 "$$(CP)" $$< $$@
63 $$(EXECUTABLE_FILE) $$@
64 endif
65
66 ifeq "$$($1_$2_INSTALL)" "YES"
67 # Don't add to INSTALL_BINS or INSTALL_LIBEXECS, because they will get
68 # stripped when calling 'make install-strip', and stripping a Perl script
69 # doesn't work.
70 ifeq "$$($1_$2_TOPDIR)" "YES"
71 INSTALL_LIBEXEC_SCRIPTS += $$($1_$2_INPLACE)
72 else
73 INSTALL_SCRIPTS += $$($1_$2_INPLACE)
74 endif
75 endif
76
77 $(call profEnd, build-perl($1,$2))
78 endef