Pass -v0 to ghc-pkg to reduce noise in build ouput
[ghc.git] / rules / build-package-data.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://ghc.haskell.org/trac/ghc/wiki/Building/Architecture
9 # http://ghc.haskell.org/trac/ghc/wiki/Building/Modifying
10 #
11 # -----------------------------------------------------------------------------
12
13 define build-package-data
14 $(call trace, build-package-data($1,$2,$3))
15 $(call profStart, build-package-data($1,$2,$3))
16 # args:
17 # $1 = dir
18 # $2 = distdir
19 # $3 = GHC stage to use (0 == bootstrapping compiler)
20
21 ifeq "$(V)" "0"
22 $1_$2_CONFIGURE_OPTS += -v0 --configure-option=--quiet
23
24 # Cabal always passes --with-compiler and --with-gcc to library configure
25 # scripts, resulting in the following useless (for us) warning in the logs:
26 # "configure: WARNING: unrecognized options: --with-compiler, --with-gcc"
27 $1_$2_CONFIGURE_OPTS += --configure-option=--disable-option-checking
28
29 $1_$2_GHC_PKG_OPTS += -v0
30 endif
31
32 $1_$2_CONFIGURE_OPTS += --disable-library-for-ghci
33 ifeq "$$(filter v,$$($1_$2_WAYS))" "v"
34 $1_$2_CONFIGURE_OPTS += --enable-library-vanilla
35 ifeq "$$(GhcWithInterpreter)" "YES"
36 ifneq "$$(DYNAMIC_GHC_PROGRAMS)" "YES"
37 $1_$2_CONFIGURE_OPTS += --enable-library-for-ghci
38 endif
39 endif
40 else
41 $1_$2_CONFIGURE_OPTS += --disable-library-vanilla
42 endif
43
44 ifeq "$$(filter p,$$($1_$2_WAYS))" "p"
45 $1_$2_CONFIGURE_OPTS += --enable-library-profiling
46 else
47 $1_$2_CONFIGURE_OPTS += --disable-library-profiling
48 endif
49
50 ifeq "$$(filter dyn,$$($1_$2_WAYS))" "dyn"
51 $1_$2_CONFIGURE_OPTS += --enable-shared
52 else
53 $1_$2_CONFIGURE_OPTS += --disable-shared
54 endif
55
56 ifeq "$$(HSCOLOUR_SRCS)" "YES"
57 $1_$2_CONFIGURE_OPTS += --with-hscolour="$$(HSCOLOUR_CMD)"
58 endif
59
60 # We filter out -Werror from SRC_CC_OPTS, because when configure tests
61 # for a feature it may not generate warning-free C code, and thus may
62 # think that the feature doesn't exist if -Werror is on.
63 $1_$2_CONFIGURE_CFLAGS = $$(filter-out -Werror,$$(SRC_CC_OPTS)) $$(CONF_CC_OPTS_STAGE$3) $$($1_CC_OPTS) $$($1_$2_CC_OPTS) $$(SRC_CC_WARNING_OPTS)
64 $1_$2_CONFIGURE_LDFLAGS = $$(SRC_LD_OPTS) $$($1_LD_OPTS) $$($1_$2_LD_OPTS)
65 $1_$2_CONFIGURE_CPPFLAGS = $$(SRC_CPP_OPTS) $$(CONF_CPP_OPTS_STAGE$3) $$($1_CPP_OPTS) $$($1_$2_CPP_OPTS)
66
67 $1_$2_CONFIGURE_OPTS += --configure-option=CFLAGS="$$($1_$2_CONFIGURE_CFLAGS)"
68 $1_$2_CONFIGURE_OPTS += --configure-option=LDFLAGS="$$($1_$2_CONFIGURE_LDFLAGS)"
69 $1_$2_CONFIGURE_OPTS += --configure-option=CPPFLAGS="$$($1_$2_CONFIGURE_CPPFLAGS)"
70
71 # Also pass these as gcc-options, because Cabal uses them to check for
72 # the existence of foreign libraries.
73 $1_$2_CONFIGURE_OPTS += --gcc-options="$$($1_$2_CONFIGURE_CFLAGS) $$($1_$2_CONFIGURE_LDFLAGS)"
74
75 ifneq "$$(ICONV_INCLUDE_DIRS)" ""
76 $1_$2_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="$$(ICONV_INCLUDE_DIRS)"
77 endif
78
79 ifneq "$$(ICONV_LIB_DIRS)" ""
80 $1_$2_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="$$(ICONV_LIB_DIRS)"
81 endif
82
83 ifneq "$$(GMP_INCLUDE_DIRS)" ""
84 $1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="$$(GMP_INCLUDE_DIRS)"
85 endif
86
87 ifneq "$$(GMP_LIB_DIRS)" ""
88 $1_$2_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="$$(GMP_LIB_DIRS)"
89 endif
90
91 ifneq "$$(CURSES_INCLUDE_DIRS)" ""
92 $1_$2_CONFIGURE_OPTS += --configure-option=--with-curses-includes="$$(CURSES_INCLUDE_DIRS)"
93 endif
94
95 ifneq "$$(CURSES_LIB_DIRS)" ""
96 $1_$2_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="$$(CURSES_LIB_DIRS)"
97 endif
98
99 ifeq "$$(CrossCompiling)" "YES"
100 $1_$2_CONFIGURE_OPTS += --configure-option=--host=$(TargetPlatformFull)
101 endif
102
103 ifeq "$3" "0"
104 $1_$2_CONFIGURE_OPTS += $$(BOOT_PKG_CONSTRAINTS)
105 endif
106
107 $1_$2_CONFIGURE_OPTS += --with-gcc="$$(CC_STAGE$3)"
108 $1_$2_CONFIGURE_OPTS += --with-ld="$$(LD_STAGE$3)"
109 $1_$2_CONFIGURE_OPTS += --with-ar="$$(AR_STAGE$3)"
110 $1_$2_CONFIGURE_OPTS += $$(if $$(ALEX),--with-alex="$$(ALEX)")
111 $1_$2_CONFIGURE_OPTS += $$(if $$(HAPPY),--with-happy="$$(HAPPY)")
112
113 ifneq "$$(BINDIST)" "YES"
114 ifneq "$$(NO_GENERATED_MAKEFILE_RULES)" "YES"
115 $1/$2/inplace-pkg-config : $1/$2/package-data.mk
116 $1/$2/build/$$(or $$($1_EXECUTABLE),$$($1_$2_PROGNAME),.)/autogen/cabal_macros.h : $1/$2/package-data.mk
117
118 # This rule configures the package, generates the package-data.mk file
119 # for our build system, and registers the package for use in-place in
120 # the build tree.
121 $1/$2/package-data.mk : $$$$(ghc-cabal_INPLACE) $$($1_$2_GHC_PKG_DEP) $1/$$($1_PACKAGE).cabal $$(wildcard $1/configure) $$(LAX_DEPS_FOLLOW) $$$$($1_$2_HC_CONFIG_DEP)
122 # Checking packages built with the bootstrapping compiler would
123 # generally be a waste of time. Either we will rebuild them with
124 # stage1/stage2, or we don't really care about them.
125 ifneq "$3" "0"
126 ifneq "$$($1_NO_CHECK)" "YES"
127 "$$(ghc-cabal_INPLACE)" check $1
128 endif
129 endif
130 "$$(ghc-cabal_INPLACE)" configure $1 $2 "$$($1_$2_dll0_MODULES)" --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS)
131 ifeq "$$($1_$2_PROG)" ""
132 $$(call cmd,$1_$2_GHC_PKG) update -v0 --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config
133 endif
134 endif # NO_GENERATED_MAKEFILE_RULES
135 endif # BINDIST
136
137 PACKAGE_DATA_MKS += $1/$2/package-data.mk
138
139 $(call profEnd, build-package-data($1,$2,$3))
140 endef