Automatically add the $(exeext) to program names
authorIan Lynagh <ian@well-typed.com>
Sun, 3 Mar 2013 22:49:41 +0000 (22:49 +0000)
committerIan Lynagh <ian@well-typed.com>
Sun, 3 Mar 2013 22:52:50 +0000 (22:52 +0000)
We now define _PROGNAME, and _PROG is automatically defined with
$(exeext). This will shortly automatically use the right exeext
depending on what stage it is being compiled with (exeext may be
different for different stages when cross-compiling).

23 files changed:
driver/ghc/ghc.mk
driver/ghci/ghc.mk
driver/haddock/ghc.mk
driver/split/ghc.mk
ghc/ghc.mk
rules/build-perl.mk
rules/build-prog.mk
rules/shell-wrapper.mk
utils/compare_sizes/ghc.mk
utils/count_lines/ghc.mk
utils/deriveConstants/ghc.mk
utils/genapply/ghc.mk
utils/genprimopcode/ghc.mk
utils/ghc-cabal/ghc.mk
utils/ghc-pkg/ghc.mk
utils/ghc-pwd/ghc.mk
utils/ghctags/ghc.mk
utils/hp2ps/ghc.mk
utils/hpc/ghc.mk
utils/mkUserGuidePart/ghc.mk
utils/runghc/ghc.mk
utils/touchy/ghc.mk
utils/unlit/ghc.mk

index dee9d57..31df04a 100644 (file)
@@ -14,7 +14,7 @@ ifeq "$(Windows_Host)" "YES"
 
 driver/ghc_dist_C_SRCS   = ghc.c ../utils/cwrapper.c ../utils/getLocation.c
 driver/ghc_dist_CC_OPTS += -I driver/utils
-driver/ghc_dist_PROG     = ghc-$(ProjectVersion)
+driver/ghc_dist_PROGNAME = ghc-$(ProjectVersion)
 driver/ghc_dist_INSTALL  = YES
 driver/ghc_dist_INSTALL_INPLACE = NO
 
index c231347..736b7a9 100644 (file)
@@ -31,7 +31,7 @@ else # Windows_Host...
 
 driver/ghci_dist_C_SRCS  = ghci.c ../utils/cwrapper.c ../utils/getLocation.c
 driver/ghci_dist_CC_OPTS += -I driver/utils
-driver/ghci_dist_PROG    = ghci$(exeext)
+driver/ghci_dist_PROGNAME = ghci
 driver/ghci_dist_INSTALL = YES
 driver/ghci_dist_INSTALL_INPLACE = YES
 driver/ghci_dist_OTHER_OBJS = driver/ghci/ghci.res
index 06a6cec..3fe7174 100644 (file)
@@ -14,7 +14,7 @@ ifeq "$(Windows_Host)" "YES"
 
 driver/haddock_dist_C_SRCS   = haddock.c ../utils/cwrapper.c ../utils/getLocation.c
 driver/haddock_dist_CC_OPTS += -I driver/utils
-driver/haddock_dist_PROG     = haddock-$(ProjectVersion)
+driver/haddock_dist_PROGNAME = haddock-$(ProjectVersion)
 driver/haddock_dist_INSTALL  = YES
 driver/haddock_dist_INSTALL_INPLACE = NO
 
index 9ee4cd6..461dd5a 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 driver/split_PERL_SRC  = ghc-split.lprl
-driver/split_dist_PROG = ghc-split
+driver/split_dist_PROGNAME = ghc-split
 driver/split_dist_TOPDIR = YES
 driver/split_dist_INSTALL = YES
 driver/split_dist_INSTALL_INPLACE = YES
index 3466b51..44dd126 100644 (file)
@@ -72,9 +72,9 @@ ifeq "$(GhcProfiled)" "YES"
 ghc_stage2_PROGRAM_WAY = p
 endif
 
-ghc_stage1_PROG = ghc-stage1$(exeext)
-ghc_stage2_PROG = ghc-stage2$(exeext)
-ghc_stage3_PROG = ghc-stage3$(exeext)
+ghc_stage1_PROGNAME = ghc-stage1
+ghc_stage2_PROGNAME = ghc-stage2
+ghc_stage3_PROGNAME = ghc-stage3
 
 ghc_stage1_SHELL_WRAPPER = YES
 ghc_stage2_SHELL_WRAPPER = YES
index 2c1908d..157ed2b 100644 (file)
@@ -14,7 +14,7 @@
 # Build a perl script.  Invoke like this:
 #
 # driver/mangler_PERL_SRC = ghc-asm.lprl
-# driver/mangler_dist_PROG = ghc-asm
+# driver/mangler_dist_PROGNAME = ghc-asm
 #
 # $(eval $(call build-perl,driver/mangler,dist))
 
@@ -24,6 +24,15 @@ $(call profStart, build-perl($1,$2))
 # $1 = dir
 # $2 = distdir
 
+ifneq "$$(CLEANING)" "YES"
+ifeq "$$($1_$2_PROGNAME)" ""
+$$(error $1_$2_PROGNAME is not set)
+endif
+ifneq "$$($1_$2_PROG)" ""
+$$(error $1_$2_PROG is set)
+endif
+$1_$2_PROG = $$($1_$2_PROGNAME)
+
 ifneq "$$($$($1_$2_PROG)_INPLACE)" ""
 $$(error $$($1_$2_PROG)_INPLACE defined twice)
 endif
@@ -32,6 +41,7 @@ $$($1_$2_PROG)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
 else
 $$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
 endif
+endif
 
 $1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE)
 
index 4bf9ab0..5973159 100644 (file)
@@ -15,7 +15,7 @@
 #
 # utils/genapply_MODULES = Main
 # utils/genapply_HC_OPTS = -package Cabal
-# utils/genapply_dist_PROG = genapply
+# utils/genapply_dist_PROGNAME = genapply
 #
 # $(eval $(call build-prog,utils/genapply,dist-install,1))
 
@@ -27,9 +27,13 @@ $(call profStart, build-prog($1,$2,$3))
 # $3 = GHC stage to use (0 == bootstrapping compiler)
 
 ifneq "$$(CLEANING)" "YES"
-ifeq "$$($1_$2_PROG)" ""
-$$(error $1_$2_PROG is not set)
+ifeq "$$($1_$2_PROGNAME)" ""
+$$(error $1_$2_PROGNAME is not set)
 endif
+ifneq "$$($1_$2_PROG)" ""
+$$(error $1_$2_PROG is set)
+endif
+$1_$2_PROG = $$($1_$2_PROGNAME)$$(exeext)
 endif
 
 ifeq "$$(findstring $3,0 1 2)" ""
@@ -88,20 +92,20 @@ $1_$2_INPLACE =
 endif
 else
 ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
-ifneq "$$($$($1_$2_PROG)_INPLACE)" ""
-$$(error $$($1_$2_PROG)_INPLACE defined twice)
+ifneq "$$($$($1_$2_PROGNAME)_INPLACE)" ""
+$$(error $$($1_$2_PROGNAME)_INPLACE defined twice)
 endif
 endif
 ifeq "$$($1_$2_TOPDIR)" "YES"
-$$($1_$2_PROG)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
+$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_TOPDIR)/$$($1_$2_PROG)
 else
-$$($1_$2_PROG)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
+$$($1_$2_PROGNAME)_INPLACE = $$(INPLACE_BIN)/$$($1_$2_PROG)
 endif
 # Where do we install the inplace version?
 ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
 $1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
 else
-$1_$2_INPLACE = $$($$($1_$2_PROG)_INPLACE)
+$1_$2_INPLACE = $$($$($1_$2_PROGNAME)_INPLACE)
 endif
 endif
 
index 450c989..687c408 100644 (file)
@@ -17,7 +17,7 @@ $(call profStart, shell-wrapper($1,$2))
 # $2 = distdir
 
 ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
-$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper
+$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROGNAME).wrapper
 endif
 
 ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
@@ -90,7 +90,7 @@ endif
 
 ifeq "$$($1_$2_WANT_BINDIST_WRAPPER)" "YES"
 
-$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROG)-bindist
+$1_$2_BINDIST_WRAPPER = $1/$2/build/tmp/$$($1_$2_PROGNAME)-bindist
 
 all_$1_$2 : $$($1_$2_BINDIST_WRAPPER)
 
index 7a7142c..d659a5e 100644 (file)
@@ -2,7 +2,7 @@
 utils/compare_sizes_USES_CABAL = YES
 utils/compare_sizes_PACKAGE = compareSizes
 utils/compare_sizes_MODULES = Main
-utils/compare_sizes_dist-install_PROG = compareSizes$(exeext)
+utils/compare_sizes_dist-install_PROGNAME = compareSizes
 utils/compare_sizes_dist-install_INSTALL_INPLACE = NO
 
 $(eval $(call build-prog,utils/compare_sizes,dist-install,1))
index c467413..4f3f43e 100644 (file)
@@ -1,5 +1,5 @@
 
 utils/count_lines_PERL_SRC  = count_lines.lprl
-utils/count_lines_dist_PROG = count_lines
+utils/count_lines_dist_PROGNAME = count_lines
 
 $(eval $(call build-perl,utils/count_lines,dist))
index f181077..525a936 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 utils/deriveConstants_dist_MODULES = DeriveConstants
-utils/deriveConstants_dist_PROG    = deriveConstants$(exeext)
+utils/deriveConstants_dist_PROGNAME = deriveConstants
 utils/deriveConstants_dist_INSTALL_INPLACE = YES
 utils/deriveConstants_HC_OPTS += -package process -package containers
 
index cd42cb4..14b003c 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 utils/genapply_dist_MODULES = GenApply
-utils/genapply_dist_PROG    = genapply$(exeext)
+utils/genapply_dist_PROGNAME = genapply
 utils/genapply_dist_INSTALL_INPLACE = YES
 
 utils/genapply_HC_OPTS += -package pretty
index b4fb6c0..01229ce 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax
-utils/genprimopcode_dist_PROG    = genprimopcode$(exeext)
+utils/genprimopcode_dist_PROGNAME = genprimopcode
 utils/genprimopcode_dist_HC_OPTS = -package array
 utils/genprimopcode_dist_INSTALL_INPLACE = YES
 
index 5835749..c80c4ef 100644 (file)
@@ -57,7 +57,7 @@ $(eval $(call all-target,utils/ghc-cabal,$(ghc-cabal_INPLACE)))
 
 utils/ghc-cabal_USES_CABAL                   = YES
 utils/ghc-cabal_PACKAGE                      = ghc-cabal
-utils/ghc-cabal_dist-install_PROG            = ghc-cabal$(exeext)
+utils/ghc-cabal_dist-install_PROGNAME        = ghc-cabal
 utils/ghc-cabal_dist-install_INSTALL_INPLACE = NO
 utils/ghc-cabal_dist-install_WANT_BINDIST_WRAPPER = YES
 utils/ghc-cabal_dist-install_MODULES         = Main
index 4464ba1..51c3cb4 100644 (file)
@@ -34,14 +34,12 @@ utils/ghc-pkg_dist_SHELL_WRAPPER = YES
 utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
 utils/ghc-pkg_dist_WANT_INSTALLED_WRAPPER = YES
 
-INSTALL_LIBEXECS += utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG)
-
 $(eval $(call shell-wrapper,utils/ghc-pkg,dist))
 
 endif
 
 utils/ghc-pkg_dist_USES_CABAL = YES
-utils/ghc-pkg_dist_PROG = ghc-pkg$(exeext)
+utils/ghc-pkg_dist_PROGNAME = ghc-pkg
 utils/ghc-pkg_dist_SHELL_WRAPPER = YES
 utils/ghc-pkg_dist_INSTALL_INPLACE = YES
 
@@ -59,7 +57,7 @@ ifneq "$(Stage1Only)" "YES"
 
 utils/ghc-pkg_dist-install_USES_CABAL = YES
 
-utils/ghc-pkg_dist-install_PROG = ghc-pkg
+utils/ghc-pkg_dist-install_PROGNAME = ghc-pkg
 utils/ghc-pkg_dist-install_SHELL_WRAPPER = YES
 utils/ghc-pkg_dist-install_INSTALL = YES
 utils/ghc-pkg_dist-install_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion)
index e9c0d4a..ac6bc76 100644 (file)
@@ -3,7 +3,7 @@ utils/ghc-pwd_USES_CABAL = YES
 utils/ghc-pwd_PACKAGE    = ghc-pwd
 utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES
 utils/ghc-pwd_dist-install_WANT_BINDIST_WRAPPER = YES
-utils/ghc-pwd_dist-install_PROG  = ghc-pwd$(exeext)
+utils/ghc-pwd_dist-install_PROGNAME = ghc-pwd
 
 $(eval $(call build-prog,utils/ghc-pwd,dist-install,1))
 
index 949a051..07ab41e 100644 (file)
@@ -12,7 +12,7 @@
 
 utils/ghctags_USES_CABAL                   = YES
 utils/ghctags_PACKAGE                      = ghctags
-utils/ghctags_dist-install_PROG            = ghctags$(exeext)
+utils/ghctags_dist-install_PROGNAME        = ghctags
 utils/ghctags_dist-install_INSTALL         = NO
 utils/ghctags_dist-install_INSTALL_INPLACE = YES
 $(eval $(call build-prog,utils/ghctags,dist-install,2))
index 097f912..00923d3 100644 (file)
@@ -16,7 +16,7 @@ utils/hp2ps_dist_C_SRCS          = AreaBelow.c Curves.c Error.c Main.c \
                                    Axes.c Dimensions.c Key.c PsFile.c Shade.c \
                                    Utilities.c
 utils/hp2ps_dist_EXTRA_LIBRARIES = m
-utils/hp2ps_dist_PROG            = $(CrossCompilePrefix)hp2ps$(exeext)
+utils/hp2ps_dist_PROGNAME        = $(CrossCompilePrefix)hp2ps
 utils/hp2ps_dist_INSTALL         = YES
 utils/hp2ps_dist_INSTALL_INPLACE = YES
 
index 917e099..60c13d4 100644 (file)
@@ -14,5 +14,5 @@ utils/hpc_USES_CABAL                   = YES
 utils/hpc_PACKAGE                      = hpc-bin
 utils/hpc_dist-install_INSTALL         = YES
 utils/hpc_dist-install_INSTALL_INPLACE = YES
-utils/hpc_dist-install_PROG            = hpc$(exeext)
+utils/hpc_dist-install_PROGNAME        = hpc
 $(eval $(call build-prog,utils/hpc,dist-install,1))
index ae305f9..aabe69a 100644 (file)
@@ -12,7 +12,7 @@
 
 utils/mkUserGuidePart_USES_CABAL           = YES
 utils/mkUserGuidePart_PACKAGE              = mkUserGuidePart
-utils/mkUserGuidePart_dist_PROG            = mkUserGuidePart$(exeext)
+utils/mkUserGuidePart_dist_PROGNAME        = mkUserGuidePart
 utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES
 
 $(eval $(call build-prog,utils/mkUserGuidePart,dist,1))
index a181938..cde8102 100644 (file)
@@ -12,7 +12,7 @@
 
 utils/runghc_PACKAGE = runghc
 utils/runghc_dist-install_USES_CABAL = YES
-utils/runghc_dist-install_PROG    = runghc$(exeext)
+utils/runghc_dist-install_PROGNAME = runghc
 utils/runghc_dist-install_SHELL_WRAPPER = YES
 utils/runghc_dist-install_INSTALL = YES
 utils/runghc_dist-install_INSTALL_INPLACE = YES
index 8c316ba..b2911aa 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 utils/touchy_dist_C_SRCS          = touchy.c
-utils/touchy_dist_PROG            = touchy$(exeext)
+utils/touchy_dist_PROGNAME        = touchy
 utils/touchy_dist_TOPDIR          = YES
 utils/touchy_dist_INSTALL         = YES
 utils/touchy_dist_INSTALL_INPLACE = YES
index 597a901..765c969 100644 (file)
@@ -11,7 +11,7 @@
 # -----------------------------------------------------------------------------
 
 utils/unlit_dist_C_SRCS  = unlit.c
-utils/unlit_dist_PROG    = unlit$(exeext)
+utils/unlit_dist_PROGNAME = unlit
 utils/unlit_dist_TOPDIR  = YES
 utils/unlit_dist_INSTALL = YES
 utils/unlit_dist_INSTALL_INPLACE = YES