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 502e56f3fSwesolows# Common Development and Distribution License (the "License"). 602e56f3fSwesolows# 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# 2102e56f3fSwesolows 227c478bd9Sstevel@tonic-gate# 2398157a70Sakolb# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 2602e56f3fSwesolows 2702e56f3fSwesolows# 287c478bd9Sstevel@tonic-gate# This makefile drives the production of /unix (and unix.o). 297c478bd9Sstevel@tonic-gate# 307c478bd9Sstevel@tonic-gate# sun4v implementation architecture dependent 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate# 347c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gateUTSBASE = ../.. 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate# 397c478bd9Sstevel@tonic-gate# Define the module and object file sets. 407c478bd9Sstevel@tonic-gate# 417c478bd9Sstevel@tonic-gateUNIX = unix 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-gateLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 467c478bd9Sstevel@tonic-gate $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 47986fd29aSsetje $(KRTLD_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 51986fd29aSsetje 52986fd29aSsetjeKRTLD_MAPFILE = $(UTSBASE)/sparc/krtld/mapfile 53986fd29aSsetjeKRTLD_OBJECTS = $(KRTLD_OBJS:%=$(OBJS_DIR)/%) 54986fd29aSsetjeKRTLD_O = $(OBJS_DIR)/krtld.o 55986fd29aSsetje 567c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 577c478bd9Sstevel@tonic-gateUNIX32_LINK = $(ROOT_PSM_KERN_DIR_32)/$(UNIX) 587c478bd9Sstevel@tonic-gateUNIX_BIN = $(OBJS_DIR)/$(UNIX) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateLIBS = $(GENLIB) $(PLATLIB) $(CPULIB) 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gateGENUNIX = genunix 637c478bd9Sstevel@tonic-gateGENUNIX_DIR = ../$(GENUNIX) 647c478bd9Sstevel@tonic-gateGENOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gateCPU_DIR = . 677c478bd9Sstevel@tonic-gateCPUOPTS = -L $(CPU_DIR)/$(OBJS_DIR) -l $(CPUNAME) 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gatePLAT_DIR = ../platmod 707c478bd9Sstevel@tonic-gatePLATOPTS = -L $(PLAT_DIR)/$(OBJS_DIR) -l $(PLATMOD) 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gateLIBOPTS = $(GENOPTS) $(PLATOPTS) $(CPUOPTS) 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gateCTFEXTRAOBJS = $(OBJS_DIR)/vers.o 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate# 777c478bd9Sstevel@tonic-gate# Include common rules. 787c478bd9Sstevel@tonic-gate# 797c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/sun4v/Makefile.sun4v 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate# 827c478bd9Sstevel@tonic-gate# Define targets 837c478bd9Sstevel@tonic-gate# 847c478bd9Sstevel@tonic-gateALL_TARGET = $(UNIX_BIN) 857c478bd9Sstevel@tonic-gateLINT_TARGET = $(LINT_LIB) 867c478bd9Sstevel@tonic-gateINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) $(UNIX32_LINK) 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate# 897c478bd9Sstevel@tonic-gate# This is UNIX_DIR. Use a short path. 907c478bd9Sstevel@tonic-gate# 917c478bd9Sstevel@tonic-gateUNIX_DIR = . 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate# 947c478bd9Sstevel@tonic-gate# Overrides 957c478bd9Sstevel@tonic-gate# 96986fd29aSsetjeCLEANFILES += $(UNIX_O) $(MODSTUBS_O) $(KRTLD_O) $(KRTLD_OBJECTS) \ 97986fd29aSsetje $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \ 98986fd29aSsetje $(CPU_OBJ) $(CPULIB) \ 997c478bd9Sstevel@tonic-gate $(DTRACESTUBS_O) $(DTRACESTUBS) 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gateCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 1027c478bd9Sstevel@tonic-gateCLEANLINTFILES += $(LINT_LIB) 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate# 1057c478bd9Sstevel@tonic-gate# lint pass one enforcement 1067c478bd9Sstevel@tonic-gate# Turn on doubleword alignment for 64 bit counter timer registers 1077c478bd9Sstevel@tonic-gate# 1087c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE) -dalign 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate# 111bb25c06cSjg# For now, disable these lint checks; maintainers should endeavor 112bb25c06cSjg# to investigate and remove these for maximum lint coverage. 113bb25c06cSjg# Please do not carry these forward to new Makefiles. 114bb25c06cSjg# 115bb25c06cSjgLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 116bb25c06cSjgLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 117bb25c06cSjgLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 118bb25c06cSjgLINTTAGS += -erroff=E_STATIC_UNUSED 119bb25c06cSjgLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 120bb25c06cSjgLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 121bb25c06cSjg 122*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 123*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 124*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-char-subscripts 125*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 126*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function 127*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 128*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-type-limits 129*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 130*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-empty-body 131*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value 132*7014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 133*7014882cSRichard Lowe 134bb25c06cSjg# 1357c478bd9Sstevel@tonic-gate# Default build targets. 1367c478bd9Sstevel@tonic-gate# 1377c478bd9Sstevel@tonic-gate.KEEP_STATE: 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gatelint: $(LINT_DEPS) 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate 154986fd29aSsetje$(UNIX_BIN): $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(MAPFILE) $(LIBS) \ 155986fd29aSsetje $(DTRACESTUBS) 156986fd29aSsetje $(LD) -dy -b -o $@ -e _start -M $(MAPFILE) \ 157986fd29aSsetje $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 1587c478bd9Sstevel@tonic-gate $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 1597c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate$(UNIX32_LINK): $(ROOT_PSM_KERN_DIR_32) $(UNIX_BIN) 1627c478bd9Sstevel@tonic-gate -$(RM) $@; ln -s $(SUBDIR64)/$(UNIX) $@ 1637c478bd9Sstevel@tonic-gate 164986fd29aSsetjesymcheck: $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBS) 1657c478bd9Sstevel@tonic-gate $(LD) -dy -b -o $(SYM_MOD) -M $(MAPFILE) \ 166986fd29aSsetje $(UNIX_O) $(KRTLD_O) $(MODSTUBS_O) $(LIBOPTS) $(DTRACESTUBS) 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 1697c478bd9Sstevel@tonic-gate $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 1707c478bd9Sstevel@tonic-gate 171986fd29aSsetje$(KRTLD_O): $(KRTLD_OBJECTS) 172986fd29aSsetje $(LD) -r -o $@ -M$(KRTLD_MAPFILE) $(KRTLD_OBJECTS) 173986fd29aSsetje 1747c478bd9Sstevel@tonic-gate# 1757c478bd9Sstevel@tonic-gate# Special rules for generating assym.h for inclusion in assembly files. 1767c478bd9Sstevel@tonic-gate# 1777c478bd9Sstevel@tonic-gate$(DSF_DIR)/$(OBJS_DIR)/assym.h: FRC 1787c478bd9Sstevel@tonic-gate @cd $(DSF_DIR); $(MAKE) all.targ 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate$(GENLIB): FRC 1817c478bd9Sstevel@tonic-gate @pwd 18298157a70Sakolb @(cd $(GENLIB_DIR); pwd; $(MAKE) all.targ) 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate$(PLATLIB): 1857c478bd9Sstevel@tonic-gate ?@pwd 18698157a70Sakolb ?@(cd $(PLAT_DIR); pwd; $(MAKE) all.targ) 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate# 1897c478bd9Sstevel@tonic-gate# CPU_OBJ now comprises of 2 object files which come from sun4 common 1907c478bd9Sstevel@tonic-gate# and from architecture dependent code. OBJS_DIR is prepended where 1917c478bd9Sstevel@tonic-gate# CPU_OBJ is defined to allow for building multiple CPU_OBJ's 1927c478bd9Sstevel@tonic-gate# 1937c478bd9Sstevel@tonic-gate$(CPULIB): $(CPU_OBJ) 19402e56f3fSwesolows $(BUILD.SO) $(CPU_OBJ) 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate# 1977c478bd9Sstevel@tonic-gate# The global lint target builds the kernel lint library (llib-lunix.ln) 1987c478bd9Sstevel@tonic-gate# which is equivalent to a lint of /unix.o. Then all kernel modules for 1997c478bd9Sstevel@tonic-gate# this architecture are linted against the kernel lint library. 2007c478bd9Sstevel@tonic-gate# 2017c478bd9Sstevel@tonic-gate# Note: lint errors in the kernel lint library will be repeated for 2027c478bd9Sstevel@tonic-gate# each module. It is important that the kernel lint library 2037c478bd9Sstevel@tonic-gate# be clean to keep the textual output to a reasonable level. 2047c478bd9Sstevel@tonic-gate# 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 2077c478bd9Sstevel@tonic-gate @-$(ECHO) "\n$(UNIX): (library construction):" 2087c478bd9Sstevel@tonic-gate @$(LINT) -o $(UNIX) $(LINTFLAGS) $(LINTS) 2097c478bd9Sstevel@tonic-gate @$(MV) $(@F) $@ 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gatelintlib: $(LINT_DEPS) 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate# 2147c478bd9Sstevel@tonic-gate# Include common targets. 2157c478bd9Sstevel@tonic-gate# 2167c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/$(PLATFORM)/Makefile.targ 2177c478bd9Sstevel@tonic-gate 218