Norm Jacobs
2011-02-03 d08673d024206eece0689719af05946a740aab28
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 #
4b89a1 21 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
9c75c0 22 #
NJ 23
a325d4 24 PATH=/usr/bin:/usr/gnu/bin
NJ 25
9c75c0 26 CONSOLIDATION =    userland
NJ 27 PUBLISHER =    $(CONSOLIDATION)-build
6514ee 28
3dc823 29 IS_GLOBAL_ZONE =    $(shell /usr/sbin/zoneadm list | grep -c global)
NJ 30 ROOT =            /
31
50e0e5 32 # get the most recent build number from the last mercurial tag
NJ 33 LAST_HG_TAG =    $(shell hg tags -q | head -2 | tail -1)
34 LAST_BUILD_NUM = $(LAST_HG_TAG:build-%=%)
35
6514ee 36 OS_VERSION =        $(shell uname -r)
NJ 37 SOLARIS_VERSION =    $(OS_VERSION:5.%=2.%)
50e0e5 38 BUILD_NUM =        0.$(shell expr $(LAST_BUILD_NUM) + 1)
6514ee 39 BUILD_VERSION =        $(OS_VERSION)-$(BUILD_NUM)
9c75c0 40
3dc823 41
9c75c0 42 COMPILER =        studio
80b1b4 43 BITS =            32
9c75c0 44 PYTHON_VERSION =    2.6
4b89a1 45 PYTHON_VERSIONS =    2.6
9c75c0 46
NJ 47 WS_LOGS =    $(WS_TOP)/logs
79b849 48 WS_REPO =    $(WS_TOP)/repo
NJ 49 WS_TOOLS =    $(WS_TOP)/tools
50 WS_MAKE_RULES =    $(WS_TOP)/make-rules
51 WS_COMPONENTS =    $(WS_TOP)/components
8b2c08 52 WS_INCORPORATIONS =    $(WS_TOP)/incorporations
d08673 53 WS_LINT_CACHE =    $(WS_TOP)/pkglint-cache
9c75c0 54
79b849 55 BASS_O_MATIC =    $(WS_TOOLS)/bass-o-matic
NJ 56
57 PKG_REPO =    file:$(WS_REPO)
74300c 58
NJ 59 SOURCE_DIR =    $(shell pwd)/$(COMPONENT_SRC)
60 BUILD_DIR =    $(shell pwd)/build
61 PROTO_DIR =    $(BUILD_DIR)/prototype/$(MACH)
9c75c0 62
4f8cfa 63 USRDIR =    /usr
MS 64 BINDIR =    /bin
65 LIBDIR =    /lib
66 USRBINDIR =    $(USRDIR)/bin
67 USRLIBDIR =    $(USRDIR)/lib
68 USRSHAREDIR =    $(USRDIR)/share
69 USRSHAREMANDIR =    $(USRSHAREDIR)/man
70 USRSHAREMAN1DIR =    $(USRSHAREMANDIR)/man1
71 USRSHAREMAN3DIR =    $(USRSHAREMANDIR)/man3
72 USRLIBDIR64 =    $(USRDIR)/lib/$(MACH64)
73 PROTOUSRDIR =    $(PROTO_DIR)/$(USRDIR)
74 PROTOUSRBINDIR =    $(PROTO_DIR)/$(USRBINDIR)
75 PROTOUSRLIBDIR =    $(PROTO_DIR)/$(USRLIBDIR)
76 PROTOUSRLIBDIR64 =    $(PROTO_DIR)/$(USRLIBDIR64)
77 PROTOUSRSHAREDIR =    $(PROTO_DIR)/$(USRSHAREDIR)
78 PROTOUSRSHAREMANDIR =    $(PROTO_DIR)/$(USRSHAREMANDIR)
79 PROTOUSRSHAREMAN1DIR =    $(PROTO_DIR)/$(USRSHAREMAN1DIR)
80 PROTOUSRSHAREMAN3DIR =    $(PROTO_DIR)/$(USRSHAREMAN3DIR)
81
82
3d7f8d 83 SFWBIN =    /usr/sfw/bin
NJ 84 SFWLIB =    /usr/sfw/lib
1932c6 85 SFWSHARE =    /usr/sfw/share
MS 86 SFWSHAREMAN =    /usr/sfw/share/man
87 SFWSHAREMAN1 =    /usr/sfw/share/man/man1
3d7f8d 88 PROTOSFWBIN =    $(PROTO_DIR)/$(SFWBIN)
NJ 89 PROTOSFWLIB =    $(PROTO_DIR)/$(SFWLIB)
1932c6 90 PROTOSFWSHARE =    $(PROTO_DIR)/$(SFWSHARE)
MS 91 PROTOSFWSHAREMAN =    $(PROTO_DIR)/$(SFWSHAREMAN)
92 PROTOSFWSHAREMAN1 =    $(PROTO_DIR)/$(SFWSHAREMAN1)
93
94 GNUBIN =    /usr/gnu/bin
95 GNUSHARE =    /usr/gnu/share
96 GNUSHAREMAN =    /usr/gnu/share/man
97 GNUSHAREMAN1 =    /usr/gnu/share/man/man1
98 PROTOGNUBIN =    $(PROTO_DIR)/$(GNUBIN)
99 PROTOGNUSHARE =    $(PROTO_DIR)/$(GNUSHARE)
100 PROTOGNUSHAREMAN =    $(PROTO_DIR)/$(GNUSHAREMAN)
101 PROTOGNUSHAREMAN1 =    $(PROTO_DIR)/$(GNUSHAREMAN1)
3d7f8d 102
61c373 103 # work around _TIME, _DATE, embedded date chatter in component builds
NJ 104 # to use, set TIME_CONSTANT in the component Makefile and add $(CONSTANT_TIME)
105 # to the appropriate {CONFIGURE|BUILD|INSTALL}_ENV
79b849 106 CONSTANT_TIME =        LD_PRELOAD_32=$(WS_TOOLS)/time-$(MACH32).so
NJ 107 CONSTANT_TIME +=    LD_PRELOAD_64=$(WS_TOOLS)/time-$(MACH64).so
61c373 108 CONSTANT_TIME +=    TIME_CONSTANT=$(TIME_CONSTANT)
80b1b4 109
5d461f 110 # set MACH from uname -p to either sparc or i386
NJ 111 MACH =        $(shell uname -p)
112
113 # set MACH32 from MACH to either sparcv7 or i86
114 MACH32_1 =    $(MACH:sparc=sparcv7)
115 MACH32 =    $(MACH32_1:i386=i86)
116
117 # set MACH64 from MACH to either sparcv9 or amd64
118 MACH64_1 =    $(MACH:sparc=sparcv9)
119 MACH64 =    $(MACH64_1:i386=amd64)
120
4f8cfa 121 BUILD_DIR_32 =        $(BUILD_DIR)/$(MACH32)
MS 122 BUILD_DIR_64 =        $(BUILD_DIR)/$(MACH64)
123
124 BUILD_32 =        $(BUILD_DIR_32)/.built
125 BUILD_64 =        $(BUILD_DIR_64)/.built
5d461f 126 BUILD_32_and_64 =    $(BUILD_32) $(BUILD_64)
NJ 127
4f8cfa 128 INSTALL_32 =        $(BUILD_DIR_32)/.installed
MS 129 INSTALL_64 =        $(BUILD_DIR_64)/.installed
5d461f 130 INSTALL_32_and_64 =    $(INSTALL_32) $(INSTALL_64)
9c75c0 131
50cda8 132 # BUILD_TOOLS is the root of all tools not normally installed on the system.
NJ 133 BUILD_TOOLS =    /ws/onnv-tools
134
135 SPRO_ROOT =    $(BUILD_TOOLS)/SUNWspro
3d7f8d 136 SPRO_VROOT =    $(SPRO_ROOT)/sunstudio12.1
50cda8 137
9c75c0 138 GCC_ROOT =    /usr/gnu
NJ 139
50cda8 140 CC.studio.32 =    $(SPRO_VROOT)/bin/cc -m32
NJ 141 CCC.studio.32 =    $(SPRO_VROOT)/bin/CC -m32
9c75c0 142
50cda8 143 CC.studio.64 =    $(SPRO_VROOT)/bin/cc -m64
NJ 144 CCC.studio.64 =    $(SPRO_VROOT)/bin/CC -m64
9c75c0 145
NJ 146 CC.gcc.32 =    $(GCC_ROOT)/bin/cc -m32
147 CCC.gcc.32 =    $(GCC_ROOT)/bin/CC -m32
148
149 CC.gcc.64 =    $(GCC_ROOT)/bin/cc -m64
150 CCC.gcc.64 =    $(GCC_ROOT)/bin/CC -m64
151
152 CC =        $(CC.$(COMPILER).$(BITS))
153 CCC =        $(CCC.$(COMPILER).$(BITS))
154
4f8cfa 155 lint.32 =    $(SPRO_VROOT)/bin/lint -m32
MS 156 lint.64 =    $(SPRO_VROOT)/bin/lint -m64
157
158 LINT =        $(lint.$(BITS))
159
61c373 160 LD =        /usr/bin/ld
9c75c0 161
NJ 162 PYTHON.2.6.32 =    /usr/bin/python2.6
ca4d33 163 PYTHON.2.6.64 =    /usr/bin/$(MACH64)/python2.6
9c75c0 164
NJ 165 PYTHON.32 =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
166 PYTHON.64 =    $(PYTHON.$(PYTHON_VERSION).$(BITS))
167
168 GMAKE =        /usr/gnu/bin/make
169 GPATCH =    /usr/gnu/bin/patch
170 GPATCH_FLAGS =    -p1 -b
171
172 PKGSEND =    /usr/bin/pkgsend
d08673 173 PKGLINT =    /usr/bin/pkglint
9c75c0 174
NJ 175 TOUCH =        /usr/bin/touch
176 MKDIR =        /bin/mkdir -p
177 RM =        /bin/rm -f
153732 178 CP =        /bin/cp -f
3d7f8d 179 LN =        /bin/ln
NJ 180 SYMLINK =    /bin/ln -s
61c373 181 ENV =        /usr/bin/env
3d7f8d 182 INSTALL =    /usr/bin/ginstall
4f8cfa 183
MS 184 INS.dir=        $(INSTALL) -d $@
185 INS.file=       $(INSTALL) -m 444 $< $(@D)
186
187 # C compiler mode. Future compilers may change the default on us,
188 # so force transition mode globally. Lower level makefiles can
189 # override this by setting CCMODE.
190 #
191 CCMODE=        -Xa
192 CCMODE64=    -Xa
193
194 # compiler '-xarch' flag. This is here to centralize it and make it
195 # overridable for testing.
196 sparc_XARCH=    $(CCBITS32) -xarch=sparc
197 sparcv9_XARCH=  $(CCBITS64) -xcode=abs64
198 i386_XARCH=     $(CCBITS32) -xchip=pentium
199 amd64_XARCH=    $(CCBITS64) -xarch=generic -Ui386 -U__i386
200
201 # disable the incremental linker
202 ILDOFF=         -xildoff
203
204 # C99 mode
205 C99_ENABLE=     -xc99=all
206 C99_DISABLE=    -xc99=none
207 C99MODE=        $(C99_ENABLE)
208 C99LMODE=       $(C99MODE:-xc99%=-Xc99%)
209
210 # XPG6 mode.  This option enables XPG6 conformance, plus extensions.
211 # Amongst other things, this option will cause system calls like
212 # popen (3C) and system (3C) to invoke the standards-conforming
213 # shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.
214 XPG6MODE=    $(C99MODE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
215
216
217 # The Sun Studio 11 compiler has changed the behaviour of integer
218 # wrap arounds and so a flag is needed to use the legacy behaviour
219 # (without this flag panics/hangs could be exposed within the source).
220 #
221 sparc_IROPTFLAG        = -W2,-xwrap_int
222 sparcv9_IROPTFLAG    = -W2,-xwrap_int
223 i386_IROPTFLAG        =
224 amd64_IROPTFLAG        =
225 IROPTFLAG        = $($(MACH)_IROPTFLAG)
226 IROPTFLAG64        = $($(MACH64)_IROPTFLAG)
227
228 sparc_CFLAGS=    $(sparc_XARCH)
229 sparcv9_CFLAGS=    $(sparcv9_XARCH) -dalign $(CCVERBOSE)
230 i386_CFLAGS=    $(i386_XARCH)
231 amd64_CFLAGS=    $(amd64_XARCH)
232
233 sparc_COPTFLAG=        -xO3
234 sparcv9_COPTFLAG=    -xO3
235 i386_COPTFLAG=        -xO3
236 amd64_COPTFLAG=        -xO3
237 COPTFLAG= $($(MACH)_COPTFLAG)
238 COPTFLAG64= $($(MACH64)_COPTFLAG)
239
240 sparc_XREGSFLAG        = -xregs=no%appl
241 sparcv9_XREGSFLAG    = -xregs=no%appl
242 i386_XREGSFLAG        =
243 amd64_XREGSFLAG        =
244 XREGSFLAG        = $($(MACH)_XREGSFLAG)
245 XREGSFLAG64        = $($(MACH64)_XREGSFLAG)
246
247 CFLAGS=  \
248     $(COPTFLAG) $($(MACH)_CFLAGS) $(CCMODE) \
249     $(ILDOFF) $(C99MODE) $(IROPTFLAG)
250
251 CFLAGS64= \
252     $(COPTFLAG64) $($(MACH64)_CFLAGS) $(CCMODE64) \
253     $(ILDOFF) $(C99MODE) $(IROPTFLAG64)
254
1932c6 255 # build with a non-executable stack by default.
MS 256 # override this if necessary
257 LD_MAP_NOEXSTK="-M /usr/lib/ld/map.noexstk"
258 LD_OPTIONS+= $(LD_MAP_NOEXSTK)
259
e83e52 260 # Environment variables and arguments passed into the build and install
1932c6 261 # environment(s).  These are the initial settings.
MS 262 COMPONENT_BUILD_ENV= \
263     LD_OPTIONS=$(LD_OPTIONS)
264 COMPONENT_INSTALL_ENV= \
265     LD_OPTIONS=$(LD_OPTIONS)
266
267 # Add any bit-specific settings
e83e52 268 COMPONENT_BUILD_ENV += $(COMPONENT_BUILD_ENV.$(BITS))
NJ 269 COMPONENT_BUILD_ARGS += $(COMPONENT_BUILD_ARGS.$(BITS))
270 COMPONENT_INSTALL_ENV += $(COMPONENT_INSTALL_ENV.$(BITS))
271 COMPONENT_INSTALL_ARGS += $(COMPONENT_INSTALL_ARGS.$(BITS))