17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 5*bb25c06cSjg# Common Development and Distribution License (the "License"). 6*bb25c06cSjg# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 217c478bd9Sstevel@tonic-gate# 22*bb25c06cSjg# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate# Use is subject to license terms. 247c478bd9Sstevel@tonic-gate# 25*bb25c06cSjg#ident "%Z%%M% %I% %E% SMI" 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate# This makefile drives the production of /unix (and unix.o). 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate# i86pc implementation architecture dependent 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate# 337c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gateUTSBASE = ../.. 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate# 387c478bd9Sstevel@tonic-gate# Define the module and object file sets. 397c478bd9Sstevel@tonic-gate# 407c478bd9Sstevel@tonic-gateUNIX = unix 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gateOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 437c478bd9Sstevel@tonic-gate $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 447c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gateLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 477c478bd9Sstevel@tonic-gate $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 487c478bd9Sstevel@tonic-gate $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 497c478bd9Sstevel@tonic-gate $(LINTS_DIR)/vers.ln \ 507c478bd9Sstevel@tonic-gate $(LINTS_DIR)/modstubs.ln 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gateKRTLD_32 = misc/krtld 577c478bd9Sstevel@tonic-gateKRTLD_64 = misc/$(SUBDIR64)/krtld 587c478bd9Sstevel@tonic-gateKRTLD = $(KRTLD_$(CLASS)) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateLIBS = $(GENLIB) 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gateGENUNIX = genunix 637c478bd9Sstevel@tonic-gateGENUNIX_DIR = ../../intel/$(GENUNIX) 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gateLIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate# 707c478bd9Sstevel@tonic-gate# Include common rules. 717c478bd9Sstevel@tonic-gate# 727c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.i86pc 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate# 757c478bd9Sstevel@tonic-gate# Define targets 767c478bd9Sstevel@tonic-gate# 777c478bd9Sstevel@tonic-gateALL_TARGET = $(UNIX_BIN) 787c478bd9Sstevel@tonic-gateLINT_TARGET = $(LINT_LIB) 797c478bd9Sstevel@tonic-gateINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate# 827c478bd9Sstevel@tonic-gate# This is UNIX_DIR. Use a short path. 837c478bd9Sstevel@tonic-gate# 847c478bd9Sstevel@tonic-gateUNIX_DIR = . 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate# 877c478bd9Sstevel@tonic-gate# Overrides 887c478bd9Sstevel@tonic-gate# 897c478bd9Sstevel@tonic-gateCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(OBJS_DIR)/vers.c \ 907c478bd9Sstevel@tonic-gate $(OBJS_DIR)/vers.o \ 917c478bd9Sstevel@tonic-gate $(DTRACESTUBS_O) $(DTRACESTUBS) 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gateCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 947c478bd9Sstevel@tonic-gateCLEANLINTFILES += $(LINT_LIB) 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate# instr_size needs a special header 977c478bd9Sstevel@tonic-gate$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 987c478bd9Sstevel@tonic-gate$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gateCFLAGS += -DDIS_MEM 1017c478bd9Sstevel@tonic-gate 1027c478bd9Sstevel@tonic-gate# 103*bb25c06cSjg# For now, disable these lint checks; maintainers should endeavor 104*bb25c06cSjg# to investigate and remove these for maximum lint coverage. 105*bb25c06cSjg# Please do not carry these forward to new Makefiles. 106*bb25c06cSjg# 107*bb25c06cSjgLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 108*bb25c06cSjgLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 109*bb25c06cSjgLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 110*bb25c06cSjgLINTTAGS += -erroff=E_STATIC_UNUSED 111*bb25c06cSjgLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 112*bb25c06cSjgLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 113*bb25c06cSjg 114*bb25c06cSjg# 1157c478bd9Sstevel@tonic-gate# Default build targets. 1167c478bd9Sstevel@tonic-gate# 1177c478bd9Sstevel@tonic-gate.KEEP_STATE: 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gatelint: $(LINT_DEPS) 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gateMAPFILE_32 = $(MAPFILE) 1347c478bd9Sstevel@tonic-gateMAPFILE_64 = $(MAPFILE).amd64 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gateMAPFILE_NAME = $(MAPFILE_$(CLASS)) 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 1397c478bd9Sstevel@tonic-gate $(GENLIB) $(DTRACESTUBS) 1407c478bd9Sstevel@tonic-gate $(LD) -dy -b -o $@ -e _start -I $(KRTLD) -M $(MAPFILE_NAME) \ 1417c478bd9Sstevel@tonic-gate $(UNIX_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 1427c478bd9Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 1437c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 1467c478bd9Sstevel@tonic-gate $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate# 1497c478bd9Sstevel@tonic-gate# Special rules for generating assym.h for inclusion in assembly files. 1507c478bd9Sstevel@tonic-gate# 1517c478bd9Sstevel@tonic-gate$(DSF_DIR)/$(OBJS_DIR)/assym.h: FRC 1527c478bd9Sstevel@tonic-gate @cd $(DSF_DIR); $(MAKE) all.targ 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate$(GENLIB): FRC 1557c478bd9Sstevel@tonic-gate @(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ) 1567c478bd9Sstevel@tonic-gate @pwd 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate# 1597c478bd9Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 1607c478bd9Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 1617c478bd9Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 1627c478bd9Sstevel@tonic-gate# 1637c478bd9Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 1647c478bd9Sstevel@tonic-gate# each module. It is important that the kernel lint library 1657c478bd9Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 1667c478bd9Sstevel@tonic-gate# 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 1697c478bd9Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 1707c478bd9Sstevel@tonic-gate @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS) 1717c478bd9Sstevel@tonic-gate @$(MV) $(@F) $@ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gatelintlib: $(LINT_DEPS) 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate# 1767c478bd9Sstevel@tonic-gate# Include common targets. 1777c478bd9Sstevel@tonic-gate# 1787c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.targ 179