17c478bd9Sstevel@tonic-gate# 27c478bd9Sstevel@tonic-gate# CDDL HEADER START 37c478bd9Sstevel@tonic-gate# 47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 502e56f3fSwesolows# Common Development and Distribution License (the "License"). 602e56f3fSwesolows# You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate# and limitations under the License. 127c478bd9Sstevel@tonic-gate# 137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate# 197c478bd9Sstevel@tonic-gate# CDDL HEADER END 207c478bd9Sstevel@tonic-gate# 2102e56f3fSwesolows 227c478bd9Sstevel@tonic-gate# 23b885580bSAlexander Kolbasov# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 26efe51d0cSJohn Levon# Copyright 2019 Joyent, Inc. 27*3cac7b0dSAndy Fiddaman# Copyright 2021 OmniOS Community Edition (OmniOSce) Association. 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 327c478bd9Sstevel@tonic-gate# 337c478bd9Sstevel@tonic-gateUTSBASE = ../.. 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gate# Define the module and object file sets. 377c478bd9Sstevel@tonic-gate# 387c478bd9Sstevel@tonic-gateMODULE = genunix 397c478bd9Sstevel@tonic-gateGENUNIX = $(OBJS_DIR)/$(MODULE) 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gateOBJECTS = $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \ 427c478bd9Sstevel@tonic-gate $(NOT_YET_KMODS:%=$(OBJS_DIR)/%) 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_KERN_DIR)/$(MODULE) 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gateLIBGEN = $(OBJS_DIR)/libgenunix.so 477c478bd9Sstevel@tonic-gateLIBSTUBS = $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%) 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate# 507c478bd9Sstevel@tonic-gate# Include common rules. 517c478bd9Sstevel@tonic-gate# 527c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.intel 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate# 557c478bd9Sstevel@tonic-gate# Define targets 567c478bd9Sstevel@tonic-gate# 575db531e3SRichard LoweALL_TARGET = $(LIBGEN) $(GENUNIX) 585db531e3SRichard LoweINSTALL_TARGET = $(LIBGEN) $(GENUNIX) $(ROOTMODULE) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate# 617c478bd9Sstevel@tonic-gate# Overrides 627c478bd9Sstevel@tonic-gate# 63b6805bf7SGordon RossCLOBBERFILES += $(GENUNIX) 647c478bd9Sstevel@tonic-gateCLEANFILES += $(LIBSTUBS) $(LIBGEN) 657c478bd9Sstevel@tonic-gateBINARY = 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate# 687c478bd9Sstevel@tonic-gate# Non-patch genunix builds merge a version of the ip module called ipctf. This 697c478bd9Sstevel@tonic-gate# is to ensure that the common network-related types are included in genunix and 707c478bd9Sstevel@tonic-gate# can thus be uniquified out of other modules. We don't want to do this for 717c478bd9Sstevel@tonic-gate# patch builds, since we can't guarantee that ip and genunix will be in the same 727c478bd9Sstevel@tonic-gate# patch. 737c478bd9Sstevel@tonic-gate# 747c478bd9Sstevel@tonic-gateIPCTF_TARGET = $(IPCTF) 757c478bd9Sstevel@tonic-gate$(PATCH_BUILD)IPCTF_TARGET = 767c478bd9Sstevel@tonic-gate 777c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/common 78e7cbe64fSgwCPPFLAGS += -I$(SRC)/uts/common/fs/zfs 797c478bd9Sstevel@tonic-gate 80b885580bSAlexander KolbasovCPPFLAGS += -I$(UTSBASE)/i86pc 81b885580bSAlexander Kolbasov 827014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 837014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 847014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value 857014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function 867014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 877014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 887014882cSRichard LoweCERRWARN += -_gcc=-Wno-type-limits 89d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT) 907014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 917014882cSRichard LoweCERRWARN += -_gcc=-Wno-empty-body 927014882cSRichard Lowe 93*3cac7b0dSAndy Fiddaman# 94*3cac7b0dSAndy Fiddaman# Some compilers default to stripping unused debug information from 95*3cac7b0dSAndy Fiddaman# objects. Since genunix is used as the uniquification source for CTF data 96*3cac7b0dSAndy Fiddaman# in the kernel, explicitly keep as much debug data as possible. 97*3cac7b0dSAndy Fiddaman# 98*3cac7b0dSAndy FiddamanCFLAGS += $(CALLSYMS) 99*3cac7b0dSAndy Fiddaman 100efe51d0cSJohn Levon# very hairy 101efe51d0cSJohn Levon$(OBJS_DIR)/u8_textprep.o := SMATCH=off 102efe51d0cSJohn Levon 103b6b206fcSJohn Levon# false positives 104b6b206fcSJohn LevonSMOFF += index_overflow 105b6b206fcSJohn Levon$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check 106b6b206fcSJohn Levon$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check 107b6b206fcSJohn Levon 108b6b206fcSJohn Levon# need work still 109b6b206fcSJohn LevonSMOFF += signed,indenting,all_func_returns 110b6b206fcSJohn Levon$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check 111b6b206fcSJohn Levon$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data 112b6b206fcSJohn Levon$(OBJS_DIR)/klpd.o := SMOFF += cast_assign 113b6b206fcSJohn Levon$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow 114b6b206fcSJohn Levon$(OBJS_DIR)/process.o := SMOFF += or_vs_and 115b6b206fcSJohn Levon$(OBJS_DIR)/sunpci.o := SMOFF += deref_check 116b6b206fcSJohn Levon$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check 117b6b206fcSJohn Levon 118b6b206fcSJohn Levon# definitely wrong 119b6b206fcSJohn Levon$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and 120b6b206fcSJohn Levon 1217c478bd9Sstevel@tonic-gate# 1227c478bd9Sstevel@tonic-gate# Default build targets. 1237c478bd9Sstevel@tonic-gate# 1247c478bd9Sstevel@tonic-gate.KEEP_STATE: 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1357c478bd9Sstevel@tonic-gate 136ab65fd2aSRichard Lowe# Due to what seems to be an issue in GCC 4 generated DWARF containing 137ab65fd2aSRichard Lowe# symbolic relocations against non-allocatable .debug sections, libgenunix.so 138ab65fd2aSRichard Lowe# must be built from a stripped object, thus we create an intermediary 139ab65fd2aSRichard Lowe# libgenunix.o we can safely strip. 140ab65fd2aSRichard LoweLIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o 141ab65fd2aSRichard LoweCLEANFILES += $(LIBGENUNIX_O) 142ab65fd2aSRichard Lowe 143ab65fd2aSRichard Lowe$(LIBGENUNIX_O): $(OBJECTS) 144ab65fd2aSRichard Lowe $(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS) 145ab65fd2aSRichard Lowe $(STRIP) -x $(OBJS_DIR)/libgenunix.o 146ab65fd2aSRichard Lowe 147ab65fd2aSRichard Lowe$(LIBGEN): $(LIBGENUNIX_O) $(LIBSTUBS) 148ab65fd2aSRichard Lowe $(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS) 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate$(IPCTF_TARGET) ipctf_target: FRC 1517c478bd9Sstevel@tonic-gate @cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR) 1527c478bd9Sstevel@tonic-gate @pwd 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS) 1557c478bd9Sstevel@tonic-gate $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS) 1567c478bd9Sstevel@tonic-gate $(CTFMERGE_GENUNIX_MERGE) 1577c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate# 1607c478bd9Sstevel@tonic-gate# Include common targets. 1617c478bd9Sstevel@tonic-gate# 1627c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.targ 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate# 1657c478bd9Sstevel@tonic-gate# Software workarounds for hardware "features". 1667c478bd9Sstevel@tonic-gate# 1677c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.workarounds 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gateALL_DEFS += $(WORKAROUND_DEFS) 170