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 (c) 2018, 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 += -_gcc=-Wno-uninitialized 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# 153# Default build targets. 154# 155.KEEP_STATE: 156 157def: $(DEF_DEPS) 158 159all: $(ALL_DEPS) 160 161clean: $(CLEAN_DEPS) 162 163clobber: $(CLOBBER_DEPS) 164 165install: $(INSTALL_DEPS) 166 167MAPFILE_32 = $(MAPFILE) 168MAPFILE_64 = $(MAPFILE).amd64 169 170MAPFILE_NAME = $(MAPFILE_$(CLASS)) 171 172$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 173 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O) 174 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \ 175 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \ 176 $(DTRACESTUBS) 177 $(MBH_PATCH) $(UNIX_BIN) 178 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 179 $(POST_PROCESS) 180 181$(UNIX_O): $(OBJECTS) $(CTFEXTRAOBJS) 182 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 183 184$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot 185 $(LD) -dn -e _start -M dboot/Mapfile.dboot \ 186 -o $(DBOOT_BIN) $(DBOOT_OBJECTS) 187 188$(DBOOT_O): $(DBOOT_BIN) 189 @echo " .data" > $(DBOOT_S) 190 @echo " .globl dboot_image" >> $(DBOOT_S) 191 @echo "dboot_image:" >> $(DBOOT_S) 192 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S) 193 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S) 194 195$(DBOOT_OBJS_DIR): 196 -@mkdir -p $@ 2> /dev/null 197 198$(COMMP_CTF_SRC): $(UTSBASE)/i86pc/ml/comm_page.s 199 $(COMPILE.cpp) -D_GENCTF -o $@ $(UTSBASE)/i86pc/ml/comm_page.s 200 201$(OBJS_DIR)/comm_page_ctf.o: $(COMMP_CTF_SRC) 202 $(COMPILE.c) -o $@ $< 203 $(CTFCONVERT_O) 204 205# 206# Special rules for generating assym.h for inclusion in assembly files. 207# 208$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC 209 @cd $(DSF_DIR); $(MAKE) all.targ 210 211# 212# Include common targets. 213# 214include $(UTSBASE)/i86pc/Makefile.targ 215