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# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 22# Use is subject to license terms. 23# 24# Copyright 2019 Joyent, Inc. 25# Copyright 2019 OmniOS Community Edition (OmniOSce) Association. 26 27# 28# Path to the base of the uts directory tree (usually /usr/src/uts). 29# 30UTSBASE = ../.. 31 32# 33# Define the module and object file sets. 34# 35UNIX = unix 36DBOOT = dboot 37 38OBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 39 $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 40 $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \ 41 $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 42 43ROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 44 45UNIX_BIN = $(OBJS_DIR)/$(UNIX) 46 47LIBS = $(GENLIB) 48 49GENUNIX = genunix 50GENUNIX_DIR = ../../intel/$(GENUNIX) 51 52LIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 53 54COMMP_CTF_SRC = $(OBJS_DIR)/comm_page_ctf.c 55 56CTFEXTRAOBJS = $(OBJS_DIR)/vers.o $(OBJS_DIR)/comm_page_ctf.o 57 58DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 59DBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%) 60DBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT) 61DBOOT_O = $(OBJS_DIR)/$(DBOOT).o 62DBOOT_S = $(DBOOT_O:%.o=%.s) 63 64# 65# Include common rules. 66# 67include $(UTSBASE)/i86pc/Makefile.i86pc 68 69# 70# Define targets 71# 72ALL_TARGET = $(UNIX_BIN) 73INSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) 74 75# 76# This is UNIX_DIR. Use a short path. 77# 78UNIX_DIR = . 79 80# 81# Overrides 82# 83CLEANFILES += \ 84 $(UNIX_O) $(MODSTUBS_O) \ 85 $(OBJS_DIR)/vers.c \ 86 $(OBJS_DIR)/dtracestubs.s \ 87 $(DTRACESTUBS_O) $(DTRACESTUBS) \ 88 $(CTFEXTRAOBJS) \ 89 $(COMMP_CTF_SRC) 90 91CLEANFILES += \ 92 $(DBOOT_O) $(DBOOT_S) \ 93 $(DBOOT_OBJECTS) \ 94 $(OBJS_DIR)/bios_call_src.o \ 95 $(OBJS_DIR)/bios_call_src \ 96 $(OBJS_DIR)/bios_call.s \ 97 $(DBOOT_BIN) 98 99CLEANFILES += \ 100 $(DBOOT_OBJS_DIR)/$(FONT).c \ 101 $(OBJS_DIR)/$(FONT).c 102 103CLEANFILES += \ 104 $(OBJS_DIR)/fb_swtch_src.o \ 105 $(OBJS_DIR)/fb_swtch_src \ 106 $(OBJS_DIR)/fb_swtch.s 107 108CLEANFILES += \ 109 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.o) \ 110 $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.ln) 111 112CLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 113 114# instr_size needs a special header 115$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 116$(OBJS_DIR)/instr_size.ln := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 117 118# 119# When performing shadow studio builds, the pre-processed comm page 120# output from gcc can end up confusing studio. 121# 122$(OBJS_DIR)/comm_page_ctf.o := CERRWARN += -_cc=-erroff=E_TKNS_IGNORED_AT_END_OF_DIR 123 124CFLAGS += -DDIS_MEM 125 126# 127# For now, disable these checks; maintainers should endeavor 128# to investigate and remove these for maximum coverage. 129# Please do not carry these forward to new Makefiles. 130# 131CERRWARN += -_gcc=-Wno-parentheses 132CERRWARN += $(CNOWARN_UNINIT) 133CERRWARN += -_gcc=-Wno-char-subscripts 134CERRWARN += -_gcc=-Wno-unused-variable 135CERRWARN += -_gcc=-Wno-unused-function 136CERRWARN += -_gcc=-Wno-unused-label 137CERRWARN += -_gcc=-Wno-type-limits 138CERRWARN += -_gcc=-Wno-clobbered 139CERRWARN += -_gcc=-Wno-empty-body 140CERRWARN += -_gcc=-Wno-unused-value 141 142# false positives 143SMOFF += index_overflow 144 145# needs work 146SMOFF += all_func_returns,deref_check,signed 147 148$(OBJS_DIR)/fmsmb.o := SMOFF += indenting 149$(OBJS_DIR)/zutil.o := SMOFF += indenting 150$(OBJS_DIR)/bootrd_cpio.o := SMOFF += allocating_enough_data 151 152# too hairy 153$(OBJS_DIR)/inflate.o := SMATCH=off 154 155# 156# Default build targets. 157# 158.KEEP_STATE: 159 160def: $(DEF_DEPS) 161 162all: $(ALL_DEPS) 163 164clean: $(CLEAN_DEPS) 165 166clobber: $(CLOBBER_DEPS) 167 168install: $(INSTALL_DEPS) 169 170MAPFILE_32 = $(MAPFILE) 171MAPFILE_64 = $(MAPFILE).amd64 172 173MAPFILE_NAME = $(MAPFILE_$(CLASS)) 174 175$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 176 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O) 177 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \ 178 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \ 179 $(DTRACESTUBS) 180 $(MBH_PATCH) $(UNIX_BIN) 181 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 182 $(POST_PROCESS) 183 184$(UNIX_O): $(OBJECTS) $(CTFEXTRAOBJS) 185 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 186 187$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot 188 $(LD) -dn -e _start -M dboot/Mapfile.dboot \ 189 -o $(DBOOT_BIN) $(DBOOT_OBJECTS) 190 191$(DBOOT_O): $(DBOOT_BIN) 192 @echo " .data" > $(DBOOT_S) 193 @echo " .globl dboot_image" >> $(DBOOT_S) 194 @echo "dboot_image:" >> $(DBOOT_S) 195 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S) 196 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S) 197 198$(DBOOT_OBJS_DIR): 199 -@mkdir -p $@ 2> /dev/null 200 201$(COMMP_CTF_SRC): $(UTSBASE)/i86pc/ml/comm_page.s 202 $(COMPILE.cpp) -D_GENCTF -o $@ $(UTSBASE)/i86pc/ml/comm_page.s 203 204$(OBJS_DIR)/comm_page_ctf.o: $(COMMP_CTF_SRC) 205 $(COMPILE.c) -o $@ $< 206 $(CTFCONVERT_O) 207 208# 209# Special rules for generating assym.h for inclusion in assembly files. 210# 211$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC 212 @cd $(DSF_DIR); $(MAKE) all.targ 213 214# 215# Include common targets. 216# 217include $(UTSBASE)/i86pc/Makefile.targ 218