summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-09-09 17:02:15 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-18 22:27:20 -0500
commit78d4bca01c1efe481c6ce2356497593d3058fb95 (patch)
tree18896178678a62cecafb5082819e949a12cd6ad0
parent12d023d1b4706665645cc0783dd1ae67625357a3 (diff)
downloadhaskell-78d4bca01c1efe481c6ce2356497593d3058fb95.tar.gz
ghc-cabal, make: Add support for building C++ object code
Co-Authored By: Matthew Pickering <matthew@well-typed.com>
-rw-r--r--ghc.mk1
-rw-r--r--rts/ghc.mk4
-rw-r--r--rules/build-dependencies.mk12
-rw-r--r--rules/build-package-way.mk6
-rw-r--r--rules/build-package.mk6
-rw-r--r--rules/build-prog.mk12
-rw-r--r--rules/c-objs.mk7
-rw-r--r--rules/c-sources.mk1
-rw-r--r--rules/cxx-suffix-rules.mk44
-rw-r--r--utils/ghc-cabal/Main.hs1
10 files changed, 76 insertions, 18 deletions
diff --git a/ghc.mk b/ghc.mk
index 3e561a61dd..8e010a9c6f 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -308,6 +308,7 @@ include rules/hs-suffix-way-rules-srcdir.mk
include rules/hs-suffix-way-rules.mk
include rules/hi-rule.mk
include rules/c-suffix-rules.mk
+include rules/cxx-suffix-rules.mk
include rules/cmm-suffix-rules.mk
endif
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 6da6b2137e..949107a7db 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -199,11 +199,12 @@ rts_$1_LIB_FILE = libHSrts$$($1_libsuf)
rts_$1_LIB = rts/dist-install/build/$$(rts_$1_LIB_FILE)
rts_$1_C_OBJS = $$(patsubst rts/%.c,rts/dist-install/build/%.$$($1_osuf),$$(rts_C_SRCS)) $$(patsubst %.c,%.$$($1_osuf),$$(rts_$1_EXTRA_C_SRCS))
+rts_$1_CXX_OBJS = $$(patsubst rts/%.c,rts/dist-install/build/%.$$($1_osuf),$$(rts_CXX_SRCS))
rts_$1_C_HOOK_OBJS = $$(patsubst rts/hooks/%.c,rts/dist-install/build/hooks/%.$$($1_osuf),$$(rts_C_HOOK_SRCS))
rts_$1_S_OBJS = $$(patsubst rts/%.S,rts/dist-install/build/%.$$($1_osuf),$$(rts_S_SRCS))
rts_$1_CMM_OBJS = $$(patsubst rts/%.cmm,rts/dist-install/build/%.$$($1_osuf),$$(rts_CMM_SRCS)) $$(patsubst %.cmm,%.$$($1_osuf),$$(rts_AUTO_APPLY_CMM))
-rts_$1_OBJS = $$(rts_$1_C_OBJS) $$(rts_$1_S_OBJS) $$(rts_$1_CMM_OBJS)
+rts_$1_OBJS = $$(rts_$1_C_OBJS) $$(rts_$1_CXX_OBJS) $$(rts_$1_S_OBJS) $$(rts_$1_CMM_OBJS)
ifeq "$(USE_DTRACE)" "YES"
ifeq "$(NEED_DTRACE_PROBES_OBJ)" "YES"
@@ -574,6 +575,7 @@ rts_dist-install_C_SRCS = $(rts_C_SRCS) $(rts_thr_EXTRA_C_SRCS)
rts_dist-install_S_SRCS = $(rts_S_SRCS)
rts_dist-install_CMM_SRCS = $(rts_CMM_SRCS)
rts_dist-install_C_FILES = $(rts_dist-install_C_SRCS)
+rts_dist-install_CXX_FILES = $(rts_dist-install_CXX_SRCS)
rts_dist-install_S_FILES = $(rts_dist-install_S_SRCS)
rts_dist-install_CMM_FILES = $(rts_dist-install_CMM_SRCS)
diff --git a/rules/build-dependencies.mk b/rules/build-dependencies.mk
index de580a7379..cc438c80eb 100644
--- a/rules/build-dependencies.mk
+++ b/rules/build-dependencies.mk
@@ -21,6 +21,7 @@ $1_$2_depfile_haskell = $$($1_$2_depfile_base).haskell
$1_$2_depfile_c_asm = $$($1_$2_depfile_base).c_asm
$1_$2_C_FILES_DEPS = $$(filter-out $$($1_$2_C_FILES_NODEPS),$$($1_$2_C_FILES))
+$1_$2_CXX_FILES_DEPS = $$(filter-out $$($1_$2_CXX_FILES_NODEPS),$$($1_$2_CXX_FILES))
$1_$2_MKDEPENDHS_FLAGS = -dep-makefile $$($1_$2_depfile_haskell).tmp $$(foreach way,$$($1_$2_WAYS),-dep-suffix "$$(patsubst %o,%,$$($$(way)_osuf))")
$1_$2_MKDEPENDHS_FLAGS += -include-pkg-deps
@@ -67,15 +68,17 @@ endif
# includes files.
$$($1_$2_depfile_c_asm) : $$(includes_$3_H_CONFIG) $$(includes_$3_H_PLATFORM)
-$$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES) | $$$$(dir $$$$@)/.
+$$($1_$2_depfile_c_asm) : $$($1_$2_C_FILES_DEPS) $$($1_$2_CXX_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES) | $$$$(dir $$$$@)/.
$$(call removeFiles,$$@.tmp)
-ifneq "$$(strip $$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES)) $$($1_$2_CMM_FILES))" ""
+ifneq "$$(strip $$($1_$2_C_FILES_DEPS) $$($1_$2_CXX_FILES_DEPS) $$($1_$2_S_FILES)) $$($1_$2_CMM_FILES))" ""
# We ought to actually do this for each way in $$($1_$2_WAYS), but then
# it takes a long time to make the C deps for the RTS (30 seconds rather
# than 3), so instead we just pass the list of ways in and let addCFileDeps
# copy the deps for each way on the assumption that they are the same
$$(foreach f,$$($1_$2_C_FILES_DEPS) $$($1_$2_S_FILES) $$($1_$2_CMM_FILES), \
- $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS)))
+ $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS),"c"))
+ $$(foreach f,$$($1_$2_CXX_FILES_DEPS), \
+ $$(call addCFileDeps,$1,$2,$$($1_$2_depfile_c_asm),$$f,$$($1_$2_WAYS),"c++"))
$$(call removeFiles,$$@.bit)
endif
echo "$1_$2_depfile_c_asm_EXISTS = YES" >> $$@.tmp
@@ -97,6 +100,7 @@ endef
# $3 = depfile
# $4 = file
# $5 = ways
+# $6 = lang (c or c++)
#
# The formatting of this definition (e.g. the blank line above) is
# important, in order to get make to generate the right makefile code.
@@ -145,7 +149,7 @@ endef
define addCFileDeps
- $(CPP) $($1_$2_MKDEPENDC_OPTS) $($1_$2_$(firstword $($1_$2_WAYS))_ALL_CC_OPTS) $($(basename $4)_CC_OPTS) -MM -x c $4 -MF $3.bit
+ $(CPP) $($1_$2_MKDEPENDC_OPTS) $($1_$2_$(firstword $($1_$2_WAYS))_ALL_CC_OPTS) $($(basename $4)_CC_OPTS) -MM -x $6 $4 -MF $3.bit
$(foreach w,$5,sed -e 's|\\|/|g' -e 's| /$$| \\|' -e "1s|\.o|\.$($w_osuf)|" -e "1s|^|$(dir $4)|" -e "1s|$1/|$1/$2/build/|" -e "1s|$2/build/$2/build|$2/build|g" -e "s|^$(TOP)/||g$(CASE_INSENSITIVE_SED)" $3.bit >> $3.tmp &&) true
endef
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index abc55c80c5..5ac137635e 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -49,7 +49,7 @@ endif
# NB: Use DEP_COMPONENT_IDS for the /directory/ parameter.
$1_$2_$3_DEPS_LIBS=$$(foreach dep,$$($1_$2_DEP_COMPONENT_IDS),$$($$(dep)_$(subst stage2,dist-install,$2)_$3_LIB))
-$1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
+$1_$2_$3_NON_HS_OBJS = $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
$1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS)
ifeq "$3" "dyn"
@@ -116,8 +116,8 @@ ifneq "$4" "0"
BINDIST_LIBS += $$($1_$2_$3_GHCI_LIB)
endif
endif
-$$($1_$2_$3_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) $$($1_$2_LD_SCRIPT)
- $$(call cmd,MERGE_OBJS_STAGE$4) $(MERGE_OBJS_STAGE$4_FLAGS) $$(if $$($1_$2_LD_SCRIPT),$$($1_$2_LD_SCRIPT_CMD) $$($1_$2_LD_SCRIPT)) -o $$@ $$(EXTRA_LD_LINKER_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
+$$($1_$2_$3_GHCI_LIB) : $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS) $$($1_$2_LD_SCRIPT)
+ $$(call cmd,MERGE_OBJS_STAGE$4) $(MERGE_OBJS_STAGE$4_FLAGS) $$(if $$($1_$2_LD_SCRIPT),$$($1_$2_LD_SCRIPT_CMD) $$($1_$2_LD_SCRIPT)) -o $$@ $$(EXTRA_LD_LINKER_OPTS) $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_CMM_OBJS) $$($1_$2_$3_C_OBJS) $$($1_$2_$3_CXX_OBJS) $$($1_$2_$3_S_OBJS) $$($1_$2_EXTRA_OBJS)
ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES"
# Don't bother making ghci libs for bootstrapping packages
ifneq "$4" "0"
diff --git a/rules/build-package.mk b/rules/build-package.mk
index a7d32ac06b..6701746895 100644
--- a/rules/build-package.mk
+++ b/rules/build-package.mk
@@ -112,7 +112,8 @@ $(call dependencies,$1,$2,$3)
# Now generate all the build rules for each way in this directory:
$$(foreach way,$$($1_$2_WAYS),$$(eval \
$$(call c-objs,$1,$2,$$(way)) \
- $$(call c-suffix-rules,$1,$2,$$(way),YES) \
+ $$(call c-suffix-rules,$1,$2,$$(way),YES) \
+ $$(call cxx-suffix-rules,$1,$2,$$(way),YES) \
$$(call cmm-objs,$1,$2,$$(way)) \
$$(call cmm-suffix-rules,$1,$2,$$(way)) \
$$(call build-package-way,$1,$2,$$(way),$3) \
@@ -138,6 +139,9 @@ endif
ifeq "$$(BuildSharedLibs)" "YES"
$(call c-objs,$1,$2,dyn)
$(call c-suffix-rules,$1,$2,dyn,YES)
+$(call cxx-suffix-rules,$1,$2,dyn,YES)
+$(call cmm-objs,$1,$2,dyn)
+$(call cmm-suffix-rules,$1,$2,dyn,YES)
endif
$$(foreach dir,$$($1_$2_HS_SRC_DIRS),\
$$(eval $$(call hs-suffix-rules-srcdir,$1,$2,$$(dir))))
diff --git a/rules/build-prog.mk b/rules/build-prog.mk
index 7973ecd38e..e7764d75a1 100644
--- a/rules/build-prog.mk
+++ b/rules/build-prog.mk
@@ -264,16 +264,16 @@ $1/$2/build/tmp/$$($1_$2_PROG_INPLACE) : $1/$2/build/tmp/$$($1_$2_PROG)-inplace-
$1/$2/build/tmp/$$($1_$2_PROG) : $1/$2/build/tmp/$$($1_$2_PROG)-wrapper.c $1/$2/build/tmp/$$($1_$2_PROG).dll | $$$$(dir $$$$@)/.
$$(call cmd,$1_$2_HC) -no-hs-main -no-auto-link-packages -optc-g -optc-O0 $$< -o $$@
-$1/$2/build/tmp/$$($1_$2_PROG).dll : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
- $$(call build-dll,$1,$2,$$($1_$2_PROGRAM_WAY),,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS),$$@)
+$1/$2/build/tmp/$$($1_$2_PROG).dll : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
+ $$(call build-dll,$1,$2,$$($1_$2_PROGRAM_WAY),,$$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS),$$@)
else # $1_$2_PROG_NEEDS_C_WRAPPER=NO
ifeq "$$($1_$2_LINK_WITH_GCC)" "NO"
-$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
- $$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
+$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
+ $$(call cmd,$1_$2_HC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_HC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_GHC_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
else
-$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
- $$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_CC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
+$1/$2/build/tmp/$$($1_$2_PROG) : $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) | $$$$(dir $$$$@)/.
+ $$(call cmd,$1_$2_CC) -o $$@ $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_CC_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_ALL_LD_OPTS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_HS_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_C_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_CXX_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_S_OBJS) $$($1_$2_OTHER_OBJS) $$($1_$2_$$($1_$2_PROGRAM_WAY)_EXTRA_CC_OPTS) $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES))
endif
endif # $1_$2_PROG_NEEDS_C_WRAPPER
diff --git a/rules/c-objs.mk b/rules/c-objs.mk
index 415998ab60..6b43fb54cd 100644
--- a/rules/c-objs.mk
+++ b/rules/c-objs.mk
@@ -11,7 +11,8 @@
# -----------------------------------------------------------------------------
define c-objs # args: $1 = dir, $2 = distdir, $3 = way
-# C and S files are usually only built for way "v", but sometimes "dyn" too
-$1_$2_$3_C_OBJS = $$(patsubst %.c,$1/$2/build/%.$$($3_osuf),$$($1_$2_C_SRCS))
-$1_$2_$3_S_OBJS = $$(patsubst %.S,$1/$2/build/%.$$($3_osuf),$$($1_$2_S_SRCS))
+# C, C++, and S files are usually only built for way "v", but sometimes "dyn" too
+$1_$2_$3_C_OBJS = $$(patsubst %.c,$1/$2/build/%.$$($3_osuf),$$($1_$2_C_SRCS))
+$1_$2_$3_CXX_OBJS = $$(patsubst %.cpp,$1/$2/build/%.$$($3_osuf),$$($1_$2_CXX_SRCS))
+$1_$2_$3_S_OBJS = $$(patsubst %.S,$1/$2/build/%.$$($3_osuf),$$($1_$2_S_SRCS))
endef
diff --git a/rules/c-sources.mk b/rules/c-sources.mk
index 87ee7b23a5..edc0cdbf04 100644
--- a/rules/c-sources.mk
+++ b/rules/c-sources.mk
@@ -12,6 +12,7 @@
define c-sources # args: $1 = dir, $2 = distdir
$1_$2_C_FILES = $$(patsubst %,$1/%,$$($1_$2_C_SRCS))
+$1_$2_CXX_FILES = $$(patsubst %,$1/%,$$($1_$2_CXX_SRCS))
$1_$2_S_FILES = $$(patsubst %,$1/%,$$($1_$2_S_SRCS))
$1_$2_CMM_FILES = $$(patsubst %,$1/%,$$($1_$2_CMM_SRCS))
endef
diff --git a/rules/cxx-suffix-rules.mk b/rules/cxx-suffix-rules.mk
new file mode 100644
index 0000000000..25b3d5212c
--- /dev/null
+++ b/rules/cxx-suffix-rules.mk
@@ -0,0 +1,44 @@
+# -----------------------------------------------------------------------------
+#
+# (c) 2009 The University of Glasgow
+#
+# This file is part of the GHC build system.
+#
+# To understand how the build system works and how to modify it, see
+# https://gitlab.haskell.org/ghc/ghc/wikis/building/architecture
+# https://gitlab.haskell.org/ghc/ghc/wikis/building/modifying
+#
+# -----------------------------------------------------------------------------
+
+
+define cxx-suffix-rules
+# $1 = dir
+# $2 = distdir
+# $3 = way
+# $4 = use GHC (YES/NO)
+
+ifneq "$$(BINDIST)" "YES"
+
+ifeq "$4" "YES"
+
+$1/$2/build/%.$$($3_osuf) : $1/%.cpp $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
+ $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
+
+$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.cpp $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_DEP)
+ $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
+
+
+else
+
+$1/$2/build/%.$$($3_osuf) : $1/%.cpp | $$$$(dir $$$$@)/.
+ $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
+
+$1/$2/build/%.$$($3_osuf) : $1/$2/build/%.cpp
+ $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
+
+endif
+
+endif
+
+endef
+
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 51378517fc..e6df477238 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -452,6 +452,7 @@ generate directory distdir config_args
variablePrefix ++ "_EXTRA_LIBDIRS = " ++ unwords (extraLibDirs bi),
variablePrefix ++ "_S_SRCS = " ++ unwords (asmSources bi),
variablePrefix ++ "_C_SRCS = " ++ unwords (cSources bi),
+ variablePrefix ++ "_CXX_SRCS = " ++ unwords (cxxSources bi),
variablePrefix ++ "_CMM_SRCS = " ++ unwords (cmmSources bi),
variablePrefix ++ "_DATA_FILES = " ++ unwords (dataFiles pd),
-- XXX This includes things it shouldn't, like: