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#pragma 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# i86pc 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-gate 43*7c478bd9Sstevel@tonic-gateOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 44*7c478bd9Sstevel@tonic-gate $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 45*7c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gateLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 48*7c478bd9Sstevel@tonic-gate $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 49*7c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 50*7c478bd9Sstevel@tonic-gate $(LINTS_DIR)/vers.ln \ 51*7c478bd9Sstevel@tonic-gate $(LINTS_DIR)/modstubs.ln 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gateKRTLD_32 = misc/krtld 58*7c478bd9Sstevel@tonic-gateKRTLD_64 = misc/$(SUBDIR64)/krtld 59*7c478bd9Sstevel@tonic-gateKRTLD = $(KRTLD_$(CLASS)) 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gateLIBS = $(GENLIB) 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gateGENUNIX = genunix 64*7c478bd9Sstevel@tonic-gateGENUNIX_DIR = ../../intel/$(GENUNIX) 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gateLIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate# 71*7c478bd9Sstevel@tonic-gate# Include common rules. 72*7c478bd9Sstevel@tonic-gate# 73*7c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.i86pc 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate# 76*7c478bd9Sstevel@tonic-gate# Define targets 77*7c478bd9Sstevel@tonic-gate# 78*7c478bd9Sstevel@tonic-gateALL_TARGET = $(UNIX_BIN) 79*7c478bd9Sstevel@tonic-gateLINT_TARGET = $(LINT_LIB) 80*7c478bd9Sstevel@tonic-gateINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate# 83*7c478bd9Sstevel@tonic-gate# This is UNIX_DIR. Use a short path. 84*7c478bd9Sstevel@tonic-gate# 85*7c478bd9Sstevel@tonic-gateUNIX_DIR = . 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate# 88*7c478bd9Sstevel@tonic-gate# Overrides 89*7c478bd9Sstevel@tonic-gate# 90*7c478bd9Sstevel@tonic-gateCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \ 91*7c478bd9Sstevel@tonic-gate $(OBJS_DIR)/vers.o \ 92*7c478bd9Sstevel@tonic-gate $(DTRACESTUBS_O) $(DTRACESTUBS) 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gateCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 95*7c478bd9Sstevel@tonic-gateCLEANLINTFILES += $(LINT_LIB) 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate# instr_size needs a special header 98*7c478bd9Sstevel@tonic-gate$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 99*7c478bd9Sstevel@tonic-gate$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gateCFLAGS += -DDIS_MEM 102*7c478bd9Sstevel@tonic-gate 103*7c478bd9Sstevel@tonic-gate# 104*7c478bd9Sstevel@tonic-gate# Default build targets. 105*7c478bd9Sstevel@tonic-gate# 106*7c478bd9Sstevel@tonic-gate.KEEP_STATE: 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gatelint: $(LINT_DEPS) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gateMAPFILE_32 = $(MAPFILE) 123*7c478bd9Sstevel@tonic-gateMAPFILE_64 = $(MAPFILE).amd64 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gateMAPFILE_NAME = $(MAPFILE_$(CLASS)) 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 128*7c478bd9Sstevel@tonic-gate $(GENLIB) $(DTRACESTUBS) 129*7c478bd9Sstevel@tonic-gate $(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE_NAME) \ 130*7c478bd9Sstevel@tonic-gate $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 131*7c478bd9Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 132*7c478bd9Sstevel@tonic-gate $(POST_PROCESS) 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 135*7c478bd9Sstevel@tonic-gate $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate# 138*7c478bd9Sstevel@tonic-gate# Special rules for generating assym.h for inclusion in assembly files. 139*7c478bd9Sstevel@tonic-gate# 140*7c478bd9Sstevel@tonic-gate$(DSF_DIR)/$(OBJS_DIR)/assym.h: FRC 141*7c478bd9Sstevel@tonic-gate @cd $(DSF_DIR); $(MAKE) all.targ 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate$(GENLIB): FRC 144*7c478bd9Sstevel@tonic-gate @(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ) 145*7c478bd9Sstevel@tonic-gate @pwd 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate# 148*7c478bd9Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 149*7c478bd9Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 150*7c478bd9Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 151*7c478bd9Sstevel@tonic-gate# 152*7c478bd9Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 153*7c478bd9Sstevel@tonic-gate# each module. It is important that the kernel lint library 154*7c478bd9Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 155*7c478bd9Sstevel@tonic-gate# 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 158*7c478bd9Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 159*7c478bd9Sstevel@tonic-gate @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS) 160*7c478bd9Sstevel@tonic-gate @$(MV) $(@F) $@ 161*7c478bd9Sstevel@tonic-gate 162*7c478bd9Sstevel@tonic-gatelintlib: $(LINT_DEPS) 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate# 165*7c478bd9Sstevel@tonic-gate# Include common targets. 166*7c478bd9Sstevel@tonic-gate# 167*7c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.targ 168