Merge _stub.o files into the main .o file (Fixes #3687 and #706)
[ghc-hetmet.git] / rules / include-dependencies.mk
1 # -----------------------------------------------------------------------------
2 #
3 # (c) 2009 The University of Glasgow
4 #
5 # This file is part of the GHC build system.
6 #
7 # To understand how the build system works and how to modify it, see
8 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Architecture
9 #      http://hackage.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 define include-dependencies
14 $(call trace, include-dependencies($1,$2,$3))
15 $(call profStart, include-dependencies($1,$2,$3))
16 # $1 = dir
17 # $2 = distdir
18 # $3 = GHC stage to use (0 == bootstrapping compiler)
19
20 $1_$2_INCLUDE_DEPFILES = YES
21 ifeq "$$(NO_INCLUDE_DEPS)" "YES"
22 $1_$2_INCLUDE_DEPFILES = NO
23 endif
24 ifneq "$$(ONLY_DEPS_FOR)" ""
25 ifeq "$$(filter $1_$2,$$(ONLY_DEPS_FOR))" ""
26 $1_$2_INCLUDE_DEPFILES = NO
27 endif
28 endif
29
30 ifeq "$$($1_$2_INCLUDE_DEPFILES)" "YES"
31 ifneq "$$(strip $$($1_$2_HS_SRCS) $$($1_$2_HS_BOOT_SRCS))" ""
32 ifneq "$$(NO_STAGE$3_DEPS)" "YES"
33 include $$($1_$2_depfile_haskell)
34 endif
35 endif
36 include $$($1_$2_depfile_c_asm)
37 else
38 ifeq "$$(DEBUG)" "YES"
39 $$(warning not building dependencies in $1)
40 endif
41 endif
42
43 $(call profEnd, include-dependencies($1,$2,$3))
44 endef
45