Commit 5b846fa3 authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

Mac OS X deployment target: piping opts through Makefiles

parent 7350aaa6
......@@ -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
])
......
......@@ -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
#
......
......@@ -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
......
......@@ -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
......
# 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))
......@@ -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
################################################################################
#
......
......@@ -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 = \"
......
......@@ -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:
......
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"
......
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
......
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"
......
......@@ -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
......
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
......
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)
......
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"
......
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"
......
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment