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# 285648Ssetje# This makefile drives the production of unix (and unix.o). 290Sstevel@tonic-gate# 300Sstevel@tonic-gate# sun4u 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) \ 475648Ssetje $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 480Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 490Sstevel@tonic-gate $(LINTS_DIR)/vers.ln \ 500Sstevel@tonic-gate $(LINTS_DIR)/modstubs.ln 515648Ssetje 525648SsetjeKRTLD_MAPFILE = $(UTSBASE)/sparc/krtld/mapfile 535648SsetjeKRTLD_OBJECTS = $(KRTLD_OBJS:%=$(OBJS_DIR)/%) 545648SsetjeKRTLD_O = $(OBJS_DIR)/krtld.o 555648Ssetje 560Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 570Sstevel@tonic-gateUNIX32_LINK = $(ROOT_PSM_KERN_DIR_32)/$(UNIX) 580Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 595648Ssetje#UNIX_GLOM = $(OBJS_DIR)/unix.glom 600Sstevel@tonic-gate 610Sstevel@tonic-gateLIBS = $(GENLIB) $(PLATLIB) $(CPULIB) 620Sstevel@tonic-gate 630Sstevel@tonic-gateGENUNIX = genunix 640Sstevel@tonic-gateGENUNIX_DIR = ../$(GENUNIX) 650Sstevel@tonic-gateGENOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 660Sstevel@tonic-gate 670Sstevel@tonic-gateCPU_DIR = . 680Sstevel@tonic-gateCPUOPTS = -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME) 690Sstevel@tonic-gate 700Sstevel@tonic-gatePLAT_DIR = ../platmod 710Sstevel@tonic-gatePLATOPTS = -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD) 720Sstevel@tonic-gate 730Sstevel@tonic-gateLIBOPTS = $(GENOPTS) $(PLATOPTS) $(CPUOPTS) 740Sstevel@tonic-gate 750Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 760Sstevel@tonic-gate 770Sstevel@tonic-gate# 780Sstevel@tonic-gate# Include common rules. 790Sstevel@tonic-gate# 800Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/Makefile.sun4u 810Sstevel@tonic-gate 820Sstevel@tonic-gate# 830Sstevel@tonic-gate# Define targets 840Sstevel@tonic-gate# 850Sstevel@tonic-gateALL_TARGET = $(UNIX_BIN) 860Sstevel@tonic-gateLINT_TARGET = $(LINT_LIB) 870Sstevel@tonic-gateINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK) 880Sstevel@tonic-gate 890Sstevel@tonic-gate# 900Sstevel@tonic-gate# This is UNIX_DIR. Use a short path. 910Sstevel@tonic-gate# 920Sstevel@tonic-gateUNIX_DIR = . 930Sstevel@tonic-gate 940Sstevel@tonic-gate# 950Sstevel@tonic-gate# Overrides 960Sstevel@tonic-gate# 975648SsetjeCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \ 985648Ssetje $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \ 995648Ssetje $(CPU_OBJ) $(CPULIB) \ 1000Sstevel@tonic-gate $(DTRACESTUBS_O) $(DTRACESTUBS) 1010Sstevel@tonic-gate 1020Sstevel@tonic-gateCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 1030Sstevel@tonic-gateCLEANLINTFILES += $(LINT_LIB) 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate# 1060Sstevel@tonic-gate# lint pass one enforcement 1070Sstevel@tonic-gate# Turn on doubleword alignment for 64 bit counter timer registers 1080Sstevel@tonic-gate# 1090Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) -dalign 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate# 1123066Sjg# For now, disable these lint checks; maintainers should endeavor 1133066Sjg# to investigate and remove these for maximum lint coverage. 1143066Sjg# Please do not carry these forward to new Makefiles. 1153066Sjg# 1163066SjgLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 1173066SjgLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 1183066SjgLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 1193066SjgLINTTAGS += -erroff=E_STATIC_UNUSED 1203066SjgLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 1213066SjgLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 1223066Sjg 1233066Sjg# 1240Sstevel@tonic-gate# Default build targets. 1250Sstevel@tonic-gate# 1260Sstevel@tonic-gate.KEEP_STATE: 1270Sstevel@tonic-gate 1280Sstevel@tonic-gatedef: $(DEF_DEPS) 1290Sstevel@tonic-gate 1300Sstevel@tonic-gateall: $(ALL_DEPS) 1310Sstevel@tonic-gate 1320Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1330Sstevel@tonic-gate 1340Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1350Sstevel@tonic-gate 1360Sstevel@tonic-gatelint: $(LINT_DEPS) 1370Sstevel@tonic-gate 1380Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 1390Sstevel@tonic-gate 1400Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate 1435648Ssetje$(UNIX_BIN): $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \ 1445648Ssetje $(DTRACESTUBS) 1455648Ssetje $(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \ 1465648Ssetje $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 1470Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 1480Sstevel@tonic-gate $(POST_PROCESS) 149*9507SJerry.Gilliam@Sun.COM $(CHK4UBINARY) 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# CPU_OBJ now comprises of 2 object files which come from sun4 common 1660Sstevel@tonic-gate# and from architecture dependent code. OBJS_DIR is prepended where 1670Sstevel@tonic-gate# CPU_OBJ is defined to allow for building multiple CPU_OBJ's 1680Sstevel@tonic-gate# 1690Sstevel@tonic-gate$(CPULIB): $(CPU_OBJ) 170580Swesolows $(BUILD.SO) $(CPU_OBJ) 1710Sstevel@tonic-gate 1726094Sakolb$(PLATLIB): 1736094Sakolb ?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ) 1746094Sakolb ?@pwd 1756094Sakolb 1760Sstevel@tonic-gate# 1770Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 1780Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 1790Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 1800Sstevel@tonic-gate# 1810Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 1820Sstevel@tonic-gate# each module. It is important that the kernel lint library 1830Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 1840Sstevel@tonic-gate# 1850Sstevel@tonic-gate 1860Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 1876094Sakolb @pwd 1880Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 1890Sstevel@tonic-gate @$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS) 1900Sstevel@tonic-gate @$(MV) $(@F) $@ 1910Sstevel@tonic-gate 1920Sstevel@tonic-gatelintlib: $(LINT_DEPS) 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate# 1950Sstevel@tonic-gate# Include common targets. 1960Sstevel@tonic-gate# 1970Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/Makefile.targ 1980Sstevel@tonic-gate 199