1*7c478bd9Sstevel@tonic-gate# 2*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate# 4*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate# with the License. 8*7c478bd9Sstevel@tonic-gate# 9*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate# and limitations under the License. 13*7c478bd9Sstevel@tonic-gate# 14*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate# 20*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate# 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate# 26*7c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 27*7c478bd9Sstevel@tonic-gate# 28*7c478bd9Sstevel@tonic-gate# This makefile drives the production of /unix (and unix.o). 29*7c478bd9Sstevel@tonic-gate# 30*7c478bd9Sstevel@tonic-gate# sun4u implementation architecture dependent 31*7c478bd9Sstevel@tonic-gate# 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate# 34*7c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 35*7c478bd9Sstevel@tonic-gate# 36*7c478bd9Sstevel@tonic-gateUTSBASE = ../.. 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate# 39*7c478bd9Sstevel@tonic-gate# Define the module and object file sets. 40*7c478bd9Sstevel@tonic-gate# 41*7c478bd9Sstevel@tonic-gateUNIX = unix 42*7c478bd9Sstevel@tonic-gateOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 43*7c478bd9Sstevel@tonic-gate $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 44*7c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 45*7c478bd9Sstevel@tonic-gateLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 46*7c478bd9Sstevel@tonic-gate $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 47*7c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 48*7c478bd9Sstevel@tonic-gate $(LINTS_DIR)/vers.ln \ 49*7c478bd9Sstevel@tonic-gate $(LINTS_DIR)/modstubs.ln 50*7c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 51*7c478bd9Sstevel@tonic-gateUNIX32_LINK = $(ROOT_PSM_KERN_DIR_32)/$(UNIX) 52*7c478bd9Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gateKRTLD_32 = misc/krtld 55*7c478bd9Sstevel@tonic-gateKRTLD_64 = misc/$(SUBDIR64)/krtld 56*7c478bd9Sstevel@tonic-gateKRTLD = $(KRTLD_$(CLASS)) 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gateLIBS = $(GENLIB) $(PLATLIB) $(CPULIB) 59*7c478bd9Sstevel@tonic-gate 60*7c478bd9Sstevel@tonic-gateGENUNIX = genunix 61*7c478bd9Sstevel@tonic-gateGENUNIX_DIR = ../$(GENUNIX) 62*7c478bd9Sstevel@tonic-gateGENOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gateCPU_DIR = . 65*7c478bd9Sstevel@tonic-gateCPUOPTS = -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME) 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gatePLAT_DIR = ../platmod 68*7c478bd9Sstevel@tonic-gatePLATOPTS = -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD) 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gateLIBOPTS = $(GENOPTS) $(PLATOPTS) $(CPUOPTS) 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate# 75*7c478bd9Sstevel@tonic-gate# Include common rules. 76*7c478bd9Sstevel@tonic-gate# 77*7c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/Makefile.sun4u 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate# 80*7c478bd9Sstevel@tonic-gate# Define targets 81*7c478bd9Sstevel@tonic-gate# 82*7c478bd9Sstevel@tonic-gateALL_TARGET = $(UNIX_BIN) 83*7c478bd9Sstevel@tonic-gateLINT_TARGET = $(LINT_LIB) 84*7c478bd9Sstevel@tonic-gateINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK) 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate# 87*7c478bd9Sstevel@tonic-gate# This is UNIX_DIR. Use a short path. 88*7c478bd9Sstevel@tonic-gate# 89*7c478bd9Sstevel@tonic-gateUNIX_DIR = . 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate# 92*7c478bd9Sstevel@tonic-gate# Overrides 93*7c478bd9Sstevel@tonic-gate# 94*7c478bd9Sstevel@tonic-gateCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \ 95*7c478bd9Sstevel@tonic-gate $(OBJS_DIR)/vers.o $(CPU_OBJ) $(CPULIB) \ 96*7c478bd9Sstevel@tonic-gate $(DTRACESTUBS_O) $(DTRACESTUBS) 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gateCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 99*7c478bd9Sstevel@tonic-gateCLEANLINTFILES += $(LINT_LIB) 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate# 102*7c478bd9Sstevel@tonic-gate# lint pass one enforcement 103*7c478bd9Sstevel@tonic-gate# Turn on doubleword alignment for 64 bit counter timer registers 104*7c478bd9Sstevel@tonic-gate# 105*7c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) -dalign 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate# 108*7c478bd9Sstevel@tonic-gate# Default build targets. 109*7c478bd9Sstevel@tonic-gate# 110*7c478bd9Sstevel@tonic-gate.KEEP_STATE: 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gatelint: $(LINT_DEPS) 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 125*7c478bd9Sstevel@tonic-gate 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) $(DTRACESTUBS) 128*7c478bd9Sstevel@tonic-gate $(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \ 129*7c478bd9Sstevel@tonic-gate $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 130*7c478bd9Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 131*7c478bd9Sstevel@tonic-gate $(POST_PROCESS) 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate$(UNIX32_LINK): $(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN) 134*7c478bd9Sstevel@tonic-gate -$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@ 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gatesymcheck: $(UNIX_O) $(MODSTUBS_O) $(LIBS) 137*7c478bd9Sstevel@tonic-gate $(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \ 138*7c478bd9Sstevel@tonic-gate $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate#$(UNIX).glom: $(UNIX) 141*7c478bd9Sstevel@tonic-gate# ${LD} -dy -b -z nodefs -o $@ -e _start -I $(KRTLD) -M $(MAPFILE) \ 142*7c478bd9Sstevel@tonic-gate# $(UNIX_O) $(MODSTUBS_O) $(GENUNIX_DIR)/$(GENUNIX) 143*7c478bd9Sstevel@tonic-gate# $(POST_PROCESS) 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 146*7c478bd9Sstevel@tonic-gate $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate# 149*7c478bd9Sstevel@tonic-gate# Special rules for generating assym.h for inclusion in assembly files. 150*7c478bd9Sstevel@tonic-gate# 151*7c478bd9Sstevel@tonic-gate$(DSF_DIR)/$(OBJS_DIR)/assym.h: FRC 152*7c478bd9Sstevel@tonic-gate @cd $(DSF_DIR); $(MAKE) all.targ 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate$(GENLIB): FRC 155*7c478bd9Sstevel@tonic-gate @(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ) 156*7c478bd9Sstevel@tonic-gate @pwd 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate$(PLATLIB): 159*7c478bd9Sstevel@tonic-gate ?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ) 160*7c478bd9Sstevel@tonic-gate ?@pwd 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gate# 163*7c478bd9Sstevel@tonic-gate# CPU_OBJ now comprises of 2 object files which come from sun4 common 164*7c478bd9Sstevel@tonic-gate# and from architecture dependent code. OBJS_DIR is prepended where 165*7c478bd9Sstevel@tonic-gate# CPU_OBJ is defined to allow for building multiple CPU_OBJ's 166*7c478bd9Sstevel@tonic-gate# 167*7c478bd9Sstevel@tonic-gate$(CPULIB): $(CPU_OBJ) 168*7c478bd9Sstevel@tonic-gate $(LD) -o $@ -G -h 'cpu/$$CPU' $(CPU_OBJ) 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate# 171*7c478bd9Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 172*7c478bd9Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 173*7c478bd9Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 174*7c478bd9Sstevel@tonic-gate# 175*7c478bd9Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 176*7c478bd9Sstevel@tonic-gate# each module. It is important that the kernel lint library 177*7c478bd9Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 178*7c478bd9Sstevel@tonic-gate# 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 181*7c478bd9Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 182*7c478bd9Sstevel@tonic-gate @$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS) 183*7c478bd9Sstevel@tonic-gate @$(MV) $(@F) $@ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gatelintlib: $(LINT_DEPS) 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate# 188*7c478bd9Sstevel@tonic-gate# Include common targets. 189*7c478bd9Sstevel@tonic-gate# 190*7c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/sun4u/Makefile.targ 191*7c478bd9Sstevel@tonic-gate 192