Commit 898cb090 authored by ian@well-typed.com's avatar ian@well-typed.com

Build the dynamic way by default on Linux/amd64

This required various build system changes to get the build to go
through.

In the inplace shell wrappers, we set LD_LIBRARY_PATH to allow programs
to find their libraries. In the future, we might change the inplace tree
to be the same shape as an installed tree instead. However, this would
mean changing the way we do installation, as currently we use cabal's
installation methods to install the libraries, but that only works if
the libraries are under libraries/foo/dist-install/build/..., rather
than in inplace/lib/...
parent 58eaacc9
...@@ -1676,9 +1676,10 @@ linkBinary dflags o_files dep_packages = do ...@@ -1676,9 +1676,10 @@ linkBinary dflags o_files dep_packages = do
then "$ORIGIN" </> then "$ORIGIN" </>
(l `makeRelativeTo` full_output_fn) (l `makeRelativeTo` full_output_fn)
else l else l
in ["-L" ++ l, rpath = if dopt Opt_RPath dflags
"-Wl,-rpath", "-Wl," ++ libpath, then ["-Wl,-rpath", "-Wl," ++ libpath]
"-Wl,-rpath-link", "-Wl," ++ l] else []
in ["-L" ++ l, "-Wl,-rpath-link", "-Wl," ++ l] ++ rpath
| otherwise = ["-L" ++ l] | otherwise = ["-L" ++ l]
let lib_paths = libraryPaths dflags let lib_paths = libraryPaths dflags
......
...@@ -339,6 +339,7 @@ data DynFlag ...@@ -339,6 +339,7 @@ data DynFlag
| Opt_SccProfilingOn | Opt_SccProfilingOn
| Opt_Ticky | Opt_Ticky
| Opt_Static | Opt_Static
| Opt_RPath
| Opt_RelativeDynlibPaths | Opt_RelativeDynlibPaths
| Opt_Hpc | Opt_Hpc
...@@ -1160,7 +1161,7 @@ defaultDynFlags mySettings = ...@@ -1160,7 +1161,7 @@ defaultDynFlags mySettings =
dirsToClean = panic "defaultDynFlags: No dirsToClean", dirsToClean = panic "defaultDynFlags: No dirsToClean",
generatedDumps = panic "defaultDynFlags: No generatedDumps", generatedDumps = panic "defaultDynFlags: No generatedDumps",
haddockOptions = Nothing, haddockOptions = Nothing,
flags = IntSet.fromList (map fromEnum (defaultFlags (sTargetPlatform mySettings))), flags = IntSet.fromList (map fromEnum (defaultFlags mySettings)),
warningFlags = IntSet.fromList (map fromEnum standardWarnings), warningFlags = IntSet.fromList (map fromEnum standardWarnings),
ghciScripts = [], ghciScripts = [],
language = Nothing, language = Nothing,
...@@ -2273,7 +2274,8 @@ fFlags = [ ...@@ -2273,7 +2274,8 @@ fFlags = [
( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ), ( "implicit-import-qualified", Opt_ImplicitImportQualified, nop ),
( "prof-count-entries", Opt_ProfCountEntries, nop ), ( "prof-count-entries", Opt_ProfCountEntries, nop ),
( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ), ( "prof-cafs", Opt_AutoSccsOnIndividualCafs, nop ),
( "hpc", Opt_Hpc, nop ) ( "hpc", Opt_Hpc, nop ),
( "use-rpaths", Opt_RPath, nop )
] ]
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@ -- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
...@@ -2438,10 +2440,9 @@ xFlags = [ ...@@ -2438,10 +2440,9 @@ xFlags = [
( "PackageImports", Opt_PackageImports, nop ) ( "PackageImports", Opt_PackageImports, nop )
] ]
defaultFlags :: Platform -> [DynFlag] defaultFlags :: Settings -> [DynFlag]
defaultFlags platform defaultFlags settings
= [ Opt_AutoLinkPackages, = [ Opt_AutoLinkPackages,
Opt_Static,
Opt_SharedImplib, Opt_SharedImplib,
...@@ -2453,7 +2454,8 @@ defaultFlags platform ...@@ -2453,7 +2454,8 @@ defaultFlags platform
Opt_GhciSandbox, Opt_GhciSandbox,
Opt_GhciHistory, Opt_GhciHistory,
Opt_HelpfulErrors, Opt_HelpfulErrors,
Opt_ProfCountEntries Opt_ProfCountEntries,
Opt_RPath
] ]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns] ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
...@@ -2466,6 +2468,12 @@ defaultFlags platform ...@@ -2466,6 +2468,12 @@ defaultFlags platform
_ -> [] _ -> []
_ -> []) _ -> [])
++ (if pc_dYNAMIC_BY_DEFAULT (sPlatformConstants settings)
then []
else [Opt_Static])
where platform = sTargetPlatform settings
impliedFlags :: [(ExtensionFlag, TurnOnFlag, ExtensionFlag)] impliedFlags :: [(ExtensionFlag, TurnOnFlag, ExtensionFlag)]
impliedFlags impliedFlags
= [ (Opt_RankNTypes, turnOn, Opt_ExplicitForAll) = [ (Opt_RankNTypes, turnOn, Opt_ExplicitForAll)
......
...@@ -18,7 +18,7 @@ dnl-------------------------------------------------------------------- ...@@ -18,7 +18,7 @@ dnl--------------------------------------------------------------------
FP_GMP FP_GMP
bootstrap_target=`ghc/stage2/build/tmp/ghc-stage2 +RTS --info | grep '^ ,("Target platform"' | sed -e 's/.*, "//' -e 's/")//' | tr -d '\r'` bootstrap_target=@TargetPlatform@
FPTOOLS_SET_PLATFORM_VARS FPTOOLS_SET_PLATFORM_VARS
BuildingCrossCompiler=NO BuildingCrossCompiler=NO
......
...@@ -801,30 +801,36 @@ ifeq "$(HADDOCK_DOCS)" "YES" ...@@ -801,30 +801,36 @@ ifeq "$(HADDOCK_DOCS)" "YES"
install: install_docs install: install_docs
endif endif
install_bins: $(INSTALL_BINS) define installLibsTo
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)") # $1 = libraries to install
for i in $(INSTALL_BINS); do \ # $2 = directory to install to
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \ $(call INSTALL_DIR,$2)
done for i in $1; do \
install_libs: $(INSTALL_LIBS)
$(call INSTALL_DIR,"$(DESTDIR)$(ghclibdir)")
for i in $(INSTALL_LIBS); do \
case $$i in \ case $$i in \
*.a) \ *.a) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \ $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
$(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \ $(RANLIB) $(DESTDIR)$(ghclibdir)/`basename $$i` ;; \
*.dll) \ *.dll) \
$(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ; \ $(call INSTALL_PROGRAM,$(INSTALL_OPTS),$$i,$2) ; \
$(STRIP_CMD) "$(DESTDIR)$(ghclibdir)"/$$i ;; \ $$(STRIP_CMD) $2/$$i ;; \
*.so) \ *.so) \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)") ;; \ $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2) ;; \
*.dylib) \ *.dylib) \
$(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)");; \ $(call INSTALL_SHLIB,$(INSTALL_OPTS),$$i,$2);; \
*) \ *) \
$(call INSTALL_DATA,$(INSTALL_OPTS),$$i,"$(DESTDIR)$(ghclibdir)"); \ $(call INSTALL_DATA,$(INSTALL_OPTS),$$i,$2); \
esac; \ esac; \
done done
endef
install_bins: $(INSTALL_BINS)
$(call INSTALL_DIR,"$(DESTDIR)$(bindir)")
for i in $(INSTALL_BINS); do \
$(call INSTALL_PROGRAM,$(INSTALL_BIN_OPTS),$$i,"$(DESTDIR)$(bindir)") ; \
done
install_libs: $(INSTALL_LIBS)
$(call installLibsTo, $(INSTALL_LIBS), "$(DESTDIR)$(ghclibdir)")
install_libexecs: $(INSTALL_LIBEXECS) install_libexecs: $(INSTALL_LIBEXECS)
ifeq "$(INSTALL_LIBEXECS)" "" ifeq "$(INSTALL_LIBEXECS)" ""
...@@ -904,14 +910,29 @@ install_packages: rts/package.conf.install ...@@ -904,14 +910,29 @@ install_packages: rts/package.conf.install
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)") $(call INSTALL_DIR,"$(DESTDIR)$(topdir)")
$(call removeTrees,"$(INSTALLED_PACKAGE_CONF)") $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)") $(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)")
$(call INSTALL_DIR,"$(DESTDIR)$(topdir)/rts-1.0")
$(call installLibsTo, $(RTS_INSTALL_LIBS), "$(DESTDIR)$(topdir)/rts-1.0")
ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
$(foreach p, $(PKGS_THAT_ARE_INTREE_ONLY), \
$(call installLibsTo, $(wildcard libraries/$p/dist-install/build/*.so libraries/$p/dist-install/build/*.dll libraries/$p/dist-install/build/*.dylib), "$(DESTDIR)$(topdir)/$p-$(libraries/$p_dist-install_VERSION)"))
endif
$(foreach p, $(INSTALLED_PKG_DIRS), \
$(call make-command, \
CROSS_COMPILE="$(CrossCompilePrefix)" \
"$(GHC_CABAL_INPLACE)" copy \
"$(STRIP_CMD)" \
$p $(INSTALL_DISTDIR_$p) \
'$(DESTDIR)' \
'$(prefix)' \
'$(ghclibdir)' \
'$(docdir)/html/libraries'))
"$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install
$(foreach p, $(INSTALLED_PKG_DIRS), \ $(foreach p, $(INSTALLED_PKG_DIRS), \
$(call make-command, \ $(call make-command, \
CROSS_COMPILE="$(CrossCompilePrefix)" \ CROSS_COMPILE="$(CrossCompilePrefix)" \
"$(GHC_CABAL_INPLACE)" install \ "$(GHC_CABAL_INPLACE)" register \
"$(INSTALLED_GHC_REAL)" \ "$(INSTALLED_GHC_REAL)" \
"$(INSTALLED_GHC_PKG_REAL)" \ "$(INSTALLED_GHC_PKG_REAL)" \
"$(STRIP_CMD)" \
"$(DESTDIR)$(topdir)" \ "$(DESTDIR)$(topdir)" \
$p $(INSTALL_DISTDIR_$p) \ $p $(INSTALL_DISTDIR_$p) \
'$(DESTDIR)' \ '$(DESTDIR)' \
...@@ -967,6 +988,7 @@ $(eval $(call bindist,.,\ ...@@ -967,6 +988,7 @@ $(eval $(call bindist,.,\
$(wildcard libraries/*/dist-install/doc/) \ $(wildcard libraries/*/dist-install/doc/) \
$(wildcard libraries/*/*/dist-install/doc/) \ $(wildcard libraries/*/*/dist-install/doc/) \
$(filter-out settings,$(INSTALL_LIBS)) \ $(filter-out settings,$(INSTALL_LIBS)) \
$(RTS_INSTALL_LIBS) \
$(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \ $(filter-out %/project.mk mk/config.mk %/mk/install.mk,$(MAKEFILE_LIST)) \
mk/project.mk \ mk/project.mk \
mk/install.mk.in \ mk/install.mk.in \
......
...@@ -77,6 +77,9 @@ ghc_stage3_SHELL_WRAPPER = YES ...@@ -77,6 +77,9 @@ ghc_stage3_SHELL_WRAPPER = YES
ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper ghc_stage1_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper ghc_stage2_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper ghc_stage3_SHELL_WRAPPER_NAME = ghc/ghc.wrapper
ghc_stage1_INSTALL_INPLACE = YES
ghc_stage2_INSTALL_INPLACE = YES
ghc_stage3_INSTALL_INPLACE = YES
ghc_stage$(INSTALL_GHC_STAGE)_INSTALL = YES ghc_stage$(INSTALL_GHC_STAGE)_INSTALL = YES
ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion) ghc_stage$(INSTALL_GHC_STAGE)_INSTALL_SHELL_WRAPPER_NAME = ghc-$(ProjectVersion)
......
...@@ -44,6 +44,10 @@ ifneq "$(GhcWithSMP)" "YES" ...@@ -44,6 +44,10 @@ ifneq "$(GhcWithSMP)" "YES"
includes_CC_OPTS += -DNOSMP includes_CC_OPTS += -DNOSMP
endif endif
ifeq "$(DYNAMIC_BY_DEFAULT)" "YES"
includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT
endif
ifneq "$(BINDIST)" "YES" ifneq "$(BINDIST)" "YES"
ifeq "$(PORTING_HOST)" "YES" ifeq "$(PORTING_HOST)" "YES"
...@@ -148,6 +152,7 @@ else ...@@ -148,6 +152,7 @@ else
includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c includes_dist-derivedconstants_C_SRCS = mkDerivedConstants.c
includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext) includes_dist-derivedconstants_PROG = mkDerivedConstants$(exeext)
includes_dist-derivedconstants_INSTALL_INPLACE = YES
$(eval $(call build-prog,includes,dist-derivedconstants,0)) $(eval $(call build-prog,includes,dist-derivedconstants,0))
......
...@@ -776,6 +776,14 @@ main(int argc, char *argv[]) ...@@ -776,6 +776,14 @@ main(int argc, char *argv[])
#endif #endif
); );
constantBool("dYNAMIC_BY_DEFAULT",
#ifdef DYNAMIC_BY_DEFAULT
1
#else
0
#endif
);
constantInt("lDV_SHIFT", LDV_SHIFT); constantInt("lDV_SHIFT", LDV_SHIFT);
constantInteger("iLDV_CREATE_MASK", LDV_CREATE_MASK); constantInteger("iLDV_CREATE_MASK", LDV_CREATE_MASK);
constantInteger("iLDV_STATE_CREATE", LDV_STATE_CREATE); constantInteger("iLDV_STATE_CREATE", LDV_STATE_CREATE);
......
...@@ -129,6 +129,12 @@ endif ...@@ -129,6 +129,12 @@ endif
PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\ PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\
$(SharedLibsPlatformList)),YES,NO) $(SharedLibsPlatformList)),YES,NO)
SharedLibsByDefaultPlatformList = \
x86_64-unknown-linux
DYNAMIC_BY_DEFAULT = $(if $(filter $(TARGETPLATFORM),\
$(SharedLibsByDefaultPlatformList)),YES,NO)
# Build a compiler that will build *unregisterised* libraries and # Build a compiler that will build *unregisterised* libraries and
# binaries by default. Unregisterised code is supposed to compile and # binaries by default. Unregisterised code is supposed to compile and
# run without any support for architecture-specific assembly mangling, # run without any support for architecture-specific assembly mangling,
......
...@@ -26,8 +26,13 @@ GhcStage2HcOpts += -O -fwarn-tabs -dcore-lint ...@@ -26,8 +26,13 @@ GhcStage2HcOpts += -O -fwarn-tabs -dcore-lint
# running of the tests, and faster building of the utils to be installed # running of the tests, and faster building of the utils to be installed
GhcLibHcOpts += -O -dcore-lint GhcLibHcOpts += -O -dcore-lint
# We define DefaultFastGhcLibWays in this style so that the value is
# correct even if the user alters DYNAMIC_BY_DEFAULT
DefaultFastGhcLibWays = $(if $(filter $(DYNAMIC_BY_DEFAULT),YES),v dyn,v)
ifeq "$(ValidateSpeed)" "FAST" ifeq "$(ValidateSpeed)" "FAST"
GhcLibWays := v GhcLibWays = $(DefaultFastGhcLibWays)
else else
GhcLibWays := $(filter v dyn,$(GhcLibWays)) GhcLibWays := $(filter v dyn,$(GhcLibWays))
endif endif
......
...@@ -508,9 +508,9 @@ endif ...@@ -508,9 +508,9 @@ endif
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# installing # installing
INSTALL_LIBS += $(ALL_RTS_LIBS) RTS_INSTALL_LIBS += $(ALL_RTS_LIBS)
INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*) RTS_INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL)) RTS_INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL))
install: install_libffi_headers install: install_libffi_headers
......
...@@ -16,7 +16,7 @@ hidden-modules: ...@@ -16,7 +16,7 @@ hidden-modules:
import-dirs: import-dirs:
#ifdef INSTALLING #ifdef INSTALLING
library-dirs: LIB_DIR PAPI_LIB_DIR library-dirs: LIB_DIR"/rts-1.0" PAPI_LIB_DIR
#else /* !INSTALLING */ #else /* !INSTALLING */
library-dirs: TOP"/rts/dist/build" PAPI_LIB_DIR library-dirs: TOP"/rts/dist/build" PAPI_LIB_DIR
#endif #endif
......
...@@ -115,6 +115,13 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \ ...@@ -115,6 +115,13 @@ $$(foreach way,$$($1_$2_WAYS),$$(eval \
$$(call build-package-way,$1,$2,$$(way),$3) \ $$(call build-package-way,$1,$2,$$(way),$3) \
)) ))
# Programs will need to depend on either the vanilla lib (if -static
# is the default) or the dyn lib (if -dynamic is the default). We
# conservatively make them depend on both, to keep things simple.
# If dyn libs are not being built then $$($1_$2_dyn_LIB) will just
# expand to the empty string, and be ignored.
$1_$2_PROGRAM_DEP_LIB = $$($1_$2_v_LIB) $$($1_$2_dyn_LIB)
# C and S files are possibly built the "dyn" way. # C and S files are possibly built the "dyn" way.
ifeq "$$(BuildSharedLibs)" "YES" ifeq "$$(BuildSharedLibs)" "YES"
$(call c-objs,$1,$2,dyn) $(call c-objs,$1,$2,dyn)
......
...@@ -54,6 +54,26 @@ ifeq "$$($1_USES_CABAL)" "YES" ...@@ -54,6 +54,26 @@ ifeq "$$($1_USES_CABAL)" "YES"
$1_$2_USES_CABAL = YES $1_$2_USES_CABAL = YES
endif endif
ifeq "$$(Windows)" "YES"
$1_$2_WANT_INPLACE_WRAPPER = NO
else ifneq "$$($1_$2_INSTALL_INPLACE)" "YES"
$1_$2_WANT_INPLACE_WRAPPER = NO
else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$1_$2_WANT_INPLACE_WRAPPER = YES
else
$1_$2_WANT_INPLACE_WRAPPER = NO
endif
ifeq "$$(Windows)" "YES"
$1_$2_WANT_INSTALLED_WRAPPER = NO
else ifneq "$$($1_$2_INSTALL)" "YES"
$1_$2_WANT_INSTALLED_WRAPPER = NO
else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$1_$2_WANT_INSTALLED_WRAPPER = YES
else
$1_$2_WANT_INSTALLED_WRAPPER = NO
endif
$(call package-config,$1,$2,$3) $(call package-config,$1,$2,$3)
$1_$2_depfile_base = $1/$2/build/.depend $1_$2_depfile_base = $1/$2/build/.depend
...@@ -66,7 +86,7 @@ $1_$2_INPLACE = ...@@ -66,7 +86,7 @@ $1_$2_INPLACE =
endif endif
else else
# Where do we install the inplace version? # Where do we install the inplace version?
ifeq "$$($1_$2_SHELL_WRAPPER) $$(Windows)" "YES NO" ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
$1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG) $1_$2_INPLACE = $$(INPLACE_LIB)/bin/$$($1_$2_PROG)
else else
ifeq "$$($1_$2_TOPDIR)" "YES" ifeq "$$($1_$2_TOPDIR)" "YES"
...@@ -93,7 +113,7 @@ $(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG)) ...@@ -93,7 +113,7 @@ $(call all-target,$1_$2,$1/$2/build/tmp/$$($1_$2_PROG))
# INPLACE_BIN might be empty if we're distcleaning # INPLACE_BIN might be empty if we're distcleaning
ifeq "$(findstring clean,$(MAKECMDGOALS))" "" ifeq "$(findstring clean,$(MAKECMDGOALS))" ""
ifneq "$$($1_$2_INSTALL_INPLACE)" "NO" ifeq "$$($1_$2_INSTALL_INPLACE)" "YES"
$$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/. $$($1_$2_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG) | $$$$(dir $$$$@)/.
"$$(CP)" -p $$< $$@ "$$(CP)" -p $$< $$@
endif endif
...@@ -142,17 +162,25 @@ ifeq "$$($1_$2_v_HS_OBJS)" "" ...@@ -142,17 +162,25 @@ ifeq "$$($1_$2_v_HS_OBJS)" ""
$1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main $1_$2_GHC_LD_OPTS = -no-auto-link-packages -no-hs-main
endif endif
ifneq "$3" "0"
ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
$1_$2_GHC_LD_OPTS = \
-fno-use-rpaths \
$$(addprefix -optl-Wl$$(comma)-rpath -optl-Wl$$(comma),$$($1_$2_RPATHS))
endif
endif
ifneq "$$(BINDIST)" "YES" ifneq "$$(BINDIST)" "YES"
# The quadrupled $'s here are because the _v_LIB variables aren't # The quadrupled $'s here are because the _v_LIB variables aren't
# necessarily set when this part of the makefile is read # necessarily set when this part of the makefile is read
$1/$2/build/tmp/$$($1_$2_PROG) : \ $1/$2/build/tmp/$$($1_$2_PROG) : \
$$(foreach dep,$$($1_$2_DEP_NAMES),\ $$(foreach dep,$$($1_$2_DEP_NAMES),\
$$(if $$(filter ghc,$$(dep)),\ $$(if $$(filter ghc,$$(dep)),\
$(if $(filter 0,$3),$$(compiler_stage1_v_LIB),\ $(if $(filter 0,$3),$$(compiler_stage1_PROGRAM_DEP_LIB),\
$(if $(filter 1,$3),$$(compiler_stage2_v_LIB),\ $(if $(filter 1,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
$(if $(filter 2,$3),$$(compiler_stage2_v_LIB),\ $(if $(filter 2,$3),$$(compiler_stage2_PROGRAM_DEP_LIB),\
$$(error Bad build stage)))),\ $$(error Bad build stage)))),\
$$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_v_LIB))) $$$$(libraries/$$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)))
ifeq "$$($1_$2_LINK_WITH_GCC)" "NO" ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/. $1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_v_HS_OBJS) $$($1_$2_v_C_OBJS) $$($1_$2_v_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
......
...@@ -16,56 +16,43 @@ $(call profStart, shell-wrapper($1,$2)) ...@@ -16,56 +16,43 @@ $(call profStart, shell-wrapper($1,$2))
# $1 = dir # $1 = dir
# $2 = distdir # $2 = distdir
ifeq "$$(Windows)" "YES" ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" ""
$1_$2_WANT_INPLACE_WRAPPER = NO $1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper
else ifeq "$$($1_$2_INSTALL_INPLACE)" "NO"
$1_$2_WANT_INPLACE_WRAPPER = NO
else ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
# We need to set LD_LIBRARY_PATH for all programs, so always need
# a shell wrapper
$1_$2_WANT_INPLACE_WRAPPER = YES
else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$1_$2_WANT_INPLACE_WRAPPER = YES
else
$1_$2_WANT_INPLACE_WRAPPER = NO
endif
ifeq "$$(Windows)" "YES"
$1_$2_WANT_INSTALLED_WRAPPER = NO
else ifeq "$$($1_$2_INSTALL)" "NO"
$1_$2_WANT_INSTALLED_WRAPPER = NO
else ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$1_$2_WANT_INSTALLED_WRAPPER = YES
else
$1_$2_WANT_INSTALLED_WRAPPER = NO
endif endif
ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES" ifeq "$$($1_$2_WANT_INPLACE_WRAPPER)" "YES"
ifeq "$$($1_$2_SHELL_WRAPPER_NAME)" "" ifeq "$$($1_$2_TOPDIR)" "YES"
$1_$2_SHELL_WRAPPER_NAME = $1/$$($1_$2_PROG).wrapper INPLACE_WRAPPER = $$(INPLACE_LIB)/$$($1_$2_PROG)
else
INPLACE_WRAPPER = $$(INPLACE_BIN)/$$($1_$2_PROG)
endif endif
all_$1_$2 : $$(INPLACE_BIN)/$$($1_$2_PROG) all_$1_$2 : $$(INPLACE_WRAPPER)
$$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@ $$(INPLACE_BIN)/$$($1_$2_PROG): WRAPPER=$$@
$$(INPLACE_BIN)/$$($1_$2_PROG): $$($1_$2_INPLACE) $$($1_$2_SHELL_WRAPPER_NAME) ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
$$(call removeFiles, $$@) $$(INPLACE_WRAPPER): $$($1_$2_SHELL_WRAPPER_NAME)
echo '#!$$(SHELL)' >> $$@ endif
echo 'executablename="$$(TOP)/$$<"' >> $$@ $$(INPLACE_WRAPPER): $$($1_$2_INPLACE)
echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@ $$(call removeFiles, $$@)
echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@ echo '#!$$(SHELL)' >> $$@
echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@ echo 'executablename="$$(TOP)/$$<"' >> $$@
echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@ echo 'datadir="$$(TOP)/$$(INPLACE_LIB)"' >> $$@
echo 'bindir="$$(TOP)/$$(INPLACE_BIN)"' >> $$@
echo 'topdir="$$(TOP)/$$(INPLACE_TOPDIR)"' >> $$@
echo 'pgmgcc="$$(WhatGccIsCalled)"' >> $$@
$$($1_$2_SHELL_WRAPPER_EXTRA) $$($1_$2_SHELL_WRAPPER_EXTRA)
$$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA) $$($1_$2_INPLACE_SHELL_WRAPPER_EXTRA)
ifeq "$$(DYNAMIC_BY_DEFAULT)" "YES"
echo 'export LD_LIBRARY_PATH="$$($1_$2_DEP_LIB_DIRS_SEARCHPATH)"' >> $$@
endif
ifeq "$$($1_$2_SHELL_WRAPPER)" "YES" ifeq "$$($1_$2_SHELL_WRAPPER)" "YES"
cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@ cat $$($1_$2_SHELL_WRAPPER_NAME) >> $$@
else else
echo 'exec "$executablename" $$$${1+"$$$$@"}' >> $$@ echo 'exec "$$$$executablename" $$$${1+"$$$$@"}' >> $$@
endif endif
$$(EXECUTABLE_FILE) $$@ $$(EXECUTABLE_FILE) $$@
endif endif
......
...@@ -3,6 +3,7 @@ utils/compare_sizes_USES_CABAL = YES ...@@ -3,6 +3,7 @@ utils/compare_sizes_USES_CABAL = YES
utils/compare_sizes_PACKAGE = compareSizes utils/compare_sizes_PACKAGE = compareSizes
utils/compare_sizes_MODULES = Main utils/compare_sizes_MODULES = Main
utils/compare_sizes_dist-install_PROG = compareSizes$(exeext) utils/compare_sizes_dist-install_PROG = compareSizes$(exeext)
utils/compare_sizes_dist-install_INSTALL_INPLACE = NO
$(eval $(call build-prog,utils/compare_sizes,dist-install,1)) $(eval $(call build-prog,utils/compare_sizes,dist-install,1))
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
utils/genapply_dist_MODULES = GenApply utils/genapply_dist_MODULES = GenApply
utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM) utils/genapply_dist_PROG = $(GHC_GENAPPLY_PGM)
utils/genapply_dist_INSTALL_INPLACE = YES
utils/genapply_HC_OPTS += -package pretty utils/genapply_HC_OPTS += -package pretty
......
...@@ -13,5 +13,6 @@ ...@@ -13,5 +13,6 @@
utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax utils/genprimopcode_dist_MODULES = Lexer Main ParserM Parser Syntax
utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM) utils/genprimopcode_dist_PROG = $(GHC_GENPRIMOP_PGM)
utils/genprimopcode_dist_HC_OPTS = -package array utils/genprimopcode_dist_HC_OPTS = -package array
utils/genprimopcode_dist_INSTALL_INPLACE = YES
$(eval $(call build-prog,utils/genprimopcode,dist,0)) $(eval $(call build-prog,utils/genprimopcode,dist,0))
This diff is collapsed.
...@@ -55,6 +55,7 @@ $(GHC_CABAL_DIR)_PACKAGE = ghc-cabal ...@@ -55,6 +55,7 @@ $(GHC_CABAL_DIR)_PACKAGE = ghc-cabal
$(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext) $(GHC_CABAL_DIR)_dist-install_PROG = ghc-cabal$(exeext)
$(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO $(GHC_CABAL_DIR)_dist-install_INSTALL_INPLACE = NO
$(GHC_CABAL_DIR)_dist-install_MODULES = Main $(GHC_CABAL_DIR)_dist-install_MODULES = Main
$(GHC_CABAL_DIR)_dist-install_MORE_HC_OPTS = -static
$(eval $(call build-prog,utils/ghc-cabal,dist-install,1)) $(eval $(call build-prog,utils/ghc-cabal,dist-install,1))
utils/ghc-pwd_USES_CABAL = YES utils/ghc-pwd_USES_CABAL = YES
utils/ghc-pwd_PACKAGE = ghc-pwd utils/ghc-pwd_PACKAGE = ghc-pwd
utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES
utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext) utils/ghc-pwd_dist-install_PROG = ghc-pwd$(exeext)
utils/ghc-pwd_dist-install_MORE_HC_OPTS += -static
$(eval $(call build-prog,utils/ghc-pwd,dist-install,1)) $(eval $(call build-prog,utils/ghc-pwd,dist-install,1))
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
utils/ghctags_dist-install_MODULES = Main utils/ghctags_dist-install_MODULES = Main
utils/ghctags_dist-install_HC_OPTS = -package ghc utils/ghctags_dist-install_HC_OPTS = -package ghc
utils/ghctags_dist-install_INSTALL = NO utils/ghctags_dist-install_INSTALL = NO
utils/ghctags_dist-install_PROG = ghctags$(exeext) utils/ghctags_dist-install_INSTALL_INPLACE = YES
utils/ghctags_dist-install_PROG = ghctags$(exeext)
$(eval $(call build-prog,utils/ghctags,dist-install,2)) $(eval $(call build-prog,utils/ghctags,dist-install,2))
...@@ -10,14 +10,15 @@ ...@@ -10,14 +10,15 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
Reorder.c TopTwenty.c AuxFile.c Deviation.c \ Reorder.c TopTwenty.c AuxFile.c Deviation.c \
HpFile.c Marks.c Scale.c TraceElement.c \ HpFile.c Marks.c Scale.c TraceElement.c \
Axes.c Dimensions.c Key.c PsFile.c Shade.c \ Axes.c Dimensions.c Key.c PsFile.c Shade.c \
Utilities.c Utilities.c
utils/hp2ps_dist_EXTRA_LIBRARIES = m utils/hp2ps_dist_EXTRA_LIBRARIES = m
utils/hp2ps_dist_PROG = hp2ps$(exeext) utils/hp2ps_dist_PROG = hp2ps$(exeext)
utils/hp2ps_dist_INSTALL = YES utils/hp2ps_dist_INSTALL = YES
utils/hp2ps_dist_INSTALL_INPLACE = YES
utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
utils/hpc_dist-install_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer \ utils/hpc_dist-install_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer \
HpcMarkup HpcOverlay HpcParser HpcReport \ HpcMarkup HpcOverlay HpcParser HpcReport \
HpcShowTix HpcUtils HpcShowTix HpcUtils
utils/hpc_dist-install_HC_OPTS = -cpp -package hpc utils/hpc_dist-install_HC_OPTS = -cpp -package hpc
utils/hpc_dist-install_INSTALL = YES utils/hpc_dist-install_INSTALL = YES
utils/hpc_dist-install_PROG = hpc$(exeext) utils/hpc_dist-install_INSTALL_INPLACE = YES
utils/hpc_dist-install_PROG = hpc$(exeext)
$(eval $(call build-prog,utils/hpc,dist-install,1)) $(eval $(call build-prog,utils/hpc,dist-install,1))
...@@ -10,10 +10,11 @@ ...@@ -10,10 +10,11 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
utils/mkUserGuidePart_dist_MODULES = Main utils/mkUserGuidePart_dist_MODULES = Main
utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext) utils/mkUserGuidePart_dist_PROG = mkUserGuidePart$(exeext)
utils/mkUserGuidePart_HC_OPTS = -package ghc utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES
utils/mkUserGuidePart_HC_OPTS = -package ghc -static
utils/mkUserGuidePart/dist/build/Main.o: $(ALL_STAGE1_LIBS) $(compiler_stage2_v_LIB)