Testsuite: mark T8089 expect_broken(#7325) on Windows
[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.lprl
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_TOPDIR)/$$($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 $1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$$$(unlit_INPLACE) | $$$$(dir $$$$@)/.
54 "$$(unlit_INPLACE)" $$(UNLIT_OPTS) $$< $$@
55
56 $1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
57 $$(call removeFiles,$$@)
58 echo '#!$$(PERL)' >> $$@
59 echo '$$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@
60 echo '$$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@
61 cat $$< >> $$@
62
63 $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
64 "$$(CP)" $$< $$@
65 $$(EXECUTABLE_FILE) $$@
66 endif
67
68 ifeq "$$($1_$2_INSTALL)" "YES"
69 ifeq "$$($1_$2_TOPDIR)" "YES"
70 INSTALL_TOPDIRS += $$($1_$2_INPLACE)
71 else
72 INSTALL_BINS += $$($1_$2_INPLACE)
73 endif
74 endif
75
76 $(call profEnd, build-perl($1,$2))
77 endef