xref: /onnv-gate/usr/src/uts/sun4u/starfire/unix/Makefile (revision 9507:e6271d3ec9f2)
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*9507SJerry.Gilliam@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate# Use is subject to license terms.
250Sstevel@tonic-gate#
26580Swesolows
270Sstevel@tonic-gate#
280Sstevel@tonic-gate#	This makefile drives the production of unix (and unix.o).
290Sstevel@tonic-gate#
300Sstevel@tonic-gate#	sun4u starfire implementation architecture dependent
310Sstevel@tonic-gate#
320Sstevel@tonic-gate
330Sstevel@tonic-gate#
340Sstevel@tonic-gate#	Path to the base of the uts directory tree (usually /usr/src/uts).
350Sstevel@tonic-gate#
360Sstevel@tonic-gateUTSBASE	= ../../..
370Sstevel@tonic-gate
380Sstevel@tonic-gate#
390Sstevel@tonic-gate#	Define the module and object file sets.
400Sstevel@tonic-gate#
410Sstevel@tonic-gateUNIX		= unix
420Sstevel@tonic-gateOBJECTS		= $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
430Sstevel@tonic-gate		  $(CORE_OBJS:%=$(OBJS_DIR)/%) \
440Sstevel@tonic-gate		  $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
450Sstevel@tonic-gateLINTS		= $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
460Sstevel@tonic-gate		  $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
470Sstevel@tonic-gate		  $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
480Sstevel@tonic-gate		  $(LINTS_DIR)/vers.ln \
490Sstevel@tonic-gate		  $(LINTS_DIR)/modstubs.ln
505648Ssetje
515648SsetjeKRTLD_MAPFILE	= $(UTSBASE)/sparc/krtld/mapfile
525648SsetjeKRTLD_OBJECTS	= $(KRTLD_OBJS:%=$(OBJS_DIR)/%)
535648SsetjeKRTLD_O		= $(OBJS_DIR)/krtld.o
545648Ssetje
550Sstevel@tonic-gateROOTMODULE	= $(ROOT_STARFIRE_KERN_DIR)/$(UNIX)
560Sstevel@tonic-gateUNIX32_LINK	= $(ROOT_STARFIRE_KERN_DIR_32)/$(UNIX)
570Sstevel@tonic-gateUNIX_BIN	= $(OBJS_DIR)/$(UNIX)
580Sstevel@tonic-gate
590Sstevel@tonic-gateLIBS		= $(GENLIB) $(PLATLIB) $(CPULIB)
600Sstevel@tonic-gate
610Sstevel@tonic-gateGENUNIX		= genunix
620Sstevel@tonic-gateGENUNIX_DIR	= ../../$(GENUNIX)
630Sstevel@tonic-gateGENOPTS		= -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
640Sstevel@tonic-gate
650Sstevel@tonic-gateCPU_DIR		= .
660Sstevel@tonic-gateCPUOPTS		= -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME)
670Sstevel@tonic-gate
680Sstevel@tonic-gatePLAT_DIR	= ../../platmod
690Sstevel@tonic-gatePLATOPTS	= -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD)
700Sstevel@tonic-gate
710Sstevel@tonic-gateLIBOPTS		= $(GENOPTS) $(PLATOPTS) $(CPUOPTS)
720Sstevel@tonic-gate
730Sstevel@tonic-gateCTFEXTRAOBJS	= $(OBJS_DIR)/vers.o
740Sstevel@tonic-gate
750Sstevel@tonic-gate#
760Sstevel@tonic-gate#	Include common rules.
770Sstevel@tonic-gate#
780Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/starfire/Makefile.starfire
790Sstevel@tonic-gate
800Sstevel@tonic-gate#
810Sstevel@tonic-gate#	Define targets
820Sstevel@tonic-gate#
830Sstevel@tonic-gateALL_TARGET	= $(UNIX_BIN)
840Sstevel@tonic-gateLINT_TARGET	= $(LINT_LIB)
850Sstevel@tonic-gateINSTALL_TARGET	= $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK)
860Sstevel@tonic-gate
870Sstevel@tonic-gate#
880Sstevel@tonic-gate#	This is UNIX_DIR. Use a short path.
890Sstevel@tonic-gate#
900Sstevel@tonic-gateUNIX_DIR	= .
910Sstevel@tonic-gate
920Sstevel@tonic-gate#
930Sstevel@tonic-gate#	Overrides
940Sstevel@tonic-gate#
955648SsetjeCLEANFILES	+= $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \
965648Ssetje		   $(OBJS_DIR)/vers.c  $(OBJS_DIR)/vers.o \
975648Ssetje		   $(CPU_OBJ) $(CPULIB) \
980Sstevel@tonic-gate		   $(DTRACESTUBS_O) $(DTRACESTUBS)
990Sstevel@tonic-gate
1000Sstevel@tonic-gateCLOBBERFILES	= $(CLEANFILES) $(UNIX_BIN)
1010Sstevel@tonic-gateCLEANLINTFILES	+= $(LINT_LIB)
1020Sstevel@tonic-gate
1030Sstevel@tonic-gate#
1040Sstevel@tonic-gate# lint pass one enforcement
1050Sstevel@tonic-gate# Turn on doubleword alignment for 64 bit counter timer registers
1060Sstevel@tonic-gate#
1070Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) -dalign
1080Sstevel@tonic-gate
1090Sstevel@tonic-gate#
1100Sstevel@tonic-gate#	Default build targets.
1110Sstevel@tonic-gate#
1120Sstevel@tonic-gate.KEEP_STATE:
1130Sstevel@tonic-gate
1140Sstevel@tonic-gatedef:		$(DEF_DEPS)
1150Sstevel@tonic-gate
1160Sstevel@tonic-gateall:		$(ALL_DEPS)
1170Sstevel@tonic-gate
1180Sstevel@tonic-gateclean:		$(CLEAN_DEPS)
1190Sstevel@tonic-gate
1200Sstevel@tonic-gateclobber:	$(CLOBBER_DEPS)
1210Sstevel@tonic-gate
1220Sstevel@tonic-gatelint:		$(LINT_DEPS)
1230Sstevel@tonic-gate
1240Sstevel@tonic-gateclean.lint:	$(CLEAN_LINT_DEPS)
1250Sstevel@tonic-gate
1260Sstevel@tonic-gateinstall:  	$(INSTALL_DEPS)
1270Sstevel@tonic-gate
1285648Ssetje$(UNIX_BIN):	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \
1295648Ssetje		$(DTRACESTUBS)
1305648Ssetje	$(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \
1315648Ssetje	    $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
1320Sstevel@tonic-gate	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
1330Sstevel@tonic-gate	$(POST_PROCESS)
134*9507SJerry.Gilliam@Sun.COM	$(CHK4UBINARY)
1350Sstevel@tonic-gate
1360Sstevel@tonic-gate$(UNIX32_LINK):	$(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN)
1370Sstevel@tonic-gate	-$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@
1380Sstevel@tonic-gate
1395648Ssetjesymcheck:	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS)
1400Sstevel@tonic-gate	$(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \
1415648Ssetje	$(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS)
1420Sstevel@tonic-gate
1430Sstevel@tonic-gate$(UNIX_O):	$(OBJECTS) $(OBJS_DIR)/vers.o
1440Sstevel@tonic-gate	$(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
1450Sstevel@tonic-gate
1465648Ssetje$(KRTLD_O):	$(KRTLD_OBJECTS)
1475648Ssetje	$(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS)
1485648Ssetje
1490Sstevel@tonic-gate#
1500Sstevel@tonic-gate#	CPU_OBJ now comprises of 2 object files which come from sun4 common
1510Sstevel@tonic-gate#	and from architecture dependent code.  OBJS_DIR is prepended where
1520Sstevel@tonic-gate#	CPU_OBJ is defined to allow for building multiple CPU_OBJ's
1530Sstevel@tonic-gate#
1540Sstevel@tonic-gate$(CPULIB):	$(CPU_OBJ)
155580Swesolows	$(BUILD.SO) $(CPU_OBJ)
1560Sstevel@tonic-gate
1570Sstevel@tonic-gate#
1580Sstevel@tonic-gate#	The global lint target builds the kernel lint library (llib-lunix.ln)
1590Sstevel@tonic-gate#	which is equivalent to a lint of /unix.o. Then all kernel modules for
1600Sstevel@tonic-gate#	this architecture are linted against the kernel lint library.
1610Sstevel@tonic-gate#
1620Sstevel@tonic-gate#	Note:	lint errors in the kernel lint library will be repeated for
1630Sstevel@tonic-gate#		each module. It is important that the kernel lint library
1640Sstevel@tonic-gate#		be clean to keep the textual output to a reasonable level.
1650Sstevel@tonic-gate#
1660Sstevel@tonic-gate
1670Sstevel@tonic-gate$(LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
1680Sstevel@tonic-gate	@-$(ECHO) "\n$(UNIX): (library construction):"
1690Sstevel@tonic-gate	@$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS)
1700Sstevel@tonic-gate	@$(MV) $(@F) $@
1710Sstevel@tonic-gate
1720Sstevel@tonic-gatelintlib:	$(LINT_DEPS)
1730Sstevel@tonic-gate
1740Sstevel@tonic-gate#
1750Sstevel@tonic-gate#	Include common targets.
1760Sstevel@tonic-gate#
1770Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/starfire/Makefile.targ
178