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# 26*efe51d0cSJohn Levon# Copyright 2019 Joyent, Inc. 277c478bd9Sstevel@tonic-gate# 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate# 307c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gateUTSBASE = ../.. 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gate# Define the module and object file sets. 367c478bd9Sstevel@tonic-gate# 377c478bd9Sstevel@tonic-gateMODULE = genunix 387c478bd9Sstevel@tonic-gateGENUNIX = $(OBJS_DIR)/$(MODULE) 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gateOBJECTS = $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \ 417c478bd9Sstevel@tonic-gate $(NOT_YET_KMODS:%=$(OBJS_DIR)/%) 427c478bd9Sstevel@tonic-gate 437c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_KERN_DIR)/$(MODULE) 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gateLIBGEN = $(OBJS_DIR)/libgenunix.so 467c478bd9Sstevel@tonic-gateLIBSTUBS = $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%) 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate# 497c478bd9Sstevel@tonic-gate# Include common rules. 507c478bd9Sstevel@tonic-gate# 517c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.intel 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate# 547c478bd9Sstevel@tonic-gate# Define targets 557c478bd9Sstevel@tonic-gate# 565db531e3SRichard LoweALL_TARGET = $(LIBGEN) $(GENUNIX) 575db531e3SRichard LoweINSTALL_TARGET = $(LIBGEN) $(GENUNIX) $(ROOTMODULE) 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate# 607c478bd9Sstevel@tonic-gate# Overrides 617c478bd9Sstevel@tonic-gate# 62b6805bf7SGordon RossCLOBBERFILES += $(GENUNIX) 637c478bd9Sstevel@tonic-gateCLEANFILES += $(LIBSTUBS) $(LIBGEN) 647c478bd9Sstevel@tonic-gateBINARY = 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate# 677c478bd9Sstevel@tonic-gate# Non-patch genunix builds merge a version of the ip module called ipctf. This 687c478bd9Sstevel@tonic-gate# is to ensure that the common network-related types are included in genunix and 697c478bd9Sstevel@tonic-gate# can thus be uniquified out of other modules. We don't want to do this for 707c478bd9Sstevel@tonic-gate# patch builds, since we can't guarantee that ip and genunix will be in the same 717c478bd9Sstevel@tonic-gate# patch. 727c478bd9Sstevel@tonic-gate# 737c478bd9Sstevel@tonic-gateIPCTF_TARGET = $(IPCTF) 747c478bd9Sstevel@tonic-gate$(PATCH_BUILD)IPCTF_TARGET = 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/common 77e7cbe64fSgw25295CPPFLAGS += -I$(SRC)/uts/common/fs/zfs 787c478bd9Sstevel@tonic-gate 79b885580bSAlexander KolbasovCPPFLAGS += -I$(UTSBASE)/i86pc 80b885580bSAlexander Kolbasov 817014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 827014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 837014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value 847014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function 857014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 867014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 877014882cSRichard LoweCERRWARN += -_gcc=-Wno-type-limits 887014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 897014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 907014882cSRichard LoweCERRWARN += -_gcc=-Wno-empty-body 917014882cSRichard Lowe 92*efe51d0cSJohn Levon# very hairy 93*efe51d0cSJohn Levon$(OBJS_DIR)/u8_textprep.o := SMATCH=off 94*efe51d0cSJohn Levon 95b6b206fcSJohn Levon# false positives 96b6b206fcSJohn LevonSMOFF += index_overflow 97b6b206fcSJohn Levon$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check 98b6b206fcSJohn Levon$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check 99b6b206fcSJohn Levon 100b6b206fcSJohn Levon# need work still 101b6b206fcSJohn LevonSMOFF += signed,indenting,all_func_returns 102b6b206fcSJohn Levon$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check 103b6b206fcSJohn Levon$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data 104b6b206fcSJohn Levon$(OBJS_DIR)/klpd.o := SMOFF += cast_assign 105b6b206fcSJohn Levon$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow 106b6b206fcSJohn Levon$(OBJS_DIR)/process.o := SMOFF += or_vs_and 107b6b206fcSJohn Levon$(OBJS_DIR)/sunpci.o := SMOFF += deref_check 108b6b206fcSJohn Levon$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check 109b6b206fcSJohn Levon 110b6b206fcSJohn Levon# definitely wrong 111b6b206fcSJohn Levon$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and 112b6b206fcSJohn Levon 113bb25c06cSjg# 1147c478bd9Sstevel@tonic-gate# Default build targets. 1157c478bd9Sstevel@tonic-gate# 1167c478bd9Sstevel@tonic-gate.KEEP_STATE: 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1197c478bd9Sstevel@tonic-gate 1207c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1277c478bd9Sstevel@tonic-gate 128ab65fd2aSRichard Lowe# Due to what seems to be an issue in GCC 4 generated DWARF containing 129ab65fd2aSRichard Lowe# symbolic relocations against non-allocatable .debug sections, libgenunix.so 130ab65fd2aSRichard Lowe# must be built from a stripped object, thus we create an intermediary 131ab65fd2aSRichard Lowe# libgenunix.o we can safely strip. 132ab65fd2aSRichard LoweLIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o 133ab65fd2aSRichard LoweCLEANFILES += $(LIBGENUNIX_O) 134ab65fd2aSRichard Lowe 135ab65fd2aSRichard Lowe$(LIBGENUNIX_O): $(OBJECTS) 136ab65fd2aSRichard Lowe $(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS) 137ab65fd2aSRichard Lowe $(STRIP) -x $(OBJS_DIR)/libgenunix.o 138ab65fd2aSRichard Lowe 139ab65fd2aSRichard Lowe$(LIBGEN): $(LIBGENUNIX_O) $(LIBSTUBS) 140ab65fd2aSRichard Lowe $(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS) 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate$(IPCTF_TARGET) ipctf_target: FRC 1437c478bd9Sstevel@tonic-gate @cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR) 1447c478bd9Sstevel@tonic-gate @pwd 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS) 1477c478bd9Sstevel@tonic-gate $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS) 1487c478bd9Sstevel@tonic-gate $(CTFMERGE_GENUNIX_MERGE) 1497c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate# 1527c478bd9Sstevel@tonic-gate# Include common targets. 1537c478bd9Sstevel@tonic-gate# 1547c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.targ 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gate# 1577c478bd9Sstevel@tonic-gate# Software workarounds for hardware "features". 1587c478bd9Sstevel@tonic-gate# 1597c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.workarounds 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gateALL_DEFS += $(WORKAROUND_DEFS) 162