David Höppner
2013-07-09 c991222c610ed20fff303eb7193bf6a847438e70
commit | author | age
9c75c0 1 #
NJ 2 # CDDL HEADER START
3 #
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.
7 #
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.
12 #
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]
18 #
19 # CDDL HEADER END
20 #
b74d96 21 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
c99122 22 # Copyright 2011 EveryCity Ltd. All rights reserved.
9c75c0 23 #
NJ 24
25 #
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.
30 #
31 # To use these rules, include ../make-rules/configure.mk in your Makefile
3a19d0 32 # and define "build", "install", and "test" targets appropriate to building
MT 33 # your component.
9c75c0 34 # Ex:
NJ 35 #
74300c 36 #     build:        $(SOURCE_DIR)/build/$(MACH32)/.built \
NJ 37 #             $(SOURCE_DIR)/build/$(MACH64)/.built
3a19d0 38 #
74300c 39 #    install:    $(SOURCE_DIR)/build/$(MACH32)/.installed \
NJ 40 #             $(SOURCE_DIR)/build/$(MACH64)/.installed
3a19d0 41 #
MT 42 #    test:        $(SOURCE_DIR)/build/$(MACH32)/.tested \
43 #             $(SOURCE_DIR)/build/$(MACH64)/.tested
9c75c0 44 #
NJ 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
3a19d0 50 #    COMPONENT_PRE_TEST_ACTION, COMPONENT_POST_TEST_ACTION
9c75c0 51 #
NJ 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
3a19d0 55 #    COMPONENT_TEST_TARGETS
9c75c0 56 #
NJ 57
4b89a1 58 CONFIGURE_PREFIX =    /usr
NJ 59
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)
9dfd18 64 CONFIGURE_SBINDIR.32 =    $(CONFIGURE_PREFIX)/sbin
NJ 65 CONFIGURE_SBINDIR.64 =    $(CONFIGURE_PREFIX)/sbin/$(MACH64)
4b89a1 66 CONFIGURE_MANDIR =    $(CONFIGURE_PREFIX)/share/man
NJ 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
f0c88f 70 CONFIGURE_INCLUDEDIR =    /usr/include
4b89a1 71
aeb6c4 72 CONFIGURE_ENV = CONFIG_SHELL="$(CONFIG_SHELL)"
NJ 73
312c03 74 CONFIGURE_DEFAULT_DIRS?=yes
PS 75
011d27 76 CONFIGURE_OPTIONS += CC="$(CC)"
3cec7d 77 CONFIGURE_OPTIONS += CXX="$(CXX)"
4b89a1 78 CONFIGURE_OPTIONS += --prefix=$(CONFIGURE_PREFIX)
312c03 79 ifeq ($(CONFIGURE_DEFAULT_DIRS),yes)
4b89a1 80 CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
NJ 81 CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
82 CONFIGURE_OPTIONS += --libdir=$(CONFIGURE_LIBDIR.$(BITS))
9dfd18 83 CONFIGURE_OPTIONS += --sbindir=$(CONFIGURE_SBINDIR.$(BITS))
312c03 84 endif
e83e52 85 CONFIGURE_OPTIONS += $(CONFIGURE_OPTIONS.$(BITS))
4b89a1 86
NJ 87 COMPONENT_INSTALL_ARGS +=    DESTDIR=$(PROTO_DIR)
9c75c0 88
4158c0 89 $(BUILD_DIR_32)/.configured:    BITS=32
NJ 90 $(BUILD_DIR_64)/.configured:    BITS=64
9c75c0 91
e83e52 92 CONFIGURE_ENV += $(CONFIGURE_ENV.$(BITS))
7999b2 93 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
MS 94 # parfait creates '*.bc' files which can confuse configure's
95 # object/exe extension detection. which we really don't need it
96 # to do anyway, so we'll just tell it what they are.
97 CONFIGURE_ENV += ac_cv_objext=o
98 CONFIGURE_ENV += ac_cv_exeext=""
99 # this is fixed in the clang compiler but we can't use it yet
100 CONFIGURE_ENV += ac_cv_header_stdbool_h=yes
101 endif
102
9c75c0 103
b74d96 104 # temporarily work around some issues
MS 105 CONFIGURE_ENV += "ac_cv_func_realloc_0_nonnull=yes"
106 COMPONENT_BUILD_ENV += "ac_cv_func_realloc_0_nonnull=yes"
107
9c75c0 108 # configure the unpacked source for building 32 and 64 bit version
9dfd18 109 CONFIGURE_SCRIPT =    $(SOURCE_DIR)/configure
74300c 110 $(BUILD_DIR)/%/.configured:    $(SOURCE_DIR)/.prep
9c75c0 111     ($(RM) -rf $(@D) ; $(MKDIR) $(@D))
NJ 112     $(COMPONENT_PRE_CONFIGURE_ACTION)
61c373 113     (cd $(@D) ; $(ENV) $(CONFIGURE_ENV) $(CONFIG_SHELL) \
9dfd18 114         $(CONFIGURE_SCRIPT) $(CONFIGURE_OPTIONS))
9c75c0 115     $(COMPONENT_POST_CONFIGURE_ACTION)
NJ 116     $(TOUCH) $@
117
118 # build the configured source
74300c 119 $(BUILD_DIR)/%/.built:    $(BUILD_DIR)/%/.configured
9c75c0 120     $(COMPONENT_PRE_BUILD_ACTION)
61c373 121     (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
c99122 122         $(GMAKE) $(COMPONENT_BUILD_GMAKE_ARGS) $(COMPONENT_BUILD_ARGS) \
DH 123         $(COMPONENT_BUILD_TARGETS))
9c75c0 124     $(COMPONENT_POST_BUILD_ACTION)
7999b2 125 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
MS 126     -$(PARFAIT) build
127 endif
9c75c0 128     $(TOUCH) $@
NJ 129
130 # install the built source into a prototype area
74300c 131 $(BUILD_DIR)/%/.installed:    $(BUILD_DIR)/%/.built
9c75c0 132     $(COMPONENT_PRE_INSTALL_ACTION)
61c373 133     (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \
4b89a1 134             $(COMPONENT_INSTALL_ARGS) $(COMPONENT_INSTALL_TARGETS))
9c75c0 135     $(COMPONENT_POST_INSTALL_ACTION)
NJ 136     $(TOUCH) $@
74300c 137
3a19d0 138 # test the built source
MT 139 $(BUILD_DIR)/%/.tested:    $(BUILD_DIR)/%/.built
140     $(COMPONENT_PRE_TEST_ACTION)
141     (cd $(@D) ; $(ENV) $(COMPONENT_TEST_ENV) $(GMAKE) \
142             $(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
143     $(COMPONENT_POST_TEST_ACTION)
144     $(TOUCH) $@
145
7999b2 146 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
MS 147 parfait: install
148     -$(PARFAIT) build
149 else
150 parfait:
151     $(MAKE) PARFAIT_BUILD=yes parfait
152 endif
153
74300c 154 clean::
NJ 155     $(RM) -r $(BUILD_DIR) $(PROTO_DIR)