1# 2# CDDL HEADER START 3# 4# The contents of this file are subject to the terms of the 5# Common Development and Distribution License (the "License"). 6# You may not use this file except in compliance with the License. 7# 8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9# or http://www.opensolaris.org/os/licensing. 10# See the License for the specific language governing permissions 11# and limitations under the License. 12# 13# When distributing Covered Code, include this CDDL HEADER in each 14# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15# If applicable, add the following below this CDDL HEADER, with the 16# fields enclosed by brackets "[]" replaced with your own identifying 17# information: Portions Copyright [yyyy] [name of copyright owner] 18# 19# CDDL HEADER END 20# 21 22# 23# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# This makefile drives the production of unix (and unix.o). 27# 28# i86pc implementation architecture dependent 29# 30 31# 32# Path to the base of the uts directory tree (usually /usr/src/uts). 33# 34UTSBASE = ../.. 35 36# 37# Define the module and object file sets. 38# 39UNIX = unix 40DBOOT = dboot 41MULTIBOOT = multiboot 42 43OBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 44 $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 45 $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \ 46 $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 47 48LINTS = $(SPECIAL_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 49 $(CORE_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 50 $(KRTLD_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 51 $(MACH_NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) \ 52 $(LINTS_DIR)/vers.ln \ 53 $(LINTS_DIR)/modstubs.ln 54 55ROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 56ROOT_MULTIBOOT = $(ROOT_PSM_DIR)/$(MULTIBOOT) 57 58UNIX_BIN = $(OBJS_DIR)/$(UNIX) 59 60LIBS = $(GENLIB) 61 62GENUNIX = genunix 63GENUNIX_DIR = ../../intel/$(GENUNIX) 64 65LIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 66 67COMMP_CTF_SRC = $(OBJS_DIR)/comm_page_ctf.c 68 69CTFEXTRAOBJS = $(OBJS_DIR)/vers.o $(OBJS_DIR)/comm_page_ctf.o 70 71DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 72DBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%) 73DBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT) 74DBOOT_O = $(OBJS_DIR)/$(DBOOT).o 75DBOOT_S = $(DBOOT_O:%.o=%.s) 76DBOOT_LINTS = $(DBOOT_OBJS:%.o=$(DBOOT_OBJS_DIR)/%.ln) 77DBOOT_LINT = $(i386_LINT) 78DBOOT_LINTTAGS = -erroff=E_STATIC_UNUSED 79 80# 81# Include common rules. 82# 83include $(UTSBASE)/i86pc/Makefile.i86pc 84 85# 86# Define targets 87# 88ALL_TARGET = $(UNIX_BIN) $(MULTIBOOT) 89LINT_TARGET = $(LINT_LIB) $(DBOOT_LINT_LIB) 90INSTALL_TARGET = $(UNIX_BIN) $(MULTIBOOT) $(ROOTMODULE) $(ROOT_MULTIBOOT) 91 92# 93# This is UNIX_DIR. Use a short path. 94# 95UNIX_DIR = . 96 97# 98# Overrides 99# 100CLEANFILES += \ 101 $(UNIX_O) $(MODSTUBS_O) \ 102 $(OBJS_DIR)/vers.c \ 103 $(OBJS_DIR)/dtracestubs.s \ 104 $(DTRACESTUBS_O) $(DTRACESTUBS) \ 105 $(CTFEXTRAOBJS) \ 106 $(COMMP_CTF_SRC) 107 108CLEANFILES += \ 109 $(DBOOT_O) $(DBOOT_S) \ 110 $(DBOOT_OBJECTS) \ 111 $(OBJS_DIR)/bios_call_src.o \ 112 $(OBJS_DIR)/bios_call_src \ 113 $(OBJS_DIR)/bios_call.s \ 114 $(DBOOT_BIN) 115 116CLEANFILES += \ 117 $(DBOOT_OBJS_DIR)/$(VGATEXT_FONT).c \ 118 $(OBJS_DIR)/$(VGATEXT_FONT).c 119 120CLEANFILES += \ 121 $(OBJS_DIR)/fb_swtch_src.o \ 122 $(OBJS_DIR)/fb_swtch_src \ 123 $(OBJS_DIR)/fb_swtch.s 124 125CLEANFILES += \ 126 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.o) \ 127 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.ln) 128 129CLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) $(MULTIBOOT) 130CLEANLINTFILES += $(LINT_LIB) $(DBOOT_LINT_LIB) $(DBOOT_LINTS) 131 132# instr_size needs a special header 133$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 134$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 135 136# 137# When performing shadow studio builds, the pre-processed comm page 138# output from gcc can end up confusing studio. 139# 140$(OBJS_DIR)/comm_page_ctf.o := CERRWARN += -_cc=-erroff=E_TKNS_IGNORED_AT_END_OF_DIR 141 142CFLAGS += -DDIS_MEM 143 144# 145# For now, disable these lint checks; maintainers should endeavor 146# to investigate and remove these for maximum lint coverage. 147# Please do not carry these forward to new Makefiles. 148# 149LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 150LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 151LINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 152LINTTAGS += -erroff=E_STATIC_UNUSED 153LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 154LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 155 156CERRWARN += -_gcc=-Wno-parentheses 157CERRWARN += -_gcc=-Wno-uninitialized 158CERRWARN += -_gcc=-Wno-char-subscripts 159CERRWARN += -_gcc=-Wno-unused-variable 160CERRWARN += -_gcc=-Wno-unused-function 161CERRWARN += -_gcc=-Wno-unused-label 162CERRWARN += -_gcc=-Wno-type-limits 163CERRWARN += -_gcc=-Wno-clobbered 164CERRWARN += -_gcc=-Wno-empty-body 165CERRWARN += -_gcc=-Wno-unused-value 166 167# Ensure that lint sees 'struct cpu' containing a fully declared 168# embedded 'struct machcpu' 169# 170LINTFLAGS += -D_MACHDEP -I../../i86pc 171 172# 173# Default build targets. 174# 175.KEEP_STATE: 176 177def: $(DEF_DEPS) 178 179all: $(ALL_DEPS) 180 181clean: $(CLEAN_DEPS) 182 183clobber: $(CLOBBER_DEPS) 184 185lint: $(LINT_DEPS) 186 187clean.lint: $(CLEAN_LINT_DEPS) 188 189install: $(INSTALL_DEPS) 190 191MAPFILE_32 = $(MAPFILE) 192MAPFILE_64 = $(MAPFILE).amd64 193 194MAPFILE_NAME = $(MAPFILE_$(CLASS)) 195 196$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 197 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O) 198 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \ 199 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \ 200 $(DTRACESTUBS) 201 $(MBH_PATCH) $(UNIX_BIN) 202 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 203 $(POST_PROCESS) 204 205$(UNIX_O): $(OBJECTS) $(CTFEXTRAOBJS) 206 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 207 208$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot 209 $(LD) -dn -e _start -M dboot/Mapfile.dboot \ 210 -o $(DBOOT_BIN) $(DBOOT_OBJECTS) 211 212$(DBOOT_O): $(DBOOT_BIN) 213 @echo " .data" > $(DBOOT_S) 214 @echo " .globl dboot_image" >> $(DBOOT_S) 215 @echo "dboot_image:" >> $(DBOOT_S) 216 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S) 217 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S) 218 219$(DBOOT_OBJS_DIR): 220 -@mkdir -p $@ 2> /dev/null 221 222$(COMMP_CTF_SRC): $(UTSBASE)/i86pc/ml/comm_page.s 223 $(COMPILE.cpp) -D_GENCTF -o $@ $(UTSBASE)/i86pc/ml/comm_page.s 224 225$(OBJS_DIR)/comm_page_ctf.o: $(COMMP_CTF_SRC) 226 $(COMPILE.c) -o $@ $< 227 $(CTFCONVERT_O) 228 229# 230# dboot is built as an intermediate target in dboot.o, so just make 231# dboot.o the dependency here. 232# 233$(MULTIBOOT): $(DBOOT_O) 234 $(CP) $(DBOOT_BIN) $(MULTIBOOT) 235 $(POST_PROCESS) 236 237# 238# Special rules for generating assym.h for inclusion in assembly files. 239# 240$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC 241 @cd $(DSF_DIR); $(MAKE) all.targ 242 243# 244# The global lint target builds the kernel lint library (llib-lunix.ln) 245# which is equivalent to a lint of /unix.o. Then all kernel modules for 246# this architecture are linted against the kernel lint library. 247# 248# Note: lint errors in the kernel lint library will be repeated for 249# each module. It is important that the kernel lint library 250# be clean to keep the textual output to a reasonable level. 251# 252 253$(LINT_LIB): $(LINT_LIB_DIR) $(LINTS) 254 @pwd 255 @-$(ECHO) "\n$(UNIX): (library construction):" 256 @$(LINT) -o$(UNIX) $(LINTFLAGS) $(LINTS) 257 @$(MV) $(@F) $@ 258 259$(DBOOT_LINT_LIB): $(LINT_LIB_DIR) $(DBOOT_LINTS) 260 @pwd 261 @-$(ECHO) "\n$(DBOOT): (library construction):" 262 @$(LINT) -o$(DBOOT) $(DBOOT_LINTFLAGS) $(DBOOT_LINTS) 263 @$(MV) $(@F) $@ 264 265lintlib: $(LINT_DEPS) 266 267# 268# Include common targets. 269# 270include $(UTSBASE)/i86pc/Makefile.targ 271