Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Refactor how dependencies are included; fixes #5109

This avoids duplicating some logic around the build system.
  • Loading branch information...
commit ae587ec8ab4dd8414d629d3629dec0cc44b37aa7 1 parent 9eebc6d
igfoo authored April 14, 2011
1  ghc.mk
@@ -227,6 +227,7 @@ include rules/package-config.mk
227 227
 # -----------------------------------------------------------------------------
228 228
 # Building dependencies
229 229
 
  230
+include rules/dependencies.mk
230 231
 include rules/build-dependencies.mk
231 232
 include rules/include-dependencies.mk
232 233
 
3  rts/ghc.mk
@@ -456,8 +456,7 @@ rts_dist_MKDEPENDC_OPTS += -Irts/dist/build
456 456
 
457 457
 endif
458 458
 
459  
-$(eval $(call build-dependencies,rts,dist,1))
460  
-$(eval $(call include-dependencies,rts,dist,1))
  459
+$(eval $(call dependencies,rts,dist,1))
461 460
 
462 461
 $(rts_dist_depfile_c_asm) : libffi/dist-install/build/ffi.h $(DTRACEPROBES_H)
463 462
 
16  rules/build-package.mk
@@ -100,21 +100,7 @@ $(call hs-sources,$1,$2)
100 100
 $(call c-sources,$1,$2)
101 101
 $(call includes-sources,$1,$2)
102 102
 
103  
-# --- DEPENDENCIES
104  
-# We always have the dependency rules available, as we need to know
105  
-# how to build hsc2hs's dependency file in phase 0
106  
-$(call build-dependencies,$1,$2,$3)
107  
-ifneq "$(phase)" "0"
108  
-# From phase 1 we actually include the dependency files for the
109  
-# bootstrapping stuff
110  
-ifeq "$3" "0"
111  
-$(call include-dependencies,$1,$2,$3)
112  
-else ifeq "$(phase)" "final"
113  
-# In the final phase, we also include the dependency files for
114  
-# everything else
115  
-$(call include-dependencies,$1,$2,$3)
116  
-endif
117  
-endif
  103
+$(call dependencies,$1,$2,$3)
118 104
 
119 105
 # Now generate all the build rules for each way in this directory:
120 106
 $$(foreach way,$$($1_$2_WAYS),$$(eval \
16  rules/build-prog.mk
@@ -188,20 +188,6 @@ INSTALL_BINS += $1/$2/build/tmp/$$($1_$2_PROG)
188 188
 endif
189 189
 endif
190 190
 
191  
-# --- DEPENDENCIES
192  
-# We always have the dependency rules available, as we need to know
193  
-# how to build hsc2hs's dependency file in phase 0
194  
-$(call build-dependencies,$1,$2,$3)
195  
-ifneq "$(phase)" "0"
196  
-# From phase 1 we actually include the dependency files for the
197  
-# bootstrapping stuff
198  
-ifeq "$3" "0"
199  
-$(call include-dependencies,$1,$2,$3)
200  
-else ifeq "$(phase)" "final"
201  
-# In the final phase, we also include the dependency files for
202  
-# everything else
203  
-$(call include-dependencies,$1,$2,$3)
204  
-endif
205  
-endif
  191
+$(call dependencies,$1,$2,$3)
206 192
 
207 193
 endef
38  rules/dependencies.mk
... ...
@@ -0,0 +1,38 @@
  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 dependencies
  14
+$(call trace, dependencies($1,$2,$3))
  15
+$(call profStart, dependencies($1,$2,$3))
  16
+# $1 = dir
  17
+# $2 = distdir
  18
+# $3 = GHC stage to use (0 == bootstrapping compiler)
  19
+
  20
+# We always have the dependency rules available, as we need to know
  21
+# how to build hsc2hs's dependency file in phase 0
  22
+$(call build-dependencies,$1,$2,$3)
  23
+
  24
+ifneq "$(phase)" "0"
  25
+# From phase 1 we actually include the dependency files for the
  26
+# bootstrapping stuff
  27
+ifeq "$3" "0"
  28
+$(call include-dependencies,$1,$2,$3)
  29
+else ifeq "$(phase)" "final"
  30
+# In the final phase, we also include the dependency files for
  31
+# everything else
  32
+$(call include-dependencies,$1,$2,$3)
  33
+endif
  34
+endif
  35
+
  36
+$(call profEnd, dependencies($1,$2,$3))
  37
+endef
  38
+

0 notes on commit ae587ec

Please sign in to comment.
Something went wrong with that request. Please try again.