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# Copyright 2019 Joyent, Inc. 27# 28# This makefile drives the production of unix (and unix.o). 29# 30# i86xpv implementation architecture dependent 31# 32 33# 34# Path to the base of the uts directory tree (usually /usr/src/uts). 35# 36UTSBASE = ../.. 37 38# 39# Define the module and object file sets. 40# 41UNIX = unix 42DBOOT = dboot 43 44OBJECTS = $(SPECIAL_OBJS:%=$(OBJS_DIR)/%) \ 45 $(CORE_OBJS:%=$(OBJS_DIR)/%) \ 46 $(KRTLD_OBJS:%=$(OBJS_DIR)/%) \ 47 $(MACH_NOT_YET_KMODS:%=$(OBJS_DIR)/%) 48 49ROOTMODULE = $(ROOT_PSM_KERN_DIR)/$(UNIX) 50 51UNIX_BIN = $(OBJS_DIR)/$(UNIX) 52 53LIBS = $(GENLIB) 54 55GENUNIX = genunix 56GENUNIX_DIR = ../../intel/$(GENUNIX) 57 58LIBOPTS = -L $(GENUNIX_DIR)/$(OBJS_DIR) -l $(GENUNIX) 59 60CTFEXTRAOBJS = $(OBJS_DIR)/vers.o 61 62DBOOT_OBJS_DIR = dboot/$(OBJS_DIR) 63DBOOT_OBJECTS = $(DBOOT_OBJS:%=$(DBOOT_OBJS_DIR)/%) 64DBOOT_BIN = $(DBOOT_OBJS_DIR)/$(DBOOT) 65DBOOT_O = $(OBJS_DIR)/$(DBOOT).o 66DBOOT_S = $(DBOOT_O:%.o=%.s) 67 68# 69# Include common rules. 70# 71include $(UTSBASE)/i86xpv/Makefile.i86xpv 72 73# 74# Define targets 75# 76ALL_TARGET = $(UNIX_BIN) 77INSTALL_TARGET = $(UNIX_BIN) $(ROOTMODULE) 78 79# 80# This is UNIX_DIR. Use a short path. 81# 82UNIX_DIR = . 83 84# 85# Overrides 86# 87CLEANFILES += \ 88 $(UNIX_O) $(MODSTUBS_O) \ 89 $(OBJS_DIR)/vers.c $(OBJS_DIR)/vers.o \ 90 $(OBJS_DIR)/dtracestubs.s \ 91 $(DTRACESTUBS_O) $(DTRACESTUBS) 92 93CLEANFILES += \ 94 $(DBOOT_O) $(DBOOT_S) \ 95 $(DBOOT_OBJECTS) \ 96 $(DBOOT_BIN) 97 98CLEANFILES += \ 99 $(DBOOT_OBJS_DIR)/$(FONT).c \ 100 $(OBJS_DIR)/$(FONT).c 101 102CLEANFILES += \ 103 $(OBJS_DIR)/fb_swtch_src.o \ 104 $(OBJS_DIR)/fb_swtch_src \ 105 $(OBJS_DIR)/fb_swtch.s 106 107CLEANFILES += $(ZLIB_OBJS:%.o=$(OBJS_DIR)/%.o) 108 109CLOBBERFILES = $(CLEANFILES) $(UNIX_BIN) 110 111# instr_size needs a special header 112$(OBJS_DIR)/instr_size.o := EXTRA_OPTIONS = -I$(SRC)/common/dis/i386 113 114CFLAGS += -DDIS_MEM 115 116# 117# For now, disable these warnings; maintainers should endeavor 118# to investigate and remove these for maximum coverage. 119# Please do not carry these forward to new Makefiles. 120# 121CERRWARN += -_gcc=-Wno-parentheses 122CERRWARN += $(CNOWARN_UNINIT) 123CERRWARN += -_gcc=-Wno-char-subscripts 124CERRWARN += -_gcc=-Wno-unused-variable 125CERRWARN += -_gcc=-Wno-unused-function 126CERRWARN += -_gcc=-Wno-unused-label 127CERRWARN += -_gcc=-Wno-type-limits 128CERRWARN += -_gcc=-Wno-clobbered 129CERRWARN += -_gcc=-Wno-unused-value 130CERRWARN += -_gcc=-Wno-empty-body 131 132# needs work 133SMATCH=off 134 135# 136# Default build targets. 137# 138.KEEP_STATE: 139 140def: $(DEF_DEPS) 141 142all: $(ALL_DEPS) 143 144clean: $(CLEAN_DEPS) 145 146clobber: $(CLOBBER_DEPS) 147 148install: $(INSTALL_DEPS) 149 150MAPFILE_32 = $(UNIX_MAPFILE) 151MAPFILE_64 = $(UNIX_MAPFILE).amd64 152 153MAPFILE_NAME = $(MAPFILE_$(CLASS)) 154 155$(UNIX_BIN): $(UNIX_O) $(MODSTUBS_O) $(MAPFILE_NAME) \ 156 $(GENLIB) $(DTRACESTUBS) $(DBOOT_O) 157 $(LD) -dy -b -o $@ -e dboot_image -znointerp -M $(MAPFILE_NAME) \ 158 $(UNIX_O) $(DBOOT_O) $(MODSTUBS_O) $(LIBOPTS) \ 159 $(DTRACESTUBS) 160 $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) 161 $(POST_PROCESS) 162 163$(UNIX_O): $(OBJECTS) $(OBJS_DIR)/vers.o 164 $(LD) -r -o $@ $(OBJECTS) $(OBJS_DIR)/vers.o 165 166$(DBOOT_BIN): $(DBOOT_OBJS_DIR) $(DBOOT_OBJECTS) dboot/Mapfile.dboot 167 $(LD) -dn -e _start -M dboot/Mapfile.dboot \ 168 -o $(DBOOT_BIN) $(DBOOT_OBJECTS) 169 170$(DBOOT_O): $(DBOOT_BIN) 171 @echo " .data" > $(DBOOT_S) 172 @echo " .globl dboot_image" >> $(DBOOT_S) 173 @echo "dboot_image:" >> $(DBOOT_S) 174 $(ELFEXTRACT) $(DBOOT_BIN) >> $(DBOOT_S) 175 $(COMPILE.s) -o $(DBOOT_O) $(DBOOT_S) 176 177$(DBOOT_OBJS_DIR): 178 -@mkdir -p $@ 2> /dev/null 179 180# 181# Special rules for generating assym.h for inclusion in assembly files. 182# 183$(DSF_DIR)/$(OBJS_DIR)/assym.h $(DSF_DIR)/$(OBJS_DIR)/kdi_assym.h: FRC 184 @cd $(DSF_DIR); $(MAKE) all.targ 185 186# 187# Include common targets. 188# 189include $(UTSBASE)/i86xpv/Makefile.targ 190