Makefile revision 7014882c6a3672fd0e5d60200af8643ae53c5928
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# CDDL HEADER START
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# The contents of this file are subject to the terms of the
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Common Development and Distribution License (the "License").
843e19887f64dde75055cf8842fc4db2171eff45johnlev# You may not use this file except in compliance with the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
843e19887f64dde75055cf8842fc4db2171eff45johnlev# or http://www.opensolaris.org/os/licensing.
843e19887f64dde75055cf8842fc4db2171eff45johnlev# See the License for the specific language governing permissions
843e19887f64dde75055cf8842fc4db2171eff45johnlev# and limitations under the License.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# When distributing Covered Code, include this CDDL HEADER in each
843e19887f64dde75055cf8842fc4db2171eff45johnlev# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
843e19887f64dde75055cf8842fc4db2171eff45johnlev# If applicable, add the following below this CDDL HEADER, with the
843e19887f64dde75055cf8842fc4db2171eff45johnlev# fields enclosed by brackets "[]" replaced with your own identifying
843e19887f64dde75055cf8842fc4db2171eff45johnlev# information: Portions Copyright [yyyy] [name of copyright owner]
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# CDDL HEADER END
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
98157a7002f4f2cf7978f3084ca5577f0a1d72b2akolb# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Use is subject to license terms.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# This makefile drives the production of unix (and unix.o).
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# i86xpv implementation architecture dependent
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Path to the base of the uts directory tree (usually /usr/src/uts).
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevUTSBASE = ../..
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Define the module and object file sets.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevUNIX = unix
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT = dboot
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevOBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(CORE_OBJS:%=$(OBJS_DIR)/%) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(LINTS_DIR)/vers.ln \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(LINTS_DIR)/modstubs.ln
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevUNIX_BIN = $(OBJS_DIR)/$(UNIX)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevLIBS = $(GENLIB)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevGENUNIX = genunix
843e19887f64dde75055cf8842fc4db2171eff45johnlevGENUNIX_DIR = ../../intel/$(GENUNIX)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevLIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevCTFEXTRAOBJS = $(OBJS_DIR)/vers.o
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_OBJS_DIR = dboot/$(OBJS_DIR)
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%)
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT)
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_O = $(OBJS_DIR)/$(DBOOT).o
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_S = $(DBOOT_O:%.o=%.s)
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_LINTS = $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln)
843e19887f64dde75055cf8842fc4db2171eff45johnlevDBOOT_LINT = $(LINT_$(MACH)_$(CLASS))
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Include common rules.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevinclude $(UTSBASE)/i86xpv/Makefile.i86xpv
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Define targets
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevALL_TARGET = $(UNIX_BIN)
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINT_TARGET = $(LINT_LIB) $(DBOOT_LINT_LIB)
843e19887f64dde75055cf8842fc4db2171eff45johnlevINSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# This is UNIX_DIR. Use a short path.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevUNIX_DIR = .
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Overrides
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevCLEANFILES += \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(UNIX_O) $(MODSTUBS_O) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(DTRACESTUBS_O) $(DTRACESTUBS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevCLEANFILES += \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(DBOOT_O) $(DBOOT_S) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(DBOOT_OBJECTS) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(DBOOT_BIN)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevCLOBBERFILES = $(CLEANFILES) $(UNIX_BIN)
843e19887f64dde75055cf8842fc4db2171eff45johnlevCLEANLINTFILES += $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev# instr_size needs a special header
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevCFLAGS += -DDIS_MEM
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# For now, disable these lint checks; maintainers should endeavor
843e19887f64dde75055cf8842fc4db2171eff45johnlev# to investigate and remove these for maximum lint coverage.
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Please do not carry these forward to new Makefiles.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_STATIC_UNUSED
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW
843e19887f64dde75055cf8842fc4db2171eff45johnlevLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
843e19887f64dde75055cf8842fc4db2171eff45johnlev
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-parentheses
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-uninitialized
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-char-subscripts
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-unused-variable
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-unused-function
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-unused-label
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-type-limits
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-clobbered
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-unused-value
7014882c6a3672fd0e5d60200af8643ae53c5928Richard LoweCERRWARN += -_gcc=-Wno-empty-body
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe
8793b36b40d14ad0a0fecc97738dc118a928f46cNick Todd# Ensure that lint sees 'struct cpu' containing a fully declared
8793b36b40d14ad0a0fecc97738dc118a928f46cNick Todd# embedded 'struct machcpu'
8793b36b40d14ad0a0fecc97738dc118a928f46cNick Todd#
8793b36b40d14ad0a0fecc97738dc118a928f46cNick ToddLINTFLAGS += -D_MACHDEP -I../../i86pc
8793b36b40d14ad0a0fecc97738dc118a928f46cNick Todd
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Default build targets.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev.KEEP_STATE:
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevdef: $(DEF_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevall: $(ALL_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevclean: $(CLEAN_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevclobber: $(CLOBBER_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevlint: $(LINT_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevclean.lint: $(CLEAN_LINT_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevinstall: $(INSTALL_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevMAPFILE_32 = $(MAPFILE)
843e19887f64dde75055cf8842fc4db2171eff45johnlevMAPFILE_64 = $(MAPFILE).amd64
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevMAPFILE_NAME = $(MAPFILE_$(CLASS))
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(GENLIB) $(DTRACESTUBS) $(DBOOT_O)
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(DTRACESTUBS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(POST_PROCESS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(LD) -dn -e _start -M dboot/Mapfile.dboot \
843e19887f64dde75055cf8842fc4db2171eff45johnlev -o $(DBOOT_BIN) $(DBOOT_OBJECTS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(DBOOT_O): $(DBOOT_BIN)
843e19887f64dde75055cf8842fc4db2171eff45johnlev @echo " .data" > $(DBOOT_S)
843e19887f64dde75055cf8842fc4db2171eff45johnlev @echo " .globl dboot_image" >> $(DBOOT_S)
843e19887f64dde75055cf8842fc4db2171eff45johnlev @echo "dboot_image:" >> $(DBOOT_S)
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S)
843e19887f64dde75055cf8842fc4db2171eff45johnlev $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(DBOOT_OBJS_DIR):
843e19887f64dde75055cf8842fc4db2171eff45johnlev -@mkdir -p $@ 2> /dev/null
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Special rules for generating assym.h for inclusion in assembly files.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC
843e19887f64dde75055cf8842fc4db2171eff45johnlev @cd $(DSF_DIR); $(MAKE) all.targ
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# The global lint target builds the kernel lint library (llib-lunix.ln)
843e19887f64dde75055cf8842fc4db2171eff45johnlev# which is equivalent to a lint of /unix.o. Then all kernel modules for
843e19887f64dde75055cf8842fc4db2171eff45johnlev# this architecture are linted against the kernel lint library.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Note: lint errors in the kernel lint library will be repeated for
843e19887f64dde75055cf8842fc4db2171eff45johnlev# each module. It is important that the kernel lint library
843e19887f64dde75055cf8842fc4db2171eff45johnlev# be clean to keep the textual output to a reasonable level.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS)
98157a7002f4f2cf7978f3084ca5577f0a1d72b2akolb @pwd
843e19887f64dde75055cf8842fc4db2171eff45johnlev @-$(ECHO) "\n$(UNIX): (library construction):"
843e19887f64dde75055cf8842fc4db2171eff45johnlev @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev @$(MV) $(@F) $@
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev$(DBOOT_LINT_LIB): $(LINT_LIB_DIR) $(DBOOT_LINTS)
98157a7002f4f2cf7978f3084ca5577f0a1d72b2akolb @pwd
843e19887f64dde75055cf8842fc4db2171eff45johnlev @-$(ECHO) "\n$(DBOOT): (library construction):"
843e19887f64dde75055cf8842fc4db2171eff45johnlev @$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev @$(MV) $(@F) $@
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlevlintlib: $(LINT_DEPS)
843e19887f64dde75055cf8842fc4db2171eff45johnlev
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlev# Include common targets.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#
843e19887f64dde75055cf8842fc4db2171eff45johnlevinclude $(UTSBASE)/i86xpv/Makefile.targ