1 # -----------------------------------------------------------------------------
3 # (c) 2009 The University of Glasgow
5 # This file is part of the GHC build system.
7 # To understand how the build system works and how to modify it, see
8 # http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
11 # -----------------------------------------------------------------------------
14 # Build a perl script. Invoke like this:
16 # driver/mangler_PERL_SRC = ghc-asm.lprl
17 # driver/mangler_dist_PROG = ghc-asm
19 # $(eval $(call build-perl,driver/mangler,dist))
22 $(call trace, build-perl($1,$2))
26 ifeq "$$($1_$2_TOPDIR)" "YES"
27 $1_$2_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
29 $1_$2_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
32 $(call all-target,$1_$2,$$($1_$2_INPLACE))
34 $(call clean-target,$1,$2,$1/$2 $$($1_$2_INPLACE))
36 clean_$1 : clean_$1_$2
38 # INPLACE_BIN etc. might be empty if we're cleaning
39 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
40 ifneq "$$(BINDIST)" "YES"
41 $1/$2/$$($1_$2_PROG).prl: $1/$$($1_PERL_SRC) $$(UNLIT) | $$$$(dir $$$$@)/.
42 "$$(UNLIT)" $$(UNLIT_OPTS) $$< $$@
45 $1/$2/$$($1_$2_PROG): $1/$2/$$($1_$2_PROG).prl
46 "$$(RM)" $$(RM_OPTS) $$@
47 echo '#!$$(PERL)' >> $$@
48 echo '$$$$TARGETPLATFORM = "$$(TARGETPLATFORM)";' >> $$@
49 echo '$$$$TABLES_NEXT_TO_CODE = "$(GhcEnableTablesNextToCode)";' >> $$@
52 $$($1_$2_INPLACE): $1/$2/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
54 $$(EXECUTABLE_FILE) $$@
56 ifneq "$$($1_$2_INSTALL_IN)" ""
57 BINDIST_PERL_SOURCES += $1/$2/$$($1_$2_PROG).prl
59 install: install_$1_$2
62 install_$1_$2: $1/$2/$$($1_$2_PROG)
63 $$(call INSTALL_DIR,"$$($1_$2_INSTALL_IN)")
64 $$(call INSTALL_SCRIPT,$$(INSTALL_OPTS),$$<,"$$($1_$2_INSTALL_IN)")