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. 273cac7b0dSAndy 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# 68*fc910014SRichard Lowe# genunix builds merge a version of the ip module called ipctf. This is to 69*fc910014SRichard Lowe# ensure that the common network-related types are included in genunix and can 70*fc910014SRichard Lowe# thus be uniquified out of other modules. 717c478bd9Sstevel@tonic-gate# 727c478bd9Sstevel@tonic-gateIPCTF_TARGET = $(IPCTF) 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/common 75e7cbe64fSgwCPPFLAGS += -I$(SRC)/uts/common/fs/zfs 767c478bd9Sstevel@tonic-gate 77b885580bSAlexander KolbasovCPPFLAGS += -I$(UTSBASE)/i86pc 78b885580bSAlexander Kolbasov 797014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 807014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value 817014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function 827014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 83d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT) 847014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 857014882cSRichard LoweCERRWARN += -_gcc=-Wno-empty-body 867014882cSRichard Lowe 873cac7b0dSAndy Fiddaman# 883cac7b0dSAndy Fiddaman# Some compilers default to stripping unused debug information from 893cac7b0dSAndy Fiddaman# objects. Since genunix is used as the uniquification source for CTF data 903cac7b0dSAndy Fiddaman# in the kernel, explicitly keep as much debug data as possible. 913cac7b0dSAndy Fiddaman# 923cac7b0dSAndy FiddamanCFLAGS += $(CALLSYMS) 933cac7b0dSAndy Fiddaman 94efe51d0cSJohn Levon# very hairy 95efe51d0cSJohn Levon$(OBJS_DIR)/u8_textprep.o := SMATCH=off 96efe51d0cSJohn Levon 97b6b206fcSJohn Levon# false positives 98b6b206fcSJohn LevonSMOFF += index_overflow 99b6b206fcSJohn Levon$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check 100b6b206fcSJohn Levon$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check 101b6b206fcSJohn Levon 102b6b206fcSJohn Levon# need work still 1033df2e8b2SRobert MustacchiSMOFF += signed,all_func_returns 104b6b206fcSJohn Levon$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check 105b6b206fcSJohn Levon$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data 106b6b206fcSJohn Levon$(OBJS_DIR)/klpd.o := SMOFF += cast_assign 107b6b206fcSJohn Levon$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow 108b6b206fcSJohn Levon$(OBJS_DIR)/process.o := SMOFF += or_vs_and 109b6b206fcSJohn Levon$(OBJS_DIR)/sunpci.o := SMOFF += deref_check 110b6b206fcSJohn Levon$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check 111b6b206fcSJohn Levon 1123df2e8b2SRobert Mustacchi# 3rd party code 1133df2e8b2SRobert Mustacchi$(OBJS_DIR)/bz2bzlib.o := SMOFF += indenting 114b6b206fcSJohn Levon 1157c478bd9Sstevel@tonic-gate# 1167c478bd9Sstevel@tonic-gate# Default build targets. 1177c478bd9Sstevel@tonic-gate# 1187c478bd9Sstevel@tonic-gate.KEEP_STATE: 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1297c478bd9Sstevel@tonic-gate 130ab65fd2aSRichard Lowe# Due to what seems to be an issue in GCC 4 generated DWARF containing 131ab65fd2aSRichard Lowe# symbolic relocations against non-allocatable .debug sections, libgenunix.so 132ab65fd2aSRichard Lowe# must be built from a stripped object, thus we create an intermediary 133ab65fd2aSRichard Lowe# libgenunix.o we can safely strip. 134ab65fd2aSRichard LoweLIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o 135ab65fd2aSRichard LoweCLEANFILES += $(LIBGENUNIX_O) 136ab65fd2aSRichard Lowe 137ab65fd2aSRichard Lowe$(LIBGENUNIX_O): $(OBJECTS) 138ab65fd2aSRichard Lowe $(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS) 139ab65fd2aSRichard Lowe $(STRIP) -x $(OBJS_DIR)/libgenunix.o 140ab65fd2aSRichard Lowe 141ab65fd2aSRichard Lowe$(LIBGEN): $(LIBGENUNIX_O) $(LIBSTUBS) 142ab65fd2aSRichard Lowe $(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS) 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate$(IPCTF_TARGET) ipctf_target: FRC 1457c478bd9Sstevel@tonic-gate @cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR) 1467c478bd9Sstevel@tonic-gate @pwd 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS) 14982d0151aSRichard Lowe $(LD) -ztype=kmod $(LDFLAGS) -o $@ $(OBJECTS) 1507c478bd9Sstevel@tonic-gate $(CTFMERGE_GENUNIX_MERGE) 1517c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate# 1547c478bd9Sstevel@tonic-gate# Include common targets. 1557c478bd9Sstevel@tonic-gate# 1567c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.targ 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate# 1597c478bd9Sstevel@tonic-gate# Software workarounds for hardware "features". 1607c478bd9Sstevel@tonic-gate# 1617c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.workarounds 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gateALL_DEFS += $(WORKAROUND_DEFS) 164