The DEP_INCLUDE_DIRS and DEP_LIB_DIRS variables always contain
single-quote dirs, so we can use e.g.
$(subst $(space)',$(space)-L',$(space)$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED))
to add -L to the front of each dir. I've appended "_SINGLE_QUOTED" to
the variable names so we don't accidentally add bare directories to
them.
$1_$2_DEP_INCLUDE_DIRS_FLAG = -I
endif
$1_$2_DEP_INCLUDE_DIRS_FLAG = -I
endif
-# We have to do this mangling using the shell, because words may contain
-# spaces and GNU make doesn't have any quoting interpretation.
-ifneq ($$(strip $$($1_$2_DEP_INCLUDE_DIRS)),)
-$1_$2_CC_INC_FLAGS:=$$(shell for i in $$($1_$2_DEP_INCLUDE_DIRS); do echo $$($1_$2_DEP_INCLUDE_DIRS_FLAG)\"$$$$i\"; done)
+ifneq ($$(strip $$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED)),)
+$1_$2_CC_INC_FLAGS := $$(subst $$(space)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_FLAG)',$$(space)$$($1_$2_DEP_INCLUDE_DIRS_SINGLE_QUOTED))
endif
# The CONF_CC_OPTS_STAGE$4 options are what we use to get gcc to
endif
# The CONF_CC_OPTS_STAGE$4 options are what we use to get gcc to
$$($1_$2_CC_INC_FLAGS) \
$$($1_$2_DEP_CC_OPTS)
$$($1_$2_CC_INC_FLAGS) \
$$($1_$2_DEP_CC_OPTS)
-ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS)),)
-$1_$2_DIST_LD_LIB_DIRS:=$$(shell for i in $$($1_$2_DEP_LIB_DIRS); do echo \"-L$$$$i\"; done)
+ifneq ($$(strip $$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED)),)
+$1_$2_DIST_LD_LIB_DIRS := $$(subst $$(space)',$$(space)-L',$$(space)$$($1_$2_DEP_LIB_DIRS_SINGLE_QUOTED))
endif
$1_$2_DIST_LD_OPTS = \
endif
$1_$2_DIST_LD_OPTS = \
variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi),
variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi),
variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi),
variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi),
variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi),
variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi),
- variablePrefix ++ "_DEP_INCLUDE_DIRS = " ++ unwords (wrap $ forDeps Installed.includeDirs),
+ variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords (wrap $ forDeps Installed.includeDirs),
variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions),
variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions),
- variablePrefix ++ "_DEP_LIB_DIRS = " ++ unwords (wrap $ forDeps Installed.libraryDirs),
+ variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords (wrap $ forDeps Installed.libraryDirs),
variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries),
variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions),
variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi),
variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries),
variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions),
variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi),