xref: /onnv-gate/usr/src/uts/sun4v/unix/Makefile (revision 6094:3154969ecb41)
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
5580Swesolows# Common Development and Distribution License (the "License").
6580Swesolows# 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#
21580Swesolows
220Sstevel@tonic-gate#
23*6094Sakolb# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate# Use is subject to license terms.
250Sstevel@tonic-gate#
26580Swesolows# ident	"%Z%%M%	%I%	%E% SMI"
27580Swesolows#
28580Swesolows
290Sstevel@tonic-gate#
300Sstevel@tonic-gate#	This makefile drives the production of /unix (and unix.o).
310Sstevel@tonic-gate#
320Sstevel@tonic-gate#	sun4v implementation architecture dependent
330Sstevel@tonic-gate#
340Sstevel@tonic-gate
350Sstevel@tonic-gate#
360Sstevel@tonic-gate#	Path to the base of the uts directory tree (usually /usr/src/uts).
370Sstevel@tonic-gate#
380Sstevel@tonic-gateUTSBASE	= ../..
390Sstevel@tonic-gate
400Sstevel@tonic-gate#
410Sstevel@tonic-gate#	Define the module and object file sets.
420Sstevel@tonic-gate#
430Sstevel@tonic-gateUNIX		= unix
440Sstevel@tonic-gateOBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
450Sstevel@tonic-gate		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
460Sstevel@tonic-gate		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
470Sstevel@tonic-gateLINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
480Sstevel@tonic-gate		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
495648Ssetje		  $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \
500Sstevel@tonic-gate		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
510Sstevel@tonic-gate		  $(LINTS_DIR)/vers.ln \
520Sstevel@tonic-gate		  $(LINTS_DIR)/modstubs.ln
535648Ssetje
545648SsetjeKRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
555648SsetjeKRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
565648SsetjeKRTLD_O		= $(OBJS_DIR)/krtld.o
575648Ssetje
580Sstevel@tonic-gateROOTMODULE	= $(ROOT_PSM_KERN_DIR)/$(UNIX)
590Sstevel@tonic-gateUNIX32_LINK	= $(ROOT_PSM_KERN_DIR_32)/$(UNIX)
600Sstevel@tonic-gateUNIX_BIN	= $(OBJS_DIR)/$(UNIX)
610Sstevel@tonic-gate
620Sstevel@tonic-gateLIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
630Sstevel@tonic-gate
640Sstevel@tonic-gateGENUNIX		= genunix
650Sstevel@tonic-gateGENUNIX_DIR	= ../$(GENUNIX)
660Sstevel@tonic-gateGENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
670Sstevel@tonic-gate
680Sstevel@tonic-gateCPU_DIR		= .
690Sstevel@tonic-gateCPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
700Sstevel@tonic-gate
710Sstevel@tonic-gatePLAT_DIR	= ../platmod
720Sstevel@tonic-gatePLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
730Sstevel@tonic-gate
740Sstevel@tonic-gateLIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
750Sstevel@tonic-gate
760Sstevel@tonic-gateCTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
770Sstevel@tonic-gate
780Sstevel@tonic-gate#
790Sstevel@tonic-gate#	Include common rules.
800Sstevel@tonic-gate#
810Sstevel@tonic-gateinclude $(UTSBASE)/sun4v/Makefile.sun4v
820Sstevel@tonic-gate
830Sstevel@tonic-gate#
840Sstevel@tonic-gate#	Define targets
850Sstevel@tonic-gate#
860Sstevel@tonic-gateALL_TARGET	= $(UNIX_BIN)
870Sstevel@tonic-gateLINT_TARGET	= $(LINT_LIB)
880Sstevel@tonic-gateINSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
890Sstevel@tonic-gate
900Sstevel@tonic-gate#
910Sstevel@tonic-gate#	This is UNIX_DIR. Use a short path.
920Sstevel@tonic-gate#
930Sstevel@tonic-gateUNIX_DIR	= .
940Sstevel@tonic-gate
950Sstevel@tonic-gate#
960Sstevel@tonic-gate#	Overrides
970Sstevel@tonic-gate#
985648SsetjeCLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
995648Ssetje		   $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
1005648Ssetje		   $(CPU_OBJ) $(CPULIB) \
1010Sstevel@tonic-gate		   $(DTRACESTUBS_O) $(DTRACESTUBS)
1020Sstevel@tonic-gate
1030Sstevel@tonic-gateCLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
1040Sstevel@tonic-gateCLEANLINTFILES	+= $(LINT_LIB)
1050Sstevel@tonic-gate
1060Sstevel@tonic-gate#
1070Sstevel@tonic-gate# lint pass one enforcement
1080Sstevel@tonic-gate# Turn on doubleword alignment for 64 bit counter timer registers
1090Sstevel@tonic-gate#
1100Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) -dalign
1110Sstevel@tonic-gate
1120Sstevel@tonic-gate#
1133066Sjg# For now, disable these lint checks; maintainers should endeavor
1143066Sjg# to investigate and remove these for maximum lint coverage.
1153066Sjg# Please do not carry these forward to new Makefiles.
1163066Sjg#
1173066SjgLINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
1183066SjgLINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
1193066SjgLINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
1203066SjgLINTTAGS	+= -erroff=E_STATIC_UNUSED
1213066SjgLINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
1223066SjgLINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
1233066Sjg
1243066Sjg#
1250Sstevel@tonic-gate#	Default build targets.
1260Sstevel@tonic-gate#
1270Sstevel@tonic-gate.KEEP_STATE:
1280Sstevel@tonic-gate
1290Sstevel@tonic-gatedef:		$(DEF_DEPS)
1300Sstevel@tonic-gate
1310Sstevel@tonic-gateall:		$(ALL_DEPS)
1320Sstevel@tonic-gate
1330Sstevel@tonic-gateclean:		$(CLEAN_DEPS)
1340Sstevel@tonic-gate
1350Sstevel@tonic-gateclobber:	$(CLOBBER_DEPS)
1360Sstevel@tonic-gate
1370Sstevel@tonic-gatelint:		$(LINT_DEPS)
1380Sstevel@tonic-gate
1390Sstevel@tonic-gateclean.lint:	$(CLEAN_LINT_DEPS)
1400Sstevel@tonic-gate
1410Sstevel@tonic-gateinstall:  	$(INSTALL_DEPS)
1420Sstevel@tonic-gate
1430Sstevel@tonic-gate
1445648Ssetje$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
1455648Ssetje		$(DTRACESTUBS)
1465648Ssetje	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
1475648Ssetje	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
1480Sstevel@tonic-gate	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
1490Sstevel@tonic-gate	$(POST_PROCESS)
1500Sstevel@tonic-gate
1510Sstevel@tonic-gate$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
1520Sstevel@tonic-gate	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
1530Sstevel@tonic-gate
1545648Ssetjesymcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
1550Sstevel@tonic-gate	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
1565648Ssetje	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
1570Sstevel@tonic-gate
1580Sstevel@tonic-gate$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
1590Sstevel@tonic-gate	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
1600Sstevel@tonic-gate
1615648Ssetje$(KRTLD_O):	$(KRTLD_OBJECTS)
1625648Ssetje	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
1635648Ssetje
1640Sstevel@tonic-gate#
1650Sstevel@tonic-gate#	Special rules for generating assym.h for inclusion in assembly files.
1660Sstevel@tonic-gate#
1670Sstevel@tonic-gate$(DSF_DIR)/$(OBJS_DIR)/assym.h:	FRC
1680Sstevel@tonic-gate	@cd $(DSF_DIR); $(MAKE) all.targ
1690Sstevel@tonic-gate
1700Sstevel@tonic-gate$(GENLIB):	FRC
171*6094Sakolb	@pwd
1720Sstevel@tonic-gate	@(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ)
1730Sstevel@tonic-gate
1740Sstevel@tonic-gate$(PLATLIB):
175*6094Sakolb	?@pwd
1760Sstevel@tonic-gate	?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ)
1770Sstevel@tonic-gate
1780Sstevel@tonic-gate#
1790Sstevel@tonic-gate#	CPU_OBJ now comprises of 2 object files which come from sun4 common
1800Sstevel@tonic-gate#	and from architecture dependent code.  OBJS_DIR is prepended where
1810Sstevel@tonic-gate#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
1820Sstevel@tonic-gate#
1830Sstevel@tonic-gate$(CPULIB):	$(CPU_OBJ)
184580Swesolows	$(BUILD.SO) $(CPU_OBJ)
1850Sstevel@tonic-gate
1860Sstevel@tonic-gate#
1870Sstevel@tonic-gate#	The global lint target builds the kernel lint library (llib-lunix.ln)
1880Sstevel@tonic-gate#	which is equivalent to a lint of /unix.o. Then all kernel modules for
1890Sstevel@tonic-gate#	this architecture are linted against the kernel lint library.
1900Sstevel@tonic-gate#
1910Sstevel@tonic-gate#	Note:	lint errors in the kernel lint library will be repeated for
1920Sstevel@tonic-gate#		each module. It is important that the kernel lint library
1930Sstevel@tonic-gate#		be clean to keep the textual output to a reasonable level.
1940Sstevel@tonic-gate#
1950Sstevel@tonic-gate
1960Sstevel@tonic-gate$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
1970Sstevel@tonic-gate	@-$(ECHO) "\n$(UNIX): (library construction):"
1980Sstevel@tonic-gate	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
1990Sstevel@tonic-gate	@$(MV) $(@F) $@
2000Sstevel@tonic-gate
2010Sstevel@tonic-gatelintlib:	$(LINT_DEPS)
2020Sstevel@tonic-gate
2030Sstevel@tonic-gate#
2040Sstevel@tonic-gate#	Include common targets.
2050Sstevel@tonic-gate#
2060Sstevel@tonic-gateinclude $(UTSBASE)/$(PLATFORM)/Makefile.targ
2070Sstevel@tonic-gate
208