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