Build fix
[ghc.git] / rules / c-suffix-rules.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
14 define c-suffix-rules
15 # $1 = dir
16 # $2 = distdir
17 # $3 = way
18 # $4 = use GHC (YES/NO)
19
20 ifneq "$$(BINDIST)" "YES"
21
22 # UseGhcForCc is only relevant when not booting from HC files.
23 ifeq "$4 $$(BootingFromHc)" "YES NO"
24
25 $1/$2/build/%.$$($3_osuf) : $1/%.c $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
26 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
27
28 $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP)
29 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
30
31 $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)s $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP)
32 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
33
34 $1/$2/build/%.$$($3_osuf) : $1/%.S $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP) | $$$$(dir $$$$@)/.
35 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -c $$< -o $$@
36
37 $1/$2/build/%.$$($3_way_)s : $1/$2/build/%.c $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP)
38 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -S $$< -o $$@
39
40 $1/$2/build/%.$$($3_way_)s : $1/%.c $$(LAX_DEPS_FOLLOW) $$($1_$2_HC_DEP)
41 $$(call cmd,$1_$2_HC) $$($1_$2_$3_GHC_CC_OPTS) -S $$< -o $$@
42
43 else
44
45 $1/$2/build/%.$$($3_osuf) : $1/%.c | $$$$(dir $$$$@)/.
46 $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
47
48 $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.c
49 $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
50
51 $1/$2/build/%.$$($3_osuf) : $1/$2/build/%.$$($3_way_)s
52 $$(call cmd,$1_$2_AS) $$($1_$2_$3_ALL_AS_OPTS) -o $$@ $$<
53
54 $1/$2/build/%.$$($3_osuf) : $1/%.S | $$$$(dir $$$$@)/.
55 $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -c $$< -o $$@
56
57 $1/$2/build/%.$$($3_way_)s : $1/$2/build/%.c
58 $$(call cmd,$1_$2_CC) $$($1_$2_$3_ALL_CC_OPTS) -S $$< -o $$@
59
60 endif
61
62 endif
63
64 endef
65