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 53066Sjg# Common Development and Distribution License (the "License"). 63066Sjg# 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# 213446Smrj 220Sstevel@tonic-gate# 236094Sakolb# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate# Use is subject to license terms. 250Sstevel@tonic-gate# 263446Smrj# This makefile drives the production of unix (and unix.o). 270Sstevel@tonic-gate# 280Sstevel@tonic-gate# i86pc implementation architecture dependent 290Sstevel@tonic-gate# 300Sstevel@tonic-gate 310Sstevel@tonic-gate# 320Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 330Sstevel@tonic-gate# 340Sstevel@tonic-gateUTSBASE = ../.. 350Sstevel@tonic-gate 360Sstevel@tonic-gate# 370Sstevel@tonic-gate# Define the module and object file sets. 380Sstevel@tonic-gate# 390Sstevel@tonic-gateUNIX = unix 403446SmrjDBOOT = dboot 413446SmrjMULTIBOOT = multiboot 420Sstevel@tonic-gate 430Sstevel@tonic-gateOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 440Sstevel@tonic-gate $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 453446Smrj $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \ 460Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 470Sstevel@tonic-gate 480Sstevel@tonic-gateLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 490Sstevel@tonic-gate $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 503446Smrj $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 510Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 520Sstevel@tonic-gate $(LINTS_DIR)/vers.ln \ 530Sstevel@tonic-gate $(LINTS_DIR)/modstubs.ln 540Sstevel@tonic-gate 550Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 563446SmrjROOT_MULTIBOOT = $(ROOT_PSM_DIR)/$(MULTIBOOT) 570Sstevel@tonic-gate 580Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 590Sstevel@tonic-gate 600Sstevel@tonic-gateLIBS = $(GENLIB) 610Sstevel@tonic-gate 620Sstevel@tonic-gateGENUNIX = genunix 630Sstevel@tonic-gateGENUNIX_DIR = ../../intel/$(GENUNIX) 640Sstevel@tonic-gate 650Sstevel@tonic-gateLIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 660Sstevel@tonic-gate 670Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 680Sstevel@tonic-gate 693446SmrjDBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 703446SmrjDBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%) 715084SjohnlevDBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT) 723446SmrjDBOOT_O = $(OBJS_DIR)/$(DBOOT).o 733446SmrjDBOOT_S = $(DBOOT_O:%.o=%.s) 743446SmrjDBOOT_LINTS = $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln) 753446SmrjDBOOT_LINT = $(i386_LINT) 764088SrscottDBOOT_LINTTAGS = -erroff=E_STATIC_UNUSED 773446Smrj 780Sstevel@tonic-gate# 790Sstevel@tonic-gate# Include common rules. 800Sstevel@tonic-gate# 810Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.i86pc 820Sstevel@tonic-gate 830Sstevel@tonic-gate# 840Sstevel@tonic-gate# Define targets 850Sstevel@tonic-gate# 863446SmrjALL_TARGET = $(UNIX_BIN) $(MULTIBOOT) 873446SmrjLINT_TARGET = $(LINT_LIB) $(DBOOT_LINT_LIB) 885084SjohnlevINSTALL_TARGET = $(UNIX_BIN) $(MULTIBOOT) $(ROOTMODULE) $(ROOT_MULTIBOOT) 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# 983446SmrjCLEANFILES += \ 993446Smrj $(UNIX_O) $(MODSTUBS_O) \ 1003446Smrj $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \ 1013446Smrj $(DTRACESTUBS_O) $(DTRACESTUBS) 1020Sstevel@tonic-gate 1033446SmrjCLEANFILES += \ 1043446Smrj $(DBOOT_O) $(DBOOT_S) \ 1053446Smrj $(DBOOT_OBJECTS) \ 1063446Smrj $(OBJS_DIR)/bios_call_src.o \ 1073446Smrj $(OBJS_DIR)/bios_call_src \ 1083446Smrj $(OBJS_DIR)/bios_call.s \ 1095084Sjohnlev $(DBOOT_BIN) 1103446Smrj 111*7656SSherry.Moore@Sun.COMCLEANFILES += \ 112*7656SSherry.Moore@Sun.COM $(OBJS_DIR)/fb_swtch_src.o \ 113*7656SSherry.Moore@Sun.COM $(OBJS_DIR)/fb_swtch_src \ 114*7656SSherry.Moore@Sun.COM $(OBJS_DIR)/fb_swtch.s 115*7656SSherry.Moore@Sun.COM 1163446SmrjCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) $(MULTIBOOT) 1173446SmrjCLEANLINTFILES += $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS) 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate# instr_size needs a special header 1200Sstevel@tonic-gate$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 1210Sstevel@tonic-gate$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 1220Sstevel@tonic-gate 1230Sstevel@tonic-gateCFLAGS += -DDIS_MEM 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate# 1263066Sjg# For now, disable these lint checks; maintainers should endeavor 1273066Sjg# to investigate and remove these for maximum lint coverage. 1283066Sjg# Please do not carry these forward to new Makefiles. 1293066Sjg# 1303066SjgLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 1313066SjgLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 1323066SjgLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 1333066SjgLINTTAGS += -erroff=E_STATIC_UNUSED 1343066SjgLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 1353066SjgLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 1363066Sjg 1377632SNick.Todd@Sun.COM# Ensure that lint sees 'struct cpu' containing a fully declared 1387632SNick.Todd@Sun.COM# embedded 'struct machcpu' 1397632SNick.Todd@Sun.COM# 1407632SNick.Todd@Sun.COMLINTFLAGS += -D_MACHDEP -I../../i86pc 1417632SNick.Todd@Sun.COM 1423066Sjg# 1430Sstevel@tonic-gate# Default build targets. 1440Sstevel@tonic-gate# 1450Sstevel@tonic-gate.KEEP_STATE: 1460Sstevel@tonic-gate 1470Sstevel@tonic-gatedef: $(DEF_DEPS) 1480Sstevel@tonic-gate 1490Sstevel@tonic-gateall: $(ALL_DEPS) 1500Sstevel@tonic-gate 1510Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1520Sstevel@tonic-gate 1530Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1540Sstevel@tonic-gate 1550Sstevel@tonic-gatelint: $(LINT_DEPS) 1560Sstevel@tonic-gate 1570Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 1580Sstevel@tonic-gate 1590Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1600Sstevel@tonic-gate 1610Sstevel@tonic-gateMAPFILE_32 = $(MAPFILE) 1620Sstevel@tonic-gateMAPFILE_64 = $(MAPFILE).amd64 1630Sstevel@tonic-gate 1640Sstevel@tonic-gateMAPFILE_NAME = $(MAPFILE_$(CLASS)) 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 1673446Smrj $(GENLIB) $(DTRACESTUBS) $(DBOOT_O) 1683446Smrj $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \ 1693446Smrj $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \ 1703446Smrj $(DTRACESTUBS) 1713446Smrj $(MBH_PATCH) $(UNIX_BIN) 1720Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 1730Sstevel@tonic-gate $(POST_PROCESS) 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 1760Sstevel@tonic-gate $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 1770Sstevel@tonic-gate 1785084Sjohnlev$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot 1795084Sjohnlev $(LD) -dn -e _start -M dboot/Mapfile.dboot \ 1805084Sjohnlev -o $(DBOOT_BIN) $(DBOOT_OBJECTS) 1815084Sjohnlev 1825084Sjohnlev$(DBOOT_O): $(DBOOT_BIN) 1833446Smrj @echo " .data" > $(DBOOT_S) 1843446Smrj @echo " .globl dboot_image" >> $(DBOOT_S) 1853446Smrj @echo "dboot_image:" >> $(DBOOT_S) 1865084Sjohnlev $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S) 1873446Smrj $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S) 1883446Smrj 1893446Smrj$(DBOOT_OBJS_DIR): 1903446Smrj -@mkdir -p $@ 2> /dev/null 1913446Smrj 1923446Smrj# 1933446Smrj# dboot is built as an intermediate target in dboot.o, so just make 1943446Smrj# dboot.o the dependency here. 1953446Smrj# 1963446Smrj$(MULTIBOOT): $(DBOOT_O) 1975084Sjohnlev $(CP) $(DBOOT_BIN) $(MULTIBOOT) 1983446Smrj $(POST_PROCESS) 1993446Smrj 2000Sstevel@tonic-gate# 2010Sstevel@tonic-gate# Special rules for generating assym.h for inclusion in assembly files. 2020Sstevel@tonic-gate# 2033446Smrj$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC 2040Sstevel@tonic-gate @cd $(DSF_DIR); $(MAKE) all.targ 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate# 2070Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 2080Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 2090Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 2100Sstevel@tonic-gate# 2110Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 2120Sstevel@tonic-gate# each module. It is important that the kernel lint library 2130Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 2140Sstevel@tonic-gate# 2150Sstevel@tonic-gate 2160Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 2176094Sakolb @pwd 2180Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 2190Sstevel@tonic-gate @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS) 2200Sstevel@tonic-gate @$(MV) $(@F) $@ 2210Sstevel@tonic-gate 2223446Smrj$(DBOOT_LINT_LIB): $(LINT_LIB_DIR) $(DBOOT_LINTS) 2236094Sakolb @pwd 2243446Smrj @-$(ECHO) "\n$(DBOOT): (library construction):" 2253446Smrj @$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS) 2263446Smrj @$(MV) $(@F) $@ 2273446Smrj 2280Sstevel@tonic-gatelintlib: $(LINT_DEPS) 2290Sstevel@tonic-gate 2300Sstevel@tonic-gate# 2310Sstevel@tonic-gate# Include common targets. 2320Sstevel@tonic-gate# 2330Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.targ 234