xref: /onnv-gate/usr/src/uts/Makefile (revision 12508:edb7861a1533)
10Sstevel@tonic-gate#
20Sstevel@tonic-gate# CDDL HEADER START
30Sstevel@tonic-gate#
40Sstevel@tonic-gate# The contents of this file are subject to the terms of the
53448Sdh155122# Common Development and Distribution License (the "License").
63448Sdh155122# You may not use this file except in compliance with the License.
70Sstevel@tonic-gate#
80Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate# See the License for the specific language governing permissions
110Sstevel@tonic-gate# and limitations under the License.
120Sstevel@tonic-gate#
130Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate#
190Sstevel@tonic-gate# CDDL HEADER END
200Sstevel@tonic-gate#
210Sstevel@tonic-gate#
22*12508Samw@Sun.COM# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
230Sstevel@tonic-gate#
240Sstevel@tonic-gate# include global definitions
250Sstevel@tonic-gateinclude ../Makefile.master
260Sstevel@tonic-gate
270Sstevel@tonic-gate#
280Sstevel@tonic-gate# List of architectures to build as part of the standard build.
290Sstevel@tonic-gate#
306094Sakolb# Some of these architectures are built in parallel (see i386_PARALLEL and
316094Sakolb# sparc_PARALLEL). This requires building some parts first before parallel build
326094Sakolb# can start. Platform make files know what should be built as a prerequisite for
336094Sakolb# the parallel build to work. The i386_PREREQ and sparc_PREREQ variables tell
346094Sakolb# which platform directory to enter to start making prerequisite dependencies.
350Sstevel@tonic-gate#
360Sstevel@tonic-gatesparc_ARCHITECTURES = sun4v sun4u sparc
370Sstevel@tonic-gate
386094Sakolbi386_ARCHITECTURES = i86pc i86xpv intel
396094Sakolb
406094Sakolb#
416094Sakolb# For i386 all architectures can be compiled in parallel.
426094Sakolb#
436094Sakolb# intel/Makefile knows how to build prerequisites needed for parallel build.
446094Sakolb#
456094Sakolbi386_PREREQ = intel
466094Sakolbi386_PARALLEL = $(i386_ARCHITECTURES)
476094Sakolb
486094Sakolb#
496094Sakolb# For sparc all architectures can be compiled in parallel.
506094Sakolb#
516094Sakolb# sun4/Makefile knows how to build prerequisites needed for parallel build.
526094Sakolb# can start.
536094Sakolb#
546094Sakolbsparc_PREREQ = sun4
556094Sakolbsparc_PARALLEL = $(sparc_ARCHITECTURES)
566094Sakolb
576094Sakolb#
586094Sakolb# Platforms defined in $(MACH)_PARALLEL are built in parallel. DUMMY is placed
596094Sakolb# at the end in case $(MACH)_PARALLEL is empty to prevent everything going in
606094Sakolb# parallel.
616094Sakolb#
626094Sakolb.PARALLEL: $($(MACH)_PARALLEL) DUMMY
636094Sakolb
646094Sakolb#
656094Sakolb# For build prerequisites we use a special target which is constructed by adding
666094Sakolb# '.prereq' suffix to the $(MACH)_PREREQ.
676094Sakolb#
686094SakolbPREREQ_TARGET = $($(MACH)_PREREQ:%=%.prereq)
696094Sakolb
700Sstevel@tonic-gate
710Sstevel@tonic-gatedef		:=	TARGET= def
720Sstevel@tonic-gateall		:=	TARGET= all
730Sstevel@tonic-gateinstall		:=	TARGET= install
740Sstevel@tonic-gateinstall_h	:=	TARGET= install_h
750Sstevel@tonic-gateclean		:=	TARGET= clean
760Sstevel@tonic-gateclobber		:=	TARGET= clobber
770Sstevel@tonic-gatelint		:=	TARGET= lint
780Sstevel@tonic-gateclean.lint	:=	TARGET= clean.lint
790Sstevel@tonic-gatecheck		:=	TARGET= check
801167Skupfermodlist		:=	TARGET= modlist
811167Skupfermodlist		:=	NO_STATE= -K $$MODSTATE$$$$
820Sstevel@tonic-gate
830Sstevel@tonic-gate.KEEP_STATE:
840Sstevel@tonic-gate
850Sstevel@tonic-gatedef all lint: all_h $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
860Sstevel@tonic-gate
870Sstevel@tonic-gateinstall: all_h install_dirs $(PMTMO_FILE) $($(MACH)_ARCHITECTURES)
880Sstevel@tonic-gate
890Sstevel@tonic-gateinstall_dirs:
900Sstevel@tonic-gate	@cd ..; pwd; $(MAKE) rootdirs
910Sstevel@tonic-gate	@pwd
920Sstevel@tonic-gate
936094Sakolb#
946094Sakolb# Rule to build prerequisites. The left part of the pattern will match
956094Sakolb# PREREQ_TARGET.
966094Sakolb#
976094Sakolb# The location of the Makefile is determined by strippinng '.prereq' suffix from
986094Sakolb# the target name. We add '.prereq' suffix to the target passed to the child
996094Sakolb# Makefile so that it can distinguish prerequisite build from the regular one.
1006094Sakolb#
1016094Sakolb#
1026094Sakolb%.prereq:
1036094Sakolb	@cd $(@:%.prereq=%); pwd; $(MAKE) $(NO_STATE) $(TARGET).prereq
1046094Sakolb
1056094Sakolb#
1066094Sakolb# Rule to build architecture files. Build all required prerequisites and then
1076094Sakolb# build the rest (potentially in parallel).
1086094Sakolb#
1096094Sakolb$($(MACH)_ARCHITECTURES): $(PREREQ_TARGET) FRC
1101167Skupfer	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
1110Sstevel@tonic-gate
1120Sstevel@tonic-gate$(PMTMO_FILE) pmtmo_file: $(PATCH_MAKEUP_TABLE)
1130Sstevel@tonic-gate	@if [ -z "$(PATCH_MAKEUP_TABLE)" ] ; then \
1140Sstevel@tonic-gate		echo 'ERROR: $$(PATCH_MAKEUP_TABLE) not set' \
1150Sstevel@tonic-gate		    'in environment' >&2 ; \
1160Sstevel@tonic-gate		exit 1 ; \
1170Sstevel@tonic-gate	fi
1180Sstevel@tonic-gate	RELEASE="$(RELEASE)" MACH="$(MACH)" \
1190Sstevel@tonic-gate	    $(CTFCVTPTBL) -o $(PMTMO_FILE) $(PATCH_MAKEUP_TABLE)
1200Sstevel@tonic-gate
1210Sstevel@tonic-gate#
1220Sstevel@tonic-gate# The following is the list of directories which contain Makefiles with
1230Sstevel@tonic-gate# targets to install header file. The machine independent headers are
1240Sstevel@tonic-gate# installed by invoking the Makefile in the directory containing the
1250Sstevel@tonic-gate# header files. Machine and architecture dependent headers are installed
1260Sstevel@tonic-gate# by invoking the main makefile for that architecture/machine which,
1270Sstevel@tonic-gate# in turn, is responsible for invoking the Makefiles which install headers.
1280Sstevel@tonic-gate# It is done this way so as not to assume that all of the header files in
1290Sstevel@tonic-gate# the architecture/machine dependent subdirectories are in completely
1300Sstevel@tonic-gate# isomorphic locations.
1310Sstevel@tonic-gate#
1327836SJohn.Forte@Sun.COMCOMMON_HDRDIRS= common/avs \
1337836SJohn.Forte@Sun.COM		common/c2 \
1347836SJohn.Forte@Sun.COM		common/des \
1357836SJohn.Forte@Sun.COM		common/fs \
1367836SJohn.Forte@Sun.COM		common/gssapi \
1377836SJohn.Forte@Sun.COM		common/idmap \
1387836SJohn.Forte@Sun.COM		common/inet \
1397836SJohn.Forte@Sun.COM		common/inet/ipf/netinet \
1407836SJohn.Forte@Sun.COM		common/inet/kssl \
1417836SJohn.Forte@Sun.COM		common/inet/nca \
14210639SDarren.Reed@Sun.COM		common/inet/sockmods/netpacket \
14310639SDarren.Reed@Sun.COM		common/io/bpf/net \
1447836SJohn.Forte@Sun.COM		common/ipp \
1457836SJohn.Forte@Sun.COM		common/net \
1467836SJohn.Forte@Sun.COM		common/netinet \
1477836SJohn.Forte@Sun.COM		common/nfs \
1487836SJohn.Forte@Sun.COM		common/pcmcia/sys \
1497836SJohn.Forte@Sun.COM		common/rpc \
1507836SJohn.Forte@Sun.COM		common/rpcsvc \
1517836SJohn.Forte@Sun.COM		common/sharefs \
152*12508Samw@Sun.COM		common/smb \
1537836SJohn.Forte@Sun.COM		common/smbsrv \
1547836SJohn.Forte@Sun.COM		common/sys \
1557836SJohn.Forte@Sun.COM		common/vm
1567836SJohn.Forte@Sun.COM
1573448Sdh155122
1581167Skupfer# These aren't the only headers in closed.  But the other directories
1591167Skupfer# are simple enough that they can be driven from the src tree.
1601167Skupfer$(CLOSED_BUILD)COMMON_HDRDIRS += $(CLOSED)/uts/common/sys
1611167Skupfer
1629565SJordan.Brown@Sun.COM#
1639565SJordan.Brown@Sun.COM# Subset of COMMON_HDRDIRS in which at least one header is generated
1649565SJordan.Brown@Sun.COM# at runtime (e.g., rpcgen).  (This is a partial list; there are
1659565SJordan.Brown@Sun.COM# other directories that should be included and do not yet have the
1669565SJordan.Brown@Sun.COM# necessary Makefile support.  See 6414855.)
1679565SJordan.Brown@Sun.COM#
16810563SBinzi.Cao@Sun.COMDYNHDRDIRS = common/rpcsvc common/idmap common/sys
1699565SJordan.Brown@Sun.COM
1700Sstevel@tonic-gatesparc_HDRDIRS= sun/sys
1715084Sjohnlevi386_HDRDIRS= i86pc/vm i86xpv/vm
1720Sstevel@tonic-gate
1730Sstevel@tonic-gateHDRDIRS= $(COMMON_HDRDIRS) $($(MACH)_HDRDIRS)
1740Sstevel@tonic-gateinstall_h check: $(HDRDIRS) $($(MACH)_ARCHITECTURES)
1750Sstevel@tonic-gate
1760Sstevel@tonic-gate$(HDRDIRS): FRC
1770Sstevel@tonic-gate	@cd $@; pwd; $(MAKE) $(TARGET)
1780Sstevel@tonic-gate
1790Sstevel@tonic-gate# ensures that headers made by rpcgen and others are available in uts source
1800Sstevel@tonic-gate# for kernel builds to reference without building install_h
1810Sstevel@tonic-gate#
1820Sstevel@tonic-gateall_h: FRC
1830Sstevel@tonic-gate	@cd common/sys; pwd; $(MAKE) $@
1840Sstevel@tonic-gate	@cd common/rpc; pwd; $(MAKE) $@
1850Sstevel@tonic-gate	@cd common/rpcsvc; pwd; $(MAKE) $@
1860Sstevel@tonic-gate	@cd common/gssapi; pwd; $(MAKE) $@
1874520Snw141292	@cd common/idmap; pwd; $(MAKE) $@
1880Sstevel@tonic-gate
1899565SJordan.Brown@Sun.COMclean clobber: $($(MACH)_ARCHITECTURES) $(DYNHDRDIRS)
1909565SJordan.Brown@Sun.COM	@if [ '$(PATCH_BUILD)' != '#' ] ; then \
1919565SJordan.Brown@Sun.COM		echo $(RM) $(PMTMO_FILE) ; \
1929565SJordan.Brown@Sun.COM		$(RM) $(PMTMO_FILE) ; \
1939565SJordan.Brown@Sun.COM	fi
1949565SJordan.Brown@Sun.COM
1959565SJordan.Brown@Sun.COMEXTRA_CLOBBER_TARGETS= common/avs/ns/rdc
1969565SJordan.Brown@Sun.COMclobber: $(EXTRA_CLOBBER_TARGETS)
1979565SJordan.Brown@Sun.COM
1989565SJordan.Brown@Sun.COM
1999565SJordan.Brown@Sun.COMclean.lint modlist: $($(MACH)_ARCHITECTURES)
2009565SJordan.Brown@Sun.COM
2010Sstevel@tonic-gateONC_FILES=	common/io/timod.c \
2020Sstevel@tonic-gate		common/os/sig.c \
2030Sstevel@tonic-gate		common/os/flock.c \
2040Sstevel@tonic-gate		common/os/sysent.c \
2050Sstevel@tonic-gate		common/os/swapgeneric.c \
2060Sstevel@tonic-gate		common/syscall/fcntl.c
2070Sstevel@tonic-gate
2080Sstevel@tonic-gate# edit onc plus source files.
2090Sstevel@tonic-gateONC_PLUS:	$(ONC_FILES:%=%_onc_plus)
2100Sstevel@tonic-gate
2110Sstevel@tonic-gate#
2120Sstevel@tonic-gate# Cross-reference customization: build a cross-reference over all of
2130Sstevel@tonic-gate# the supported architectures.  Although there's no correct way to set
2140Sstevel@tonic-gate# the include path (since we don't know what architecture is the one
2150Sstevel@tonic-gate# the user will be interested in), it's historically been set to
2160Sstevel@tonic-gate# mirror the $(XRDIRS) list, and that works kinda sorta okay.
2170Sstevel@tonic-gate#
2187612SSean.Ye@Sun.COM# We need to manually prune usr/closed/uts/{i86xpv|sfmmu|i86pc} since
2197612SSean.Ye@Sun.COM# none of them exist.
2205084Sjohnlev#
2211167SkupferSHARED_XRDIRS = $(sparc_ARCHITECTURES) $(i386_ARCHITECTURES) sun4 sfmmu	\
2221167Skupfer	sun common
2231167SkupferCLOSED_XRDIRS = $(SHARED_XRDIRS:%=% ../../closed/uts/%)
2241167SkupferXRDIRS = $(SHARED_XRDIRS)
2255084SjohnlevCLOSED_XRDIRS_XEN = $(CLOSED_XRDIRS:../../closed/uts/i86xpv=)
2267612SSean.Ye@Sun.COMCLOSED_XRDIRS_1 = $(CLOSED_XRDIRS_XEN:../../closed/uts/i86pc=)
2277612SSean.Ye@Sun.COM$(CLOSED_BUILD)XRDIRS = $(CLOSED_XRDIRS_1:../../closed/uts/sfmmu=)
2281167Skupfer
2290Sstevel@tonic-gateXRINCDIRS = $(XRDIRS)
2300Sstevel@tonic-gate
2310Sstevel@tonic-gatecscope.out tags: FRC
2320Sstevel@tonic-gate	$(XREF) -x $@
2330Sstevel@tonic-gate
2340Sstevel@tonic-gateFRC:
235