comm: add -Wall
[unleashed.git] / usr / src / Makefile.master
blob6d27c0b0eaf6234dfdd328efe90657150b085dfa
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
23 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright (c) 2012 by Delphix. All rights reserved.
25 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
26 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
27 # Copyright 2015 Gary Mills
28 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
29 # Copyright 2016 Toomas Soome <tsoome@me.com>
32 include $(SRC)/Makefile.cfgparam
35 # Makefile.master, global definitions for system source
37 ROOT=           /proto
40 # Adjunct root, containing an additional proto area to be used for headers
41 # and libraries.
43 ADJUNCT_PROTO=
46 # Adjunct for building things that run on the build machine.
48 NATIVE_ADJUNCT= /usr
51 # RELEASE_BUILD should be cleared for final release builds.
52 # NOT_RELEASE_BUILD is exactly what the name implies.
55 NOT_RELEASE_BUILD=
56 RELEASE_BUILD=                          $(POUND_SIGN)
57 $(RELEASE_BUILD)NOT_RELEASE_BUILD=      $(POUND_SIGN)
58 PATCH_BUILD=                            $(POUND_SIGN)
60 # SPARC_BLD is '#' for an Intel build.
61 # INTEL_BLD is '#' for a Sparc build.
62 SPARC_BLD_1=    $(MACH:i386=$(POUND_SIGN))
63 SPARC_BLD=      $(SPARC_BLD_1:sparc=)
64 INTEL_BLD_1=    $(MACH:sparc=$(POUND_SIGN))
65 INTEL_BLD=      $(INTEL_BLD_1:i386=)
67 # Allow build-time "configuration" to enable or disable some things.
68 # The default is POUND_SIGN, meaning "not enabled".
69 ENABLE_PERL64=          $(POUND_SIGN)
71 # BUILD_TOOLS is the root of all tools including compilers.
72 # ONBLD_TOOLS is the root of all the tools that are part of SUNWonbld.
74 BUILD_TOOLS=            /opt
75 ONBLD_TOOLS=            $(BUILD_TOOLS)/onbld
77 GNUC_ROOT=      /opt/gcc/4.4.4
78 GCCLIBDIR=      $(GNUC_ROOT)/lib
79 GCCLIBDIR64=    $(GNUC_ROOT)/lib/$(MACH64)
81 DOCBOOK_XSL_ROOT=       /usr/share/sgml/docbook/xsl-stylesheets
83 RPCGEN=         /usr/bin/rpcgen
84 ELFEXTRACT=     $(ONBLD_TOOLS)/bin/$(MACH)/elfextract
85 MBH_PATCH=      $(SRCTOP)/tools/mbh_patch/obj/mbh_patch
86 BTXLD=          $(ONBLD_TOOLS)/bin/$(MACH)/btxld
87 # echo(1) and true(1) are specified without absolute paths, so that the shell
88 # spawned by make(1) may use the built-in versions.  This is minimally
89 # problematic, as the shell spawned by make(1) is known and under control, the
90 # only risk being if the shell falls back to $PATH.
92 # We specifically want an echo(1) that does interpolation of escape sequences,
93 # which ksh, /bin/sh, and bash will all provide.
94 ECHO=           echo
95 TRUE=           true
96 INS=            /usr/bin/install
97 SYMLINK=        /usr/bin/ln -s
98 LN=             /usr/bin/ln
99 MKDIR=          /usr/bin/mkdir
100 CHMOD=          /usr/bin/chmod
101 MV=             /usr/bin/mv -f
102 RM=             /usr/bin/rm -f
103 CUT=            /usr/bin/cut
104 NM=             /usr/bin/nm
105 DIFF=           /usr/bin/diff
106 GREP=           /usr/bin/grep
107 EGREP=          /usr/bin/egrep
108 ELFWRAP=        /usr/bin/elfwrap
109 SED=            /usr/bin/sed
110 AWK=            /usr/bin/nawk
111 CP=             /usr/bin/cp -f
112 MCS=            /usr/bin/mcs
113 CAT=            /usr/bin/cat
114 ELFDUMP=        /usr/bin/elfdump
115 M4=             /usr/bin/m4
116 STRIP=          /usr/bin/strip
117 LEX=            /usr/bin/lex
118 LFLAGS=         -n
119 FLEX=           /usr/bin/flex
120 YACC=           /usr/bin/yacc
121 CPP=            $(GNUC_ROOT)/cpp
122 ANSI_CPP=       $(GNUC_ROOT)/bin/cpp
123 CTFCONVERT=     /usr/bin/ctfconvert
124 CTFDIFF=        /usr/bin/ctfdiff
125 CTFMERGE=       /usr/bin/ctfmerge
126 CTFSTABS=       $(ONBLD_TOOLS)/bin/$(MACH)/ctfstabs
127 CTFSTRIP=       $(ONBLD_TOOLS)/bin/$(MACH)/ctfstrip
128 NDRGEN=         $(ONBLD_TOOLS)/bin/$(MACH)/ndrgen
129 GENOFFSETS=     $(ONBLD_TOOLS)/bin/genoffsets
130 FIND=           /usr/bin/find
131 PERL=           /usr/bin/perl
132 PERL_VERSION=   5.22
133 PERL_PKGVERS=   -522
134 PERL_ARCH=              i86pc-solaris-64int
135 PERL_ARCH64=    i86pc-solaris-64
136 $(SPARC_BLD)PERL_ARCH=          sun4-solaris-64int
137 $(SPARC_BLD)PERL_ARCH64=        sun4-solaris-64
138 PYTHON_VERSION= 2.7
139 PYTHON_PKGVERS= -27
140 PYTHON_SUFFIX=
141 PYTHON=         /usr/bin/python$(PYTHON_VERSION)
142 PYTHON3_VERSION=        3.5
143 PYTHON3_PKGVERS=        -35
144 PYTHON3_SUFFIX=         m
145 PYTHON3=                /usr/bin/python$(PYTHON3_VERSION)
146 SORT=           /usr/bin/sort
147 TOUCH=          /usr/bin/touch
148 WC=             /usr/bin/wc
149 XARGS=          /usr/bin/xargs
150 ELFEDIT=        /usr/bin/elfedit
151 DTRACE=         /usr/sbin/dtrace -xnolibs
152 UNIQ=           /usr/bin/uniq
153 TAR=            /usr/bin/tar
154 ASTBINDIR=      /usr/ast/bin
155 MSGCC=          $(ASTBINDIR)/msgcc
156 MSGFMT=         /usr/bin/msgfmt -s
158 FILEMODE=       644
159 DIRMODE=        755
161 # Declare that nothing should be built in parallel.
162 # Individual Makefiles can use the .PARALLEL target to declare otherwise.
163 .NO_PARALLEL:
165 # For stylistic checks
167 # Note that the X and C checks are not used at this time and may need
168 # modification when they are actually used.
170 CSTYLE=         $(ONBLD_TOOLS)/bin/cstyle
171 CSTYLE_TAIL=
172 HDRCHK=         $(ONBLD_TOOLS)/bin/hdrchk
173 HDRCHK_TAIL=
175 DOT_H_CHECK=    \
176         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL); \
177         $(HDRCHK) $< $(HDRCHK_TAIL)
179 DOT_X_CHECK=    \
180         @$(ECHO) "checking $<"; $(RPCGEN) -C -h $< | $(CSTYLE) $(CSTYLE_TAIL); \
181         $(RPCGEN) -C -h $< | $(HDRCHK) $< $(HDRCHK_TAIL)
183 DOT_C_CHECK=    \
184         @$(ECHO) "checking $<"; $(CSTYLE) $< $(CSTYLE_TAIL)
186 MANIFEST_CHECK= \
187         @$(ECHO) "checking $<"; \
188         SVCCFG_DTD=$(SRC)/cmd/svc/dtd/service_bundle.dtd.1 \
189         SVCCFG_REPOSITORY=$(SRC)/cmd/svc/seed/global.db \
190         SVCCFG_CONFIGD_PATH=$(SRC)/cmd/svc/configd/svc.configd-native \
191         $(SRC)/cmd/svc/svccfg/svccfg-native validate $<
193 INS.file=       $(INS) -m $(FILEMODE) $< $@
194 INS.dir=        $(INS) -d -m $(DIRMODE) $@
195 # installs and renames at once
197 INS.rename=     $(INS.file)
199 # install a link
200 INSLINKTARGET=  $<
201 INS.link=       $(RM) $@; $(LN) $(INSLINKTARGET) $@
202 INS.symlink=    $(RM) $@; $(SYMLINK) $(INSLINKTARGET) $@
205 # Python bakes the mtime of the .py file into the compiled .pyc and
206 # rebuilds if the baked-in mtime != the mtime of the source file
207 # (rather than only if it's less than), thus when installing python
208 # files we must make certain to not adjust the mtime of the source
209 # (.py) file.
211 INS.pyfile=     $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) $(FILEMODE) $@; $(TOUCH) -r $< $@
213 # MACH must be set in the shell environment per uname -p on the build host
214 # More specific architecture variables should be set in lower makefiles.
216 # MACH64 is derived from MACH, and BUILD64 is set to `#' for
217 # architectures on which we do not build 64-bit versions.
218 # (There are no such architectures at the moment.)
220 # Set BUILD64=# in the environment to disable 64-bit amd64
221 # builds on i386 machines.
223 MACH64_1=       $(MACH:sparc=sparcv9)
224 MACH64=         $(MACH64_1:i386=amd64)
226 MACH32_1=       $(MACH:sparc=sparcv7)
227 MACH32=         $(MACH32_1:i386=i386)
229 sparc_BUILD64=
230 i386_BUILD64=
231 BUILD64=        $($(MACH)_BUILD64)
234 # generate 32-bit addresses in the v9 kernel. Saves memory.
235 CCABS32=                -fno-pic -mcmodel=medlow
237 # generate v9 code which tolerates callers using the v7 ABI, for the sake of
238 # system calls.
239 CC32BITCALLERS=         -massume-32bit-callers
241 # GCC, especially, is increasingly beginning to auto-inline functions and
242 # sadly does so separately not under the general -fno-inline-functions
243 # Additionally, we wish to prevent optimisations which cause GCC to clone
244 # functions -- in particular, these may cause unhelpful symbols to be
245 # emitted instead of function names
246 CCNOAUTOINLINE= -fno-inline-small-functions \
247         -fno-inline-functions-called-once \
248         -fno-ipa-cp
251 # compiler architecture flags.
253 sparc_XARCH=    -m32 -mcpu=v8 -mno-v8plus
254 sparcv9_XARCH=  -m64 -mcpu=v9
255 i386_XARCH=     -m32 -march=pentiumpro
256 amd64_XARCH=    -m64 -Ui386 -U__i386 -mtune=opteron
258 # assembler architecture flags.  Different from compiler architecture flags.
259 sparc_AS_XARCH=         -xarch=v8plus -Dsparc -D__sparc -D__sparcv8
260 sparcv9_AS_XARCH=       -xarch=v9 -Dsparc -D__sparc -D__sparcv9
261 i386_AS_XARCH=          -m32 -Di386 -D__i386
262 amd64_AS_XARCH=         -m64 -Ui386 -U__i386 -D__x86_64 -D__amd64
265 # These flags define what we need to be 'standalone' i.e. -not- part
266 # of the rather more cosy userland environment.  This basically means
267 # the kernel.
269 # XX64  future versions of gcc will make -mcmodel=kernel imply -mno-red-zone
271 sparc_STAND_FLAGS=      -ffreestanding
272 sparcv9_STAND_FLAGS=    -ffreestanding
273 # Disabling MMX also disables 3DNow, disabling SSE also disables all later
274 # additions to SSE (SSE2, AVX ,etc.)
275 NO_SIMD=                -mno-mmx -mno-sse
276 i386_STAND_FLAGS=       -ffreestanding $(NO_SIMD)
277 amd64_STAND_FLAGS=      -ffreestanding -mno-red-zone \
278                         -mcmodel=kernel $(NO_SIMD)
280 SAVEARGS=               -msave-args
281 amd64_STAND_FLAGS       += $(SAVEARGS)
283 STAND_FLAGS_32 = $($(MACH)_STAND_FLAGS)
284 STAND_FLAGS_64 = $($(MACH64)_STAND_FLAGS)
287 # turn warnings into errors (C)
288 CERRWARN = -Wall -Wextra -Werror
290 CERRWARN += -Wno-missing-braces
291 CERRWARN += -Wno-sign-compare
292 CERRWARN += -Wno-unknown-pragmas
293 CERRWARN += -Wno-unused-parameter
294 CERRWARN += -Wno-missing-field-initializers
296 # Unfortunately, this option can misfire very easily and unfixably.
297 CERRWARN +=     -Wno-array-bounds
299 # DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in
300 # -nd builds
301 $(RELEASE_BUILD)CERRWARN += -Wno-unused
302 $(RELEASE_BUILD)CERRWARN += -Wno-empty-body
305 # turn warnings into errors (C++)
306 CCERRWARN=              -Werror
308 # C standard.
309 CSTD_GNU89=     -std=gnu89
310 CSTD_GNU99=     -std=gnu99
311 CSTD=           $(CSTD_GNU89)
313 # In most places, assignments to these macros should be appended with +=
314 # (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
315 sparc_CFLAGS=   $(sparc_XARCH)
316 sparcv9_CFLAGS= $(sparcv9_XARCH)
317 i386_CFLAGS=    $(i386_XARCH)
318 amd64_CFLAGS=   $(amd64_XARCH)
320 sparc_ASFLAGS=  $(sparc_AS_XARCH)
321 sparcv9_ASFLAGS=$(sparcv9_AS_XARCH)
322 i386_ASFLAGS=   $(i386_AS_XARCH)
323 amd64_ASFLAGS=  $(amd64_AS_XARCH)
326 sparc_COPTFLAG=         -fno-strict-aliasing \
327         -fno-unit-at-a-time \
328         -fno-optimize-sibling-calls \
329         -O2
330 sparcv9_COPTFLAG=       -fno-strict-aliasing \
331         -fno-unit-at-a-time \
332         -fno-optimize-sibling-calls \
333         -O2
334 i386_COPTFLAG=          -O
335 amd64_COPTFLAG=         -fno-strict-aliasing \
336         -fno-unit-at-a-time \
337         -fno-optimize-sibling-calls \
338         -O2
340 COPTFLAG= $($(MACH)_COPTFLAG)
341 COPTFLAG64= $($(MACH64)_COPTFLAG)
343 # Sometimes we want all symbols and types in debugging information even
344 # if they aren't used.
345 CALLSYMS=       -fno-eliminate-unused-debug-symbols \
346                 -fno-eliminate-unused-debug-types
349 # Flags used to build in debug mode for ctf generation.  Bugs in the Devpro
350 # compilers currently prevent us from building with cc-emitted DWARF.
352 CTF_FLAGS_sparc = -g -Wc,-Qiselect-T1 $(CSTD) $(CDWARFSTR)
353 CTF_FLAGS_i386  = -g $(CSTD) $(CDWARFSTR)
355 CTF_FLAGS_sparcv9       = $(CTF_FLAGS_sparc)
356 CTF_FLAGS_amd64         = $(CTF_FLAGS_i386)
358 CTF_FLAGS_amd64 += $(SAVEARGS)
360 CTF_FLAGS_32    = $(CTF_FLAGS_$(MACH))
361 CTF_FLAGS_64    = $(CTF_FLAGS_$(MACH64))
362 CTF_FLAGS       = $(CTF_FLAGS_32)
365 # Flags used with genoffsets
367 GOFLAGS = $(CALLSYMS) \
368         $(CDWARFSTR)
370 OFFSETS_CREATE = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
371         $(CC) $(GOFLAGS) $(CFLAGS) $(CPPFLAGS)
373 OFFSETS_CREATE64 = $(GENOFFSETS) -s $(CTFSTABS) -r $(CTFCONVERT) \
374         $(CC) $(GOFLAGS) $(CFLAGS64) $(CPPFLAGS)
376 sparc_XREGSFLAG         = -mno-app-regs
377 sparcv9_XREGSFLAG       = -mno-app-regs
378 i386_XREGSFLAG          =
379 amd64_XREGSFLAG         =
381 XREGSFLAG               = $($(MACH)_XREGSFLAG)
382 XREGSFLAG64             = $($(MACH64)_XREGSFLAG)
384 # dmake SOURCEDEBUG=yes ... enables source-level debugging information, and
385 # avoids stripping it.
386 SOURCEDEBUG     = $(POUND_SIGN)
387 SRCDBGBLD       = $(SOURCEDEBUG:yes=)
390 # These variables are intended ONLY for use by developers to safely pass extra
391 # flags to the compilers without unintentionally overriding Makefile-set
392 # flags.  They should NEVER be set to any value in a Makefile.
394 # They come last in the associated FLAGS variable such that they can
395 # explicitly override things if necessary, there are gaps in this, but it's
396 # the best we can manage.
398 CUSERFLAGS              =
399 CUSERFLAGS64            = $(CUSERFLAGS)
400 CCUSERFLAGS             =
401 CCUSERFLAGS64           = $(CCUSERFLAGS)
403 CSOURCEDEBUGFLAGS       =
404 CCSOURCEDEBUGFLAGS      =
405 $(SRCDBGBLD)CSOURCEDEBUGFLAGS   = -g
406 $(SRCDBGBLD)CCSOURCEDEBUGFLAGS  = -g
408 CFLAGS=         $(COPTFLAG) $($(MACH)_CFLAGS) \
409                 $(CERRWARN) $(CSTD) \
410                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
411                 $(CUSERFLAGS)
412 CFLAGS64=       $(COPTFLAG64) $($(MACH64)_CFLAGS) \
413                 $(CERRWARN) $(CSTD) \
414                 $(CCNOAUTOINLINE) $(CSOURCEDEBUGFLAGS) \
415                 $(CUSERFLAGS64)
416 ARFLAGS=        rc
418 # Flags that are used to build parts of the code that are subsequently
419 # run on the build machine (also known as the NATIVE_BUILD).
421 NATIVE_CFLAGS=  $(COPTFLAG) $($(NATIVE_MACH)_CFLAGS) \
422                 $(CERRWARN) $(CSTD) \
423                 $(CCNOAUTOINLINE) \
424                 $(CSOURCEDEBUGFLAGS) $(CUSERFLAGS)
426 DTEXTDOM=-DTEXT_DOMAIN=\"$(TEXT_DOMAIN)\"       # For messaging.
427 CPPFLAGS.first= # Please keep empty.  Only lower makefiles should set this.
428 CPPFLAGS.master=$(DTEXTDOM) \
429         $(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) $(ENVCPPFLAGS4) \
430         $(ADJUNCT_PROTO:%=-I%/usr/include)
431 CPPFLAGS.native=$(ENVCPPFLAGS1) $(ENVCPPFLAGS2) $(ENVCPPFLAGS3) \
432                 $(ENVCPPFLAGS4) -I$(NATIVE_ADJUNCT)/include
433 CPPFLAGS=       $(CPPFLAGS.first) $(CPPFLAGS.master)
434 AS_CPPFLAGS=    $(CPPFLAGS.first) $(CPPFLAGS.master)
437 # For source message catalogue
439 .SUFFIXES: $(SUFFIXES) .i .po
440 MSGROOT= $(ROOT)/catalog
441 MSGDOMAIN= $(MSGROOT)/$(TEXT_DOMAIN)
442 MSGDOMAINPOFILE = $(MSGDOMAIN)/$(POFILE)
443 DCMSGDOMAIN= $(MSGROOT)/LC_TIME/$(TEXT_DOMAIN)
444 DCMSGDOMAINPOFILE = $(DCMSGDOMAIN)/$(DCFILE:.dc=.po)
446 CLOBBERFILES += $(POFILE) $(POFILES)
447 COMPILE.cpp= $(CC) -xc -E -C $(CFLAGS) $(CPPFLAGS)
448 XGETTEXT= /usr/bin/xgettext
449 XGETFLAGS= -c TRANSLATION_NOTE
450 BUILD.po= $(XGETTEXT) $(XGETFLAGS) -d $(<F) $<.i ;\
451         $(RM)   $@ ;\
452         $(SED) "/^domain/d" < $(<F).po > $@ ;\
453         $(RM) $(<F).po $<.i
456 # This is overwritten by local Makefile when PROG is a list.
458 POFILE= $(PROG).po
460 sparc_CCFLAGS=          -m32 mcpu=v8 mno-v8plus \
461                         -mtunesupersparc \
462                         $(CCERRWARN)
463 sparcv9_CCFLAGS=        $(sparcv9_XARCH) \
464                         $(CCERRWARN)
465 i386_CCFLAGS=           $(CCERRWARN)
466 amd64_CCFLAGS=          $(amd64_XARCH) \
467                         $(CCERRWARN)
469 sparc_CCOPTFLAG=        -O
470 sparcv9_CCOPTFLAG=      -O
471 i386_CCOPTFLAG=         -O
472 amd64_CCOPTFLAG=        -O
474 CCOPTFLAG=      $($(MACH)_CCOPTFLAG)
475 CCOPTFLAG64=    $($(MACH64)_CCOPTFLAG)
476 CCFLAGS=        $(CCOPTFLAG) $($(MACH)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
477                 $(CCUSERFLAGS)
478 CCFLAGS64=      $(CCOPTFLAG64) $($(MACH64)_CCFLAGS) $(CCSOURCEDEBUGFLAGS) \
479                 $(CCUSERFLAGS64)
484 ELFWRAP_FLAGS   =
485 ELFWRAP_FLAGS64 =       -64
488 # Various mapfiles that are used throughout the build, and delivered to
489 # /usr/lib/ld.
491 MAPFILE.PGA =           $(SRC)/common/mapfiles/common/map.pagealign
492 MAPFILE.FLT =           $(SRC)/common/mapfiles/common/map.filter
493 MAPFILE.LEX =           $(SRC)/common/mapfiles/common/map.lex.yy
496 # Generated mapfiles that are compiler specific, and used throughout the
497 # build.  These mapfiles are not delivered in /usr/lib/ld.
499 MAPFILE.NGB_sparc=      $(SRC)/common/mapfiles/gen/sparc_gcc_map.noexeglobs
500 MAPFILE.NGB_sparcv9=    $(SRC)/common/mapfiles/gen/sparcv9_gcc_map.noexeglobs
501 MAPFILE.NGB_i386=       $(SRC)/common/mapfiles/gen/i386_gcc_map.noexeglobs
502 MAPFILE.NGB_amd64=      $(SRC)/common/mapfiles/gen/amd64_gcc_map.noexeglobs
503 MAPFILE.NGB =           $(MAPFILE.NGB_$(MACH))
506 # A generic interface mapfile name, used by various dynamic objects to define
507 # the interfaces and interposers the object must export.
509 MAPFILE.INT =           mapfile-intf
512 # LDLIBS32 and LDLIBS64 can be set in the environment to override the following
513 # assignments.
515 LDLIBS32 =      $(ENVLDLIBS1) $(ENVLDLIBS2) $(ENVLDLIBS3)
516 LDLIBS32 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib -L%/lib)
517 LDLIBS.cmd =    $(LDLIBS32)
518 LDLIBS.lib =    $(LDLIBS32)
520 LDLIBS64 =      $(ENVLDLIBS1:%=%/$(MACH64)) \
521                 $(ENVLDLIBS2:%=%/$(MACH64)) \
522                 $(ENVLDLIBS3:%=%/$(MACH64))
523 LDLIBS64 +=     $(ADJUNCT_PROTO:%=-L%/usr/lib/$(MACH64) -L%/lib/$(MACH64))
526 # Define compilation macros.
528 COMPILE.c=      $(CC) $(CFLAGS) $(CPPFLAGS) -c
529 COMPILE64.c=    $(CC) $(CFLAGS64) $(CPPFLAGS) -c
530 COMPILE.cc=     $(CCC) $(CCFLAGS) $(CPPFLAGS) -c
531 COMPILE64.cc=   $(CCC) $(CCFLAGS64) $(CPPFLAGS) -c
532 COMPILE.s=      $(AS) $(ASFLAGS) $(AS_CPPFLAGS)
533 COMPILE64.s=    $(AS) $(ASFLAGS) $($(MACH64)_AS_XARCH) $(AS_CPPFLAGS)
534 COMPILE.d=      $(DTRACE) -G -32
535 COMPILE64.d=    $(DTRACE) -G -64
536 COMPILE.b=      $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
537 COMPILE64.b=    $(ELFWRAP) $(ELFWRAP_FLAGS$(CLASS))
540 # Link time macros
542 CCNEEDED        = -L$(GCCLIBDIR) -lstdc++ -lgcc_s
543 CCEXTNEEDED     = $(CCNEEDED)
545 LINK.c=         $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
546 LINK64.c=       $(CC) $(CFLAGS64) $(CPPFLAGS) $(LDFLAGS)
547 LINK.cc=        $(CCC) $(CCFLAGS) $(CPPFLAGS) \
548                 $(LDFLAGS) $(CCNEEDED)
549 LINK64.cc=      $(CCC) $(CCFLAGS64) $(CPPFLAGS) \
550                 $(LDFLAGS) $(CCNEEDED)
552 SECLEVEL=       core
554 # For some future builds, NATIVE_MACH and MACH might be different.
555 # Therefore, NATIVE_MACH needs to be redefined in the
556 # environment as `uname -p` to override this macro.
558 # For now at least, we cross-compile amd64 on i386 machines.
559 NATIVE_MACH=    $(MACH:amd64=i386)
561 # Define native compilation macros
564 # Base directory where compilers are located.
565 # Defined here so it can be overridden by developers.
567 GNU_ROOT=               /usr
569 BASIC_CC_ARGS=  -fident \
570                 -finline \
571                 -fno-inline-functions \
572                 -fno-builtin \
573                 -fno-asm \
574                 -fdiagnostics-show-option \
575                 -nodefaultlibs
577 # The SPARC ldd and std instructions require 8-byte alignment of their
578 # address operand.  gcc correctly uses them only when the ABI requires
579 # 8-byte alignment; unfortunately we have a number of pieces of buggy code
580 # that does not conform to the ABI.  This flag makes gcc work more like
581 # Studio with -xmemalign=4.
582 $(SPARC_BLD)BASIC_CC_ARGS += mno-integer-ldd-std
584 BASIC_CC_ARGS += -D__sun
586 BASIC_AS_ARGS=  -x assembler-with-cpp \
587                 -c \
588                 -Wa,--warn \
589                 -Wa,--fatal-warnings \
590                 -Wa,--traditional-format \
591                 -D__GNUC_AS__
593 # Specify platform compiler versions for languages
594 # that we use (currently only c and c++).
596 sparc_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
597 sparc_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
598 sparc_CPP=              $(GNUC_ROOT)/bin/cpp
599 sparc_AS=               /usr/bin/as -xregsym=no
600 sparc_LD=               /usr/bin/ld
602 sparcv9_CC=             /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
603 sparcv9_CCC=            /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
604 sparcv9_CPP=            $(GNUC_ROOT)/bin/cpp
605 sparcv9_AS=             /usr/bin/as -xregsym=no
606 sparcv9_LD=             /usr/bin/ld
608 i386_CC=                /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
609 i386_CCC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
610 i386_CPP=               $(GNUC_ROOT)/bin/cpp
611 i386_AS=                $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
612 i386_LD=                /usr/bin/ld
614 amd64_CC=               /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/gcc $(BASIC_CC_ARGS)
615 amd64_CCC=              /usr/libexec/unleashed/gcc-wrap $(GNUC_ROOT)/bin/g++ $(BASIC_CC_ARGS)
616 amd64_CPP=              $(GNUC_ROOT)/bin/cpp
617 amd64_AS=               $(GNUC_ROOT)/bin/gcc $(BASIC_AS_ARGS)
618 amd64_LD=               /usr/bin/ld
620 NATIVECC=               $($(NATIVE_MACH)_CC)
621 NATIVECCC=              $($(NATIVE_MACH)_CCC)
622 NATIVECPP=              $($(NATIVE_MACH)_CPP)
623 NATIVEAS=               $($(NATIVE_MACH)_AS)
624 NATIVELD=               $($(NATIVE_MACH)_LD)
627 # Makefile.master.64 overrides these settings
629 CC=                     $(NATIVECC)
630 CCC=                    $(NATIVECCC)
631 CPP=                    $(NATIVECPP)
632 AS=                     $(NATIVEAS)
633 LD=                     $(NATIVELD)
635 CCYFLAG=        -nostdinc
637 LD_BDIRECT=     -Bdirect
638 LD_BDYNAMIC=    -Bdynamic
639 LD_BLOCAL=      -Blocal
640 LD_BNODIRECT=   -Bnodirect
641 LD_BREDUCE=     -Breduce
642 LD_BSTATIC=     -Bstatic
644 BDIRECT=        $(LD_BDIRECT:%=-Wl,%)
645 BDYNAMIC=       $(LD_BDYNAMIC:%=-Wl,%)
646 BLOCAL=         $(LD_BLOCAL:%=-Wl,%)
647 BNODIRECT=      $(LD_BNODIRECT:%=-Wl,%)
648 BREDUCE=        $(LD_BREDUCE:%=-Wl,%)
649 BSTATIC=        $(LD_BSTATIC:%=-Wl,%)
651 LD_ZDEFS=               -zdefs
652 LD_ZDIRECT=             -zdirect
653 LD_ZIGNORE=             -zignore
654 LD_ZINITFIRST=          -zinitfirst
655 LD_ZINTERPOSE=          -zinterpose
656 LD_ZLAZYLOAD=           -zlazyload
657 LD_ZLOADFLTR=           -zloadfltr
658 LD_ZNODEFS=             -znodefs
659 LD_ZNODELETE=           -znodelete
660 LD_ZNODLOPEN=           -znodlopen
661 LD_ZNODUMP=             -znodump
662 LD_ZNOLAZYLOAD=         -znolazyload
663 LD_ZNOLDYNSYM=          -znoldynsym
664 LD_ZNORELOC=            -znoreloc
665 LD_ZNOVERSION=          -znoversion
666 LD_ZRECORD=             -zrecord
667 LD_ZTEXT=               -ztext
669 ZDEFS=          $(LD_ZDEFS:%=-Wl,%)
670 ZDIRECT=        $(LD_ZDIRECT:%=-Wl,%)
671 ZIGNORE=        $(LD_ZIGNORE:%=-Wl,%)
672 ZINITFIRST=     $(LD_ZINITFIRST:%=-Wl,%)
673 ZINTERPOSE=     $(LD_ZINTERPOSE:%=-Wl,%)
674 ZLAZYLOAD=      $(LD_ZLAZYLOAD:%=-Wl,%)
675 ZLOADFLTR=      $(LD_ZLOADFLTR:%=-Wl,%)
676 ZNODEFS=        $(LD_ZNODEFS:%=-Wl,%)
677 ZNODELETE=      $(LD_ZNODELETE:%=-Wl,%)
678 ZNODLOPEN=      $(LD_ZNODLOPEN:%=-Wl,%)
679 ZNODUMP=        $(LD_ZNODUMP:%=-Wl,%)
680 ZNOLAZYLOAD=    $(LD_ZNOLAZYLOAD:%=-Wl,%)
681 ZNOLDYNSYM=     $(LD_ZNOLDYNSYM:%=-Wl,%)
682 NORELOC=        $(LD_ZNORELOC:%=-Wl,%)
683 ZNOVERSION=     $(LD_ZNOVERSION:%=-Wl,%)
684 ZRECORD=        $(LD_ZRECORD:%=-Wl,%)
685 ZTEXT=          $(LD_ZTEXT:%=-Wl,%)
687 GSHARED=        -shared
689 # Handle different PIC models on different ISAs
690 # (May be overridden by lower-level Makefiles)
692 sparc_C_PICFLAGS =      -fpic
693 sparcv9_C_PICFLAGS =    -fpic
694 i386_C_PICFLAGS =       -fpic
695 amd64_C_PICFLAGS =      -fpic
696 C_PICFLAGS =            $($(MACH)_C_PICFLAGS)
697 C_PICFLAGS64 =          $($(MACH64)_C_PICFLAGS)
699 sparc_C_BIGPICFLAGS =   -fPIC
700 sparcv9_C_BIGPICFLAGS = -fPIC
701 i386_C_BIGPICFLAGS =    -fPIC
702 amd64_C_BIGPICFLAGS =   -fPIC
703 C_BIGPICFLAGS =         $($(MACH)_C_BIGPICFLAGS)
704 C_BIGPICFLAGS64 =       $($(MACH64)_C_BIGPICFLAGS)
706 # CC requires there to be no space between '-K' and 'pic' or 'PIC'.
707 sparc_CC_PICFLAGS =     -fpic
708 sparcv9_CC_PICFLAGS =   -fPIC
709 i386_CC_PICFLAGS =      -fpic
710 amd64_CC_PICFLAGS =     -fpic
711 CC_PICFLAGS =           $($(MACH)_CC_PICFLAGS)
712 CC_PICFLAGS64 =         $($(MACH64)_CC_PICFLAGS)
714 AS_PICFLAGS=
715 AS_BIGPICFLAGS=
718 # Default label for CTF sections
720 CTFCVTFLAGS=            -i -L VERSION
723 # Override to pass module-specific flags to ctfmerge.  Currently used only by
724 # krtld to turn on fuzzy matching, and source-level debugging to inhibit
725 # stripping.
727 CTFMRGFLAGS=
729 CTFCONVERT_O            = $(CTFCONVERT) $(CTFCVTFLAGS) $@
731 # Rules (normally from make.rules) and macros which are used for post
732 # processing files. Normally, these do stripping of the comment section
733 # automatically.
734 #    RELEASE_CM:        Should be editted to reflect the release.
735 #    POST_PROCESS_O:    Post-processing for `.o' files.
736 #    POST_PROCESS_A:    Post-processing for `.a' files (currently null).
737 #    POST_PROCESS_SO:   Post-processing for `.so' files.
738 #    POST_PROCESS:      Post-processing for executable files (no suffix).
739 # Note that these macros are not completely generalized as they are to be
740 # used with the file name to be processed following.
742 # It is left as an exercise to Release Engineering to embellish the generation
743 # of the release comment string.
745 #       If this is a standard development build:
746 #               compress the comment section (mcs -c)
747 #               add the standard comment (mcs -a $(RELEASE_CM))
748 #               add the development specific comment (mcs -a $(DEV_CM))
750 #       If this is an installation build:
751 #               delete the comment section (mcs -d)
752 #               add the standard comment (mcs -a $(RELEASE_CM))
753 #               add the development specific comment (mcs -a $(DEV_CM))
755 #       If this is an release build:
756 #               delete the comment section (mcs -d)
757 #               add the standard comment (mcs -a $(RELEASE_CM))
759 # The following list of macros are used in the definition of RELEASE_CM
760 # which is used to label all binaries in the build:
762 #       RELEASE         Specific release of the build, eg: 5.2
763 #       RELEASE_MAJOR   Major version number part of $(RELEASE)
764 #       RELEASE_MINOR   Minor version number part of $(RELEASE)
765 #       VERSION         Version of the build (alpha, beta, Generic)
766 #       PATCHID         If this is a patch this value should contain
767 #                       the patchid value (eg: "Generic 100832-01"), otherwise
768 #                       it will be set to $(VERSION)
769 #       RELEASE_DATE    Date of the Release Build
770 #       PATCH_DATE      Date the patch was created, if this is blank it
771 #                       will default to the RELEASE_DATE
773 SYSNAME=        SunOS
774 RELEASE_MAJOR=  5
775 RELEASE_MINOR=  11
776 RELEASE=        $(RELEASE_MAJOR).$(RELEASE_MINOR)
777 VERSION=        $(SYSNAME) Development
778 PATCHID=        $(VERSION)
779 RELEASE_DATE=   release date not set
780 PATCH_DATE=     $(RELEASE_DATE)
781 RELEASE_CM=     "$(SYSNAME) $(RELEASE) $(PATCHID) $(PATCH_DATE)"
782 DEV_CM=         "$(SYSNAME) Development: non-nightly build"
784 STRIP_STABS=                       $(STRIP) -x $@
785 $(SRCDBGBLD)STRIP_STABS=           :
787 POST_PROCESS_O=         :
788 POST_PROCESS_A=         :
789 POST_PROCESS_SO=        $(STRIP_STABS)
790 POST_PROCESS=           $(STRIP_STABS)
793 # PKGARCHIVE specifies the default location where packages should be
794 # placed if built.
796 PKGARCHIVE=$(SRC)/../../packages/$(MACH)/nightly
799 # The repositories will be created with these publisher settings.  To
800 # update an image to the resulting repositories, this must match the
801 # publisher name provided to "pkg set-publisher."
803 PKGPUBLISHER=   unleashed
805 #       Default build rules which perform comment section post-processing.
808         $(LINK.c) -o $@ $< $(LDLIBS)
809         $(POST_PROCESS)
810 .c.o:
811         $(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
812         $(POST_PROCESS_O)
813 .c.a:
814         $(COMPILE.c) -o $% $<
815         $(AR) $(ARFLAGS) $@ $%
816         $(RM) $%
817 .s.o:
818         $(COMPILE.s) -o $@ $<
819         $(POST_PROCESS_O)
820 .s.a:
821         $(COMPILE.s) -o $% $<
822         $(AR) $(ARFLAGS) $@ $%
823         $(RM) $%
824 .cc:
825         $(LINK.cc) -o $@ $< $(LDLIBS)
826         $(POST_PROCESS)
827 .cc.o:
828         $(COMPILE.cc) $(OUTPUT_OPTION) $<
829         $(POST_PROCESS_O)
830 .cc.a:
831         $(COMPILE.cc) -o $% $<
832         $(AR) $(ARFLAGS) $@ $%
833         $(RM) $%
835         $(YACC.y) $<
836         $(LINK.c) -o $@ y.tab.c $(LDLIBS)
837         $(POST_PROCESS)
838         $(RM) y.tab.c
839 .y.o:
840         $(YACC.y) $<
841         $(COMPILE.c) -o $@ y.tab.c $(CTFCONVERT_HOOK)
842         $(POST_PROCESS_O)
843         $(RM) y.tab.c
845         $(RM) $*.c
846         $(LEX.l) $< > $*.c
847         $(LINK.c) -o $@ $*.c -ll $(LDLIBS)
848         $(POST_PROCESS)
849         $(RM) $*.c
850 .l.o:
851         $(RM) $*.c
852         $(LEX.l) $< > $*.c
853         $(COMPILE.c) -o $@ $*.c $(CTFCONVERT_HOOK)
854         $(POST_PROCESS_O)
855         $(RM) $*.c
857 .bin.o:
858         $(COMPILE.b) -o $@ $<
859         $(POST_PROCESS_O)
861 .java.class:
862         $(COMPILE.java) $<
864 # Bourne and Korn shell script message catalog build rules.
865 # We extract all gettext strings with sed(1) (being careful to permit
866 # multiple gettext strings on the same line), weed out the dups, and
867 # build the catalogue with awk(1).
869 .sh.po .ksh.po:
870         $(SED) -n -e ":a"                               \
871                   -e "h"                                        \
872                   -e "s/.*gettext *\(\"[^\"]*\"\).*/\1/p"       \
873                   -e "x"                                        \
874                   -e "s/\(.*\)gettext *\"[^\"]*\"\(.*\)/\1\2/"  \
875                   -e "t a"                                      \
876                $< | sort -u | $(AWK) '{ print "msgid\t" $$0 "\nmsgstr" }' > $@
879 # Python and Perl executable and message catalog build rules.
881 .SUFFIXES: .pl .pm .py .pyc
883 .pl:
884         $(RM) $@;
885         $(SED) -e "s@TEXT_DOMAIN@\"$(TEXT_DOMAIN)\"@" $< > $@;
886         $(CHMOD) +x $@
888 .py:
889         $(RM) $@; $(SED) -e "1s:^\#!@PYTHON@:\#!$(PYTHON):" < $< > $@; $(CHMOD) +x $@
891 .py.pyc:
892         $(RM) $@
893         $(PYTHON) -mpy_compile $<
894         @[ $(<)c = $@ ] || $(MV) $(<)c $@
896 .pl.po .pm.po:
897         $(XGETTEXT) $(XGETFLAGS) -d $(<F) $< ;
898         $(RM)   $@ ;
899         $(SED) "/^domain/d" < $(<F).po > $@ ;
900         $(RM) $(<F).po
903 # When using xgettext, we want messages to go to the default domain,
904 # rather than the specified one.  This special version of the
905 # COMPILE.cpp macro effectively prevents expansion of TEXT_DOMAIN,
906 # causing xgettext to put all messages into the default domain.
908 CPPFORPO=$(COMPILE.cpp:\"$(TEXT_DOMAIN)\"=TEXT_DOMAIN)
910 .c.i:
911         $(CPPFORPO) $< > $@
913 .h.i:
914         $(CPPFORPO) $< > $@
916 .y.i:
917         $(YACC) -d $<
918         $(CPPFORPO) y.tab.c  > $@
919         $(RM) y.tab.c
921 .l.i:
922         $(LEX) $<
923         $(CPPFORPO) lex.yy.c  > $@
924         $(RM) lex.yy.c
926 .c.po:
927         $(CPPFORPO) $< > $<.i
928         $(BUILD.po)
930 .cc.po:
931         $(CPPFORPO) $< > $<.i
932         $(BUILD.po)
934 .y.po:
935         $(YACC) -d $<
936         $(CPPFORPO) y.tab.c  > $<.i
937         $(BUILD.po)
938         $(RM) y.tab.c
940 .l.po:
941         $(LEX) $<
942         $(CPPFORPO) lex.yy.c  > $<.i
943         $(BUILD.po)
944         $(RM) lex.yy.c
947 # Rules to perform stylistic checks
949 .SUFFIXES: .x .xml .check .xmlchk
951 .h.check:
952         $(DOT_H_CHECK)
954 .x.check:
955         $(DOT_X_CHECK)
957 .xml.xmlchk:
958         $(MANIFEST_CHECK)