Make pkgdepend ignore GCC runtime libraries in /usr/lib and /usr/lib/$(MACH64) if...
[unleashed-userland.git] / make-rules / configure.mk
blob0c9bfc603c6d154052b5b669d5ea4e3e2b1718b3
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
21 # Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
22 # Copyright 2011 EveryCity Ltd. All rights reserved.
26 # Rules and Macros for building opens source software that uses configure /
27 # GNU auto* tools to configure their build for the system they are on. This
28 # uses GNU Make to build the components to take advantage of the viewpath
29 # support and build multiple version (32/64 bit) from a shared source.
31 # To use these rules, include ../make-rules/configure.mk in your Makefile
32 # and define "build", "install", and "test" targets appropriate to building
33 # your component.
34 # Ex:
36 # build: $(SOURCE_DIR)/build/$(MACH32)/.built \
37 # $(SOURCE_DIR)/build/$(MACH64)/.built
39 # install: $(SOURCE_DIR)/build/$(MACH32)/.installed \
40 # $(SOURCE_DIR)/build/$(MACH64)/.installed
42 # test: $(SOURCE_DIR)/build/$(MACH32)/.tested \
43 # $(SOURCE_DIR)/build/$(MACH64)/.tested
45 # Any additional pre/post configure, build, or install actions can be specified
46 # in your make file by setting them in on of the following macros:
47 # COMPONENT_PRE_CONFIGURE_ACTION, COMPONENT_POST_CONFIGURE_ACTION
48 # COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
49 # COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
50 # COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
52 # If component specific make targets need to be used for build or install, they
53 # can be specified in
54 # COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
55 # COMPONENT_TEST_TARGETS
58 CONFIGURE_PREFIX = /usr
60 CONFIGURE_BINDIR.32 = $(CONFIGURE_PREFIX)/bin
61 CONFIGURE_BINDIR.64 = $(CONFIGURE_PREFIX)/bin/$(MACH64)
62 CONFIGURE_LIBDIR.32 = $(CONFIGURE_PREFIX)/lib
63 CONFIGURE_LIBDIR.64 = $(CONFIGURE_PREFIX)/lib/$(MACH64)
64 CONFIGURE_SBINDIR.32 = $(CONFIGURE_PREFIX)/sbin
65 CONFIGURE_SBINDIR.64 = $(CONFIGURE_PREFIX)/sbin/$(MACH64)
66 CONFIGURE_MANDIR = $(CONFIGURE_PREFIX)/share/man
67 CONFIGURE_LOCALEDIR = $(CONFIGURE_PREFIX)/share/locale
68 # all texinfo documentation seems to go to /usr/share/info no matter what
69 CONFIGURE_INFODIR = /usr/share/info
70 CONFIGURE_INCLUDEDIR = /usr/include
72 CONFIGURE_ENV = CC="$(CC)"
73 CONFIGURE_ENV += CXX="$(CXX)"
74 CONFIGURE_ENV += F77="$(F77)"
75 CONFIGURE_ENV += FC="$(FC)"
76 CONFIGURE_ENV += CFLAGS="$(CFLAGS)"
77 CONFIGURE_ENV += CXXFLAGS="$(CXXFLAGS)"
78 CONFIGURE_ENV += FFLAGS="$(F77FLAGS)"
79 CONFIGURE_ENV += FCFLAGS="$(FCFLAGS)"
80 CONFIGURE_ENV += LDFLAGS="$(LDFLAGS)"
81 CONFIGURE_ENV += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
83 # Rewrite absolute source-code paths into relative for ccache, so that any
84 # workspace with a shared CCACHE_DIR can benefit when compiling a component
85 ifneq ($(strip $(CCACHE)),)
86 CONFIGURE_ENV += CCACHE="$(CCACHE)"
87 CONFIGURE_OPTIONS += CCACHE="$(CCACHE)"
88 CONFIGURE_ENV += CC_gcc_32="$(CC_gcc_32)"
89 CONFIGURE_ENV += CC_gcc_64="$(CC_gcc_32)"
90 CONFIGURE_ENV += CXX_gcc_32="$(CXX_gcc_64)"
91 CONFIGURE_ENV += CXX_gcc_64="$(CXX_gcc_64)"
92 CONFIGURE_OPTIONS += CC_gcc_32="$(CC_gcc_32)"
93 CONFIGURE_OPTIONS += CC_gcc_64="$(CC_gcc_32)"
94 CONFIGURE_OPTIONS += CXX_gcc_32="$(CXX_gcc_64)"
95 CONFIGURE_OPTIONS += CXX_gcc_64="$(CXX_gcc_64)"
96 CONFIGURE_ENV.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
97 CONFIGURE_OPTIONS.$(BITS) += CCACHE_BASEDIR="$(BUILD_DIR_$(BITS))"
99 ifneq ($(strip $(CCACHE_DIR)),)
100 CONFIGURE_ENV += CCACHE_DIR="$(CCACHE_DIR)"
101 CONFIGURE_OPTIONS += CCACHE_DIR="$(CCACHE_DIR)"
102 endif
104 ifneq ($(strip $(CCACHE_LOGFILE)),)
105 CONFIGURE_ENV += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
106 CONFIGURE_OPTIONS += CCACHE_LOGFILE="$(CCACHE_LOGFILE)"
107 endif
109 endif
111 CONFIGURE_DEFAULT_DIRS?=yes
113 CONFIGURE_OPTIONS += CC="$(CC)"
114 CONFIGURE_OPTIONS += CXX="$(CXX)"
115 CONFIGURE_OPTIONS += F77="$(F77)"
116 CONFIGURE_OPTIONS += FC="$(FC)"
117 CONFIGURE_OPTIONS += CFLAGS="$(CFLAGS)"
118 CONFIGURE_OPTIONS += CXXFLAGS="$(CXXFLAGS)"
119 CONFIGURE_OPTIONS += FFLAGS="$(F77FLAGS)"
120 CONFIGURE_OPTIONS += FCFLAGS="$(FCFLAGS)"
121 CONFIGURE_OPTIONS += LDFLAGS="$(LDFLAGS)"
122 CONFIGURE_OPTIONS += PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"
124 CONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX)
125 ifeq ($(CONFIGURE_DEFAULT_DIRS),yes)
126 CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
127 CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
128 CONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS))
129 CONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS))
130 endif
131 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
133 COMPONENT_INSTALL_ARGS += DESTDIR=$(PROTO_DIR)
135 $(BUILD_DIR_32)/.configured: BITS=32
136 $(BUILD_DIR_64)/.configured: BITS=64
138 CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
139 ifeq ($(strip $(PARFAIT_BUILD)),yes)
140 # parfait creates '*.bc' files which can confuse configure's
141 # object/exe extension detection. which we really don't need it
142 # to do anyway, so we'll just tell it what they are.
143 CONFIGURE_ENV += ac_cv_objext=o
144 CONFIGURE_ENV += ac_cv_exeext=""
145 # this is fixed in the clang compiler but we can't use it yet
146 CONFIGURE_ENV += ac_cv_header_stdbool_h=yes
147 endif
150 # temporarily work around some issues
151 CONFIGURE_ENV += "ac_cv_func_realloc_0_nonnull=yes"
152 COMPONENT_BUILD_ENV += "ac_cv_func_realloc_0_nonnull=yes"
154 # configure the unpacked source for building 32 and 64 bit version
155 CONFIGURE_SCRIPT = $(SOURCE_DIR)/configure
156 $(BUILD_DIR)/%/.configured: $(SOURCE_DIR)/.prep
157 ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
158 $(COMPONENT_PRE_CONFIGURE_ACTION)
159 (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) \
160 $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS))
161 $(COMPONENT_POST_CONFIGURE_ACTION)
162 $(TOUCH) $@
164 # build the configured source
165 $(BUILD_DIR)/%/.built: $(BUILD_DIR)/%/.configured
166 $(COMPONENT_PRE_BUILD_ACTION)
167 (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
168 $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \
169 $(COMPONENT_BUILD_TARGETS))
170 $(COMPONENT_POST_BUILD_ACTION)
171 ifeq ($(strip $(PARFAIT_BUILD)),yes)
172 -$(PARFAIT) build
173 endif
174 $(TOUCH) $@
176 # install the built source into a prototype area
177 $(BUILD_DIR)/%/.installed: $(BUILD_DIR)/%/.built
178 $(COMPONENT_PRE_INSTALL_ACTION)
179 (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \
180 $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS))
181 $(COMPONENT_POST_INSTALL_ACTION)
182 $(TOUCH) $@
184 # test the built source
185 $(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
186 $(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
187 $(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
188 $(COMPONENT_PRE_TEST_ACTION)
189 -(cd $(COMPONENT_TEST_DIR) ; \
190 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
191 $(COMPONENT_TEST_CMD) \
192 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
193 &> $(COMPONENT_TEST_OUTPUT)
194 $(COMPONENT_POST_TEST_ACTION)
195 $(COMPONENT_TEST_CREATE_TRANSFORMS)
196 $(COMPONENT_TEST_PERFORM_TRANSFORM)
197 $(COMPONENT_TEST_COMPARE)
198 $(COMPONENT_TEST_CLEANUP)
199 $(TOUCH) $@
201 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
202 $(COMPONENT_PRE_TEST_ACTION)
203 (cd $(COMPONENT_TEST_DIR) ; \
204 $(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
205 $(COMPONENT_TEST_CMD) \
206 $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
207 $(COMPONENT_POST_TEST_ACTION)
208 $(COMPONENT_TEST_CLEANUP)
209 $(TOUCH) $@
211 ifeq ($(strip $(PARFAIT_BUILD)),yes)
212 parfait: install
213 -$(PARFAIT) build
214 else
215 parfait:
216 $(MAKE) PARFAIT_BUILD=yes parfait
217 endif
219 clean::
220 $(RM) -r $(BUILD_DIR) $(PROTO_DIR)