summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2008-02-21 22:44:49 +0000
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2008-02-21 22:44:49 +0000
commit5b846fa36eee0f96c4c47128706d0131f8bb4113 (patch)
tree1991038fe55b93d063958dfe8fe230b1911f2a28
parent7350aaa60aaf63074202f24208497e2d64ddffb2 (diff)
downloadhaskell-5b846fa36eee0f96c4c47128706d0131f8bb4113.tar.gz
Mac OS X deployment target: piping opts through Makefiles
-rw-r--r--aclocal.m428
-rw-r--r--compiler/Makefile9
-rw-r--r--configure.ac20
-rw-r--r--libraries/Makefile7
-rw-r--r--libraries/Makefile.local10
-rw-r--r--mk/config.mk.in15
-rw-r--r--rts/Makefile5
-rw-r--r--utils/ghc-pkg/Makefile9
-rw-r--r--utils/hasktags/Makefile9
-rw-r--r--utils/hp2ps/Makefile3
-rw-r--r--utils/hpc/Makefile9
-rw-r--r--utils/hsc2hs/Makefile9
-rw-r--r--utils/lndir/Makefile6
-rw-r--r--utils/prof/cgprof/Makefile6
-rw-r--r--utils/pwd/Makefile9
-rw-r--r--utils/runghc/Makefile9
-rw-r--r--utils/unlit/Makefile6
17 files changed, 138 insertions, 31 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index c72d15d9ac..3df243f53a 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1091,31 +1091,31 @@ AC_DEFUN([CHECK_GMP],
AC_REQUIRE([AC_PROG_CC])
])
-# FP_MACOS_DEPLOYMENT_TARGET
-# --------------------------
-AC_DEFUN([FP_MACOS_DEPLOYMENT_TARGET],
+# FP_CHECK_MACOSX_DEPLOYMENT_TARGET
+# ---------------------------------
+AC_DEFUN([FP_CHECK_MACOSX_DEPLOYMENT_TARGET],
[
if test "x$TargetOS_CPP-$TargetVendor_CPP" = "xdarwin-apple"; then
AC_MSG_CHECKING([Mac OS X deployment target])
- case $MACOS_DEPLOYMENT_TARGET in
+ case $FP_MACOSX_DEPLOYMENT_TARGET in
none) ;;
- 10.4) MACOS_DEPLOYMENT_VERSION=10.4
- MACOS_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
+ 10.4) MACOSX_DEPLOYMENT_VERSION=10.4
+ MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
;;
- 10.4u) MACOS_DEPLOYMENT_VERSION=10.4
- MACOS_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
+ 10.4u) MACOSX_DEPLOYMENT_VERSION=10.4
+ MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX10.4u.sdk
;;
- *) MACOS_DEPLOYMENT_VERSION=$MACOS_DEPLOYMENT_TARGET
- MACOS_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX${MACOS_DEPLOYMENT_TARGET}.sdk
+ *) MACOSX_DEPLOYMENT_VERSION=$FP_MACOSX_DEPLOYMENT_TARGET
+ MACOSX_DEPLOYMENT_SDK=/Developer/SDKs/MacOSX${FP_MACOSX_DEPLOYMENT_TARGET}.sdk
;;
esac
- if test "x$MACOS_DEPLOYMENT_TARGET" = "xnone"; then
+ if test "x$FP_MACOSX_DEPLOYMENT_TARGET" = "xnone"; then
AC_MSG_RESULT(none)
else
- if test ! -d $MACOS_DEPLOYMENT_SDK; then
- AC_MSG_ERROR([Unknown deployment target $MACOS_DEPLOYMENT_TARGET])
+ if test ! -d $MACOSX_DEPLOYMENT_SDK; then
+ AC_MSG_ERROR([Unknown deployment target $FP_MACOSX_DEPLOYMENT_TARGET])
fi
- AC_MSG_RESULT([${MACOS_DEPLOYMENT_VERSION} (${MACOS_DEPLOYMENT_SDK})])
+ AC_MSG_RESULT([${MACOSX_DEPLOYMENT_VERSION} (${MACOSX_DEPLOYMENT_SDK})])
fi
fi
])
diff --git a/compiler/Makefile b/compiler/Makefile
index 0095419c4b..cdc8b3c3e4 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -473,6 +473,15 @@ bootstrapped = NO
endif
endif
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifneq "$(findstring $(stage), 2 3)" ""
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# -----------------------------------------------------------------------------
# Building a compiler with interpreter support
#
diff --git a/configure.ac b/configure.ac
index cab4f1902a..cd8b0ff338 100644
--- a/configure.ac
+++ b/configure.ac
@@ -821,20 +821,20 @@ AC_SUBST(DotnetSupport)
dnl ** Mac OS X: explicit deployment target
dnl --------------------------------------------------------------
-AC_ARG_WITH([macos-deployment-target],
-[AC_HELP_STRING([--macos-deployment-target=VERSION],
- [Build for Mac OS VERSION and higher [default= version of build host]])],
-[MACOS_DEPLOYMENT_TARGET="$withval"
+AC_ARG_WITH([macosx-deployment-target],
+[AC_HELP_STRING([--with-macosx-deployment-target=VERSION],
+ [Build for Mac OS VERSION and higher (default= version of build host)])],
+[FP_MACOSX_DEPLOYMENT_TARGET="$withval"
if test "x$TargetOS_CPP-$TargetVendor_CPP" != "xdarwin-apple"; then
# ignore everywhere, but on Mac OS
- AC_MSG_WARN([--macos-deployment-target is only available on Mac OS X])
- MACOS_DEPLOYMENT_TARGET=none
+ AC_MSG_WARN([--macosx-deployment-target is only available on Mac OS X])
+ FP_MACOSX_DEPLOYMENT_TARGET=none
fi],
-[MACOS_DEPLOYMENT_TARGET=none]
+[FP_MACOSX_DEPLOYMENT_TARGET=none]
)
-FP_MACOS_DEPLOYMENT_TARGET
-AC_SUBST(MACOS_DEPLOYMENT_VERSION)
-AC_SUBST(MACOS_DEPLOYMENT_SDK)
+FP_CHECK_MACOSX_DEPLOYMENT_TARGET
+AC_SUBST(MACOSX_DEPLOYMENT_VERSION)
+AC_SUBST(MACOSX_DEPLOYMENT_SDK)
dnl --------------------------------------------------------------
dnl End of configure script option section
diff --git a/libraries/Makefile b/libraries/Makefile
index 9a8cd40749..5af0f7ec83 100644
--- a/libraries/Makefile
+++ b/libraries/Makefile
@@ -143,6 +143,8 @@ BOOTSTRAP_LIBS = Cabal filepath
BOOTSTRAP_STAMPS = $(addprefix stamp/bootstrapping.,$(BOOTSTRAP_LIBS))
BOOTSTRAP_INC_1_UP = -DCABAL_VERSION=1,3 $(addprefix -i../bootstrapping.,$(BOOTSTRAP_LIBS))
BOOTSTRAP_INC_2_UP = -DCABAL_VERSION=1,3 $(addprefix -i../../bootstrapping.,$(BOOTSTRAP_LIBS))
+DEPLOYMENT_OPTS = $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS)) \
+ $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
.PHONY: subdirs
@@ -176,7 +178,7 @@ installPackage/installPackage: installPackage.hs $(BOOTSTRAP_STAMPS)
ifeq "$(stage)" "2"
cd installPackage && ../$(HC) -Wall -cpp \
--make installPackage -o installPackage \
- $(BOOTSTRAP_INC_1_UP)
+ $(BOOTSTRAP_INC_1_UP) $(DEPLOYMENT_OPTS)
else
cd installPackage && $(GHC) -Wall -cpp \
--make installPackage -o installPackage \
@@ -191,7 +193,8 @@ ifBuildable/ifBuildable: ifBuildable.hs
mkdir ifBuildable
$(CP) ifBuildable.hs ifBuildable/
ifeq "$(stage)" "2"
- cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable
+ cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable \
+ $(DEPLOYMENT_OPTS)
else
cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable
endif
diff --git a/libraries/Makefile.local b/libraries/Makefile.local
index e3e1e8f2fb..57dbfefa5d 100644
--- a/libraries/Makefile.local
+++ b/libraries/Makefile.local
@@ -1,5 +1,6 @@
# Local GHC-build-tree customization for Cabal makefiles. We want to build
-# libraries using flags that the user has put in build.mk/validate.mk.
+# libraries using flags that the user has put in build.mk/validate.mk and
+# appropriate flags for Mac OS X deployment targets.
# Careful here: including boilerplate.mk breaks things, because paths.mk and
# opts.mk overrides some of the variable settings in the Cabal Makefile, so
@@ -15,5 +16,8 @@ AR := $(SAVE_AR)
LD := $(SAVE_LD)
# Now add flags from the GHC build system to the Cabal build:
-GHC_OPTS += $(SRC_HC_OPTS)
-GHC_OPTS += $(GhcLibHcOpts)
+GHC_CC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+GHC_OPTS += $(SRC_HC_OPTS)
+GHC_OPTS += $(GhcLibHcOpts)
+GHC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+LIB_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
diff --git a/mk/config.mk.in b/mk/config.mk.in
index da5d957f80..0e0a61301c 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -187,8 +187,19 @@ XMLDocWays=
# Mac OS X deployment target (to cross-compile for older OS versions)
#
-MACOS_DEPLOYMENT_VERSION = @MACOS_DEPLOYMENT_VERSION@
-MACOS_DEPLOYMENT_SDK = @MACOS_DEPLOYMENT_SDK@
+MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
+MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
+
+ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
+MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
+ -isysroot $(MACOSX_DEPLOYMENT_SDK)
+MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
+ -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
+# We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
+# overwritten in build.mk and (b) we must not use the deployment options in
+# stage 1 or we get a linker error if the bootstrap compiler is for a more
+# recent OS version.
+endif
################################################################################
#
diff --git a/rts/Makefile b/rts/Makefile
index db1c31e069..d88a82308b 100644
--- a/rts/Makefile
+++ b/rts/Makefile
@@ -177,6 +177,11 @@ LIB_LD_OPTS = -L$(shell $(GHC_PKG_INPLACE) field base library-dirs | sed -e 's/l
endif
endif
+# Mac OS X: make sure we compile for the right OS version
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+LIB_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+
# XXX DQ is now the same on all platforms, so get rid of it
DQ = \"
diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile
index 383524a6fd..b27a2f1187 100644
--- a/utils/ghc-pkg/Makefile
+++ b/utils/ghc-pkg/Makefile
@@ -4,6 +4,15 @@ include $(TOP)/mk/boilerplate.mk
# -----------------------------------------------------------------------------
# ghc-pkg.bin
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
SRC_HC_OPTS += -cpp -Wall -fno-warn-name-shadowing -fno-warn-unused-matches
# This causes libghccompat.a to be used:
diff --git a/utils/hasktags/Makefile b/utils/hasktags/Makefile
index aa81c13093..20c52ba8d7 100644
--- a/utils/hasktags/Makefile
+++ b/utils/hasktags/Makefile
@@ -1,6 +1,15 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# We have two version: the inplace version compiled by the bootstrap compiler
# and the install version compiled by the stage 1 compiler
ifeq "$(stage)" "2"
diff --git a/utils/hp2ps/Makefile b/utils/hp2ps/Makefile
index 7952bbb961..09c193f1c1 100644
--- a/utils/hp2ps/Makefile
+++ b/utils/hp2ps/Makefile
@@ -1,6 +1,9 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_LD_OPTS += $(MACOSX_DEPLOYMENT_LD_OPTS)
+
C_PROG = hp2ps
SRC_CC_OPTS += -I$(GHC_INCLUDE_DIR) -Wall
diff --git a/utils/hpc/Makefile b/utils/hpc/Makefile
index a59aa091fb..3b1d731050 100644
--- a/utils/hpc/Makefile
+++ b/utils/hpc/Makefile
@@ -1,6 +1,15 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# We have two version: the inplace version compiled by the bootstrap compiler
# and the install version compiled by the stage 1 compiler
ifeq "$(stage)" "2"
diff --git a/utils/hsc2hs/Makefile b/utils/hsc2hs/Makefile
index ca3fcd0220..7518841632 100644
--- a/utils/hsc2hs/Makefile
+++ b/utils/hsc2hs/Makefile
@@ -5,6 +5,15 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# This causes libghccompat.a to be used:
include $(GHC_COMPAT_DIR)/compat.mk
diff --git a/utils/lndir/Makefile b/utils/lndir/Makefile
index c8223df094..4334c0d535 100644
--- a/utils/lndir/Makefile
+++ b/utils/lndir/Makefile
@@ -1,6 +1,12 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Exclude for booting
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_LD_OPTS += $(MACOSX_DEPLOYMENT_LD_OPTS)
+endif
+
C_SRCS=lndir.c
C_PROG=lndir
diff --git a/utils/prof/cgprof/Makefile b/utils/prof/cgprof/Makefile
index bac0ab7d21..acd71e9c54 100644
--- a/utils/prof/cgprof/Makefile
+++ b/utils/prof/cgprof/Makefile
@@ -1,6 +1,12 @@
TOP=../../..
include $(TOP)/mk/boilerplate.mk
+# Exclude for booting
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_LD_OPTS += $(MACOSX_DEPLOYMENT_LD_OPTS)
+endif
+
C_PROG = cgprof
INSTALL_LIBEXECS=$(C_PROG)
diff --git a/utils/pwd/Makefile b/utils/pwd/Makefile
index c753ae889f..0935a64d1d 100644
--- a/utils/pwd/Makefile
+++ b/utils/pwd/Makefile
@@ -1,6 +1,15 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# We have two version: the inplace version compiled by the bootstrap compiler
# and the install version compiled by the stage 1 compiler
ifeq "$(stage)" "2"
diff --git a/utils/runghc/Makefile b/utils/runghc/Makefile
index 654ffad6dc..ef55c320a0 100644
--- a/utils/runghc/Makefile
+++ b/utils/runghc/Makefile
@@ -1,6 +1,15 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Beyond stage 1, honour any Mac OS X depolyment target options. If we use
+# these options in stage 1 we get a linker error if the bootstrap compiler is
+# for a more recent OS version
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
+SRC_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
+endif
+
# We have two version: the inplace version compiled by the bootstrap compiler
# and the install version compiled by the stage 1 compiler
ifeq "$(stage)" "2"
diff --git a/utils/unlit/Makefile b/utils/unlit/Makefile
index dfa1b8db60..6323129511 100644
--- a/utils/unlit/Makefile
+++ b/utils/unlit/Makefile
@@ -1,6 +1,12 @@
TOP=../..
include $(TOP)/mk/boilerplate.mk
+# Exclude for booting
+ifeq "$(stage)" "2"
+SRC_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
+SRC_LD_OPTS += $(MACOSX_DEPLOYMENT_LD_OPTS)
+endif
+
C_SRCS=unlit.c
C_PROG=unlit
SRC_CC_OPTS += -O