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 2009 Sun Microsystems, Inc. All rights reserved. 24# Use is subject to license terms. 25# 26# Copyright 2019 Joyent, Inc. 27# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. 28# 29 30# 31# Path to the base of the uts directory tree (usually /usr/src/uts). 32# 33UTSBASE = ../.. 34 35# 36# Define the module and object file sets. 37# 38MODULE = genunix 39GENUNIX = $(OBJS_DIR)/$(MODULE) 40 41OBJECTS = $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \ 42 $(NOT_YET_KMODS:%=$(OBJS_DIR)/%) 43 44ROOTMODULE = $(ROOT_KERN_DIR)/$(MODULE) 45 46LIBGEN = $(OBJS_DIR)/libgenunix.so 47LIBSTUBS = $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%) 48 49# 50# Include common rules. 51# 52include $(UTSBASE)/intel/Makefile.intel 53 54# 55# Define targets 56# 57ALL_TARGET = $(LIBGEN) $(GENUNIX) 58INSTALL_TARGET = $(LIBGEN) $(GENUNIX) $(ROOTMODULE) 59 60# 61# Overrides 62# 63CLOBBERFILES += $(GENUNIX) 64CLEANFILES += $(LIBSTUBS) $(LIBGEN) 65BINARY = 66 67# 68# Non-patch genunix builds merge a version of the ip module called ipctf. This 69# is to ensure that the common network-related types are included in genunix and 70# can thus be uniquified out of other modules. We don't want to do this for 71# patch builds, since we can't guarantee that ip and genunix will be in the same 72# patch. 73# 74IPCTF_TARGET = $(IPCTF) 75$(PATCH_BUILD)IPCTF_TARGET = 76 77CPPFLAGS += -I$(SRC)/common 78CPPFLAGS += -I$(SRC)/uts/common/fs/zfs 79 80CPPFLAGS += -I$(UTSBASE)/i86pc 81 82CERRWARN += -_gcc=-Wno-unused-label 83CERRWARN += -_gcc=-Wno-unused-variable 84CERRWARN += -_gcc=-Wno-unused-value 85CERRWARN += -_gcc=-Wno-unused-function 86CERRWARN += -_gcc=-Wno-parentheses 87CERRWARN += -_gcc=-Wno-switch 88CERRWARN += -_gcc=-Wno-type-limits 89CERRWARN += $(CNOWARN_UNINIT) 90CERRWARN += -_gcc=-Wno-clobbered 91CERRWARN += -_gcc=-Wno-empty-body 92 93# 94# Some compilers default to stripping unused debug information from 95# objects. Since genunix is used as the uniquification source for CTF data 96# in the kernel, explicitly keep as much debug data as possible. 97# 98CFLAGS += $(CALLSYMS) 99 100# very hairy 101$(OBJS_DIR)/u8_textprep.o := SMATCH=off 102 103# false positives 104SMOFF += index_overflow 105$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check 106$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check 107 108# need work still 109SMOFF += signed,indenting,all_func_returns 110$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check 111$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data 112$(OBJS_DIR)/klpd.o := SMOFF += cast_assign 113$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow 114$(OBJS_DIR)/process.o := SMOFF += or_vs_and 115$(OBJS_DIR)/sunpci.o := SMOFF += deref_check 116$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check 117 118# definitely wrong 119$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and 120 121# 122# Default build targets. 123# 124.KEEP_STATE: 125 126def: $(DEF_DEPS) 127 128all: $(ALL_DEPS) 129 130clean: $(CLEAN_DEPS) 131 132clobber: $(CLOBBER_DEPS) 133 134install: $(INSTALL_DEPS) 135 136# Due to what seems to be an issue in GCC 4 generated DWARF containing 137# symbolic relocations against non-allocatable .debug sections, libgenunix.so 138# must be built from a stripped object, thus we create an intermediary 139# libgenunix.o we can safely strip. 140LIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o 141CLEANFILES += $(LIBGENUNIX_O) 142 143$(LIBGENUNIX_O): $(OBJECTS) 144 $(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS) 145 $(STRIP) -x $(OBJS_DIR)/libgenunix.o 146 147$(LIBGEN): $(LIBGENUNIX_O) $(LIBSTUBS) 148 $(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS) 149 150$(IPCTF_TARGET) ipctf_target: FRC 151 @cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR) 152 @pwd 153 154$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS) 155 $(LD) -ztype=kmod $(LDFLAGS) -o $@ $(OBJECTS) 156 $(CTFMERGE_GENUNIX_MERGE) 157 $(POST_PROCESS) 158 159# 160# Include common targets. 161# 162include $(UTSBASE)/intel/Makefile.targ 163 164# 165# Software workarounds for hardware "features". 166# 167include $(UTSBASE)/i86pc/Makefile.workarounds 168 169ALL_DEFS += $(WORKAROUND_DEFS) 170