2 # Set compilation flags that depend on a particular directory/distdir
4 define distdir-opts # args: $1 = dir, $2 = distdir
5 # $3 = GHC stage to use (0 == bootstrapping compiler)
8 # This is a bit of a hack.
9 # If we are compiling something with the bootstrapping compiler on
10 # cygwin, and it uses an include file from the rts (say), then we
11 # need to stop mkdependC from generating a dependincy on
12 # c:/ghc/rts/include/Rts.h
13 # as that confuses make. So we use -isystem instead of -I, which stops
14 # these dependencies from being generated. Technically this is wrong if
15 # we depend on a library that is built inside the build tree, and we
16 # use headers from that library, but currently I don't think that's the
18 $1_$2_DEP_INCLUDE_DIRS_FLAG = -isystem
20 $1_$2_DEP_INCLUDE_DIRS_FLAG = -I
23 $1_$2_BUILD_CC_OPTS = \
26 $$(foreach dir,$$($1_$2_INCLUDE_DIRS),-I$1/$$(dir)) \
29 $$(foreach dir,$$($1_$2_DEP_INCLUDE_DIRS),$$($1_$2_DEP_INCLUDE_DIRS_FLAG)$$(dir)) \
32 $1_$2_BUILD_LD_OPTS = \
36 $$(foreach opt,$$($1_$2_DEP_LIB_DIRS),-L$$(opt)) \
37 $$(foreach opt,$$($1_$2_DEP_EXTRA_LIBS),-l$$(opt)) \
40 # c.f. Cabal's Distribution.Simple.GHC.ghcOptions
41 $1_$2_BUILD_HC_OPTS = \
44 $$($1_$2_HC_PKGCONF) \
45 $$(if $$($1_$2_PROG),, \
46 $$(if $$($1_PACKAGE),-package-name $$($1_PACKAGE)-$$($1_$2_VERSION))) \
47 $$(if $$($1_PACKAGE),-hide-all-packages) \
48 -i $$(if $$($1_$2_HS_SRC_DIRS),$$(foreach dir,$$($1_$2_HS_SRC_DIRS),-i$1/$$(dir)),-i$1) \
49 -i$1/$2/build -i$1/$2/build/autogen \
50 -I$1/$2/build -I$1/$2/build/autogen \
51 $$(foreach dir,$$($1_$2_INCLUDE_DIRS),-I$1/$$(dir)) \
52 $$(foreach inc,$$($1_$2_INCLUDE),-\#include "$$(inc)") \
53 $$(foreach opt,$$($1_$2_CPP_OPTS),-optP$$(opt)) \
54 $$(if $$($1_PACKAGE),-optP-include -optP$1/$2/build/autogen/cabal_macros.h) \
55 $$(foreach pkg,$$($1_$2_DEPS),-package $$(pkg)) \
56 $$(if $$(findstring YES,$$($1_$2_SplitObjs)),-split-objs,) \