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# 26b6b206fcSJohn Levon# Copyright (c) 2018, Joyent, Inc. 2702e56f3fSwesolows 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate# This makefile drives the production of the generic 307c478bd9Sstevel@tonic-gate# unix kernel module. 317c478bd9Sstevel@tonic-gate# 327c478bd9Sstevel@tonic-gate# x86 implementation architecture dependent 337c478bd9Sstevel@tonic-gate# 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate# 367c478bd9Sstevel@tonic-gate# Path to the base of the uts directory tree (usually /usr/src/uts). 377c478bd9Sstevel@tonic-gate# 387c478bd9Sstevel@tonic-gateUTSBASE = ../.. 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gate# 417c478bd9Sstevel@tonic-gate# Define the module and object file sets. 427c478bd9Sstevel@tonic-gate# 437c478bd9Sstevel@tonic-gateMODULE = genunix 447c478bd9Sstevel@tonic-gateGENUNIX = $(OBJS_DIR)/$(MODULE) 457c478bd9Sstevel@tonic-gate 467c478bd9Sstevel@tonic-gateOBJECTS = $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \ 477c478bd9Sstevel@tonic-gate $(NOT_YET_KMODS:%=$(OBJS_DIR)/%) 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gateLINTS = $(GENUNIX_OBJS:%.o=$(LINTS_DIR)/%.ln) \ 507c478bd9Sstevel@tonic-gate $(NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln) 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateROOTMODULE = $(ROOT_KERN_DIR)/$(MODULE) 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gateLIBGEN = $(OBJS_DIR)/libgenunix.so 557c478bd9Sstevel@tonic-gateLIBSTUBS = $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%) 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate# 587c478bd9Sstevel@tonic-gate# Include common rules. 597c478bd9Sstevel@tonic-gate# 607c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.intel 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate# 637c478bd9Sstevel@tonic-gate# Define targets 647c478bd9Sstevel@tonic-gate# 655db531e3SRichard LoweALL_TARGET = $(LIBGEN) $(GENUNIX) 667c478bd9Sstevel@tonic-gateLINT_TARGET = $(MODULE).lint 675db531e3SRichard LoweINSTALL_TARGET = $(LIBGEN) $(GENUNIX) $(ROOTMODULE) 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate# 707c478bd9Sstevel@tonic-gate# Overrides 717c478bd9Sstevel@tonic-gate# 72b6805bf7SGordon RossCLOBBERFILES += $(GENUNIX) 737c478bd9Sstevel@tonic-gateCLEANFILES += $(LIBSTUBS) $(LIBGEN) 747c478bd9Sstevel@tonic-gateBINARY = 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate# 777c478bd9Sstevel@tonic-gate# Non-patch genunix builds merge a version of the ip module called ipctf. This 787c478bd9Sstevel@tonic-gate# is to ensure that the common network-related types are included in genunix and 797c478bd9Sstevel@tonic-gate# can thus be uniquified out of other modules. We don't want to do this for 807c478bd9Sstevel@tonic-gate# patch builds, since we can't guarantee that ip and genunix will be in the same 817c478bd9Sstevel@tonic-gate# patch. 827c478bd9Sstevel@tonic-gate# 837c478bd9Sstevel@tonic-gateIPCTF_TARGET = $(IPCTF) 847c478bd9Sstevel@tonic-gate$(PATCH_BUILD)IPCTF_TARGET = 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gateCPPFLAGS += -I$(SRC)/common 87e7cbe64fSgwCPPFLAGS += -I$(SRC)/uts/common/fs/zfs 887c478bd9Sstevel@tonic-gate 89b885580bSAlexander KolbasovCPPFLAGS += -I$(UTSBASE)/i86pc 90b885580bSAlexander Kolbasov 91bb25c06cSjg# 92bb25c06cSjg# For now, disable these lint checks; maintainers should endeavor 93bb25c06cSjg# to investigate and remove these for maximum lint coverage. 94bb25c06cSjg# Please do not carry these forward to new Makefiles. 95bb25c06cSjg# 96bb25c06cSjgLINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON 97bb25c06cSjgLINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 98bb25c06cSjgLINTTAGS += -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED 99bb25c06cSjgLINTTAGS += -erroff=E_STATIC_UNUSED 100bb25c06cSjgLINTTAGS += -erroff=E_PTRDIFF_OVERFLOW 101bb25c06cSjgLINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 102bb25c06cSjg 1037014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 1047014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 1057014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-value 1067014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-function 1077014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 1087014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 1097014882cSRichard LoweCERRWARN += -_gcc=-Wno-type-limits 1107014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 1117014882cSRichard LoweCERRWARN += -_gcc=-Wno-clobbered 1127014882cSRichard LoweCERRWARN += -_gcc=-Wno-empty-body 1137014882cSRichard Lowe 114b6b206fcSJohn Levon# false positives 115b6b206fcSJohn LevonSMOFF += index_overflow 116b6b206fcSJohn Levon$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check 117b6b206fcSJohn Levon$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check 118b6b206fcSJohn Levon 119b6b206fcSJohn Levon# need work still 120b6b206fcSJohn LevonSMOFF += signed,indenting,all_func_returns 121b6b206fcSJohn Levon$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check 122b6b206fcSJohn Levon$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data 123b6b206fcSJohn Levon$(OBJS_DIR)/klpd.o := SMOFF += cast_assign 124b6b206fcSJohn Levon$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow 125b6b206fcSJohn Levon$(OBJS_DIR)/process.o := SMOFF += or_vs_and 126b6b206fcSJohn Levon$(OBJS_DIR)/sunpci.o := SMOFF += deref_check 127b6b206fcSJohn Levon$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check 128b6b206fcSJohn Levon 129b6b206fcSJohn Levon# definitely wrong 130b6b206fcSJohn Levon$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and 131b6b206fcSJohn Levon 1328793b36bSNick Todd# 1338793b36bSNick Todd# Ensure that lint sees 'struct cpu' containing a fully declared 1348793b36bSNick Todd# embedded 'struct machcpu' 1358793b36bSNick Todd# 1368793b36bSNick ToddLINTFLAGS += -D_MACHDEP -I../../i86pc 1378793b36bSNick Todd 1387c478bd9Sstevel@tonic-gate# 1397c478bd9Sstevel@tonic-gate# Default build targets. 1407c478bd9Sstevel@tonic-gate# 1417c478bd9Sstevel@tonic-gate.KEEP_STATE: 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gatedef: $(DEF_DEPS) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gateall: $(ALL_DEPS) 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gateclean: $(CLEAN_DEPS) 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gateclobber: $(CLOBBER_DEPS) 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gatelint: $(LINT_DEPS) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gatemodlintlib: $(MODLINTLIB_DEPS) 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gateclean.lint: $(CLEAN_LINT_DEPS) 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gateinstall: $(INSTALL_DEPS) 1587c478bd9Sstevel@tonic-gate 159*ab65fd2aSRichard Lowe# Due to what seems to be an issue in GCC 4 generated DWARF containing 160*ab65fd2aSRichard Lowe# symbolic relocations against non-allocatable .debug sections, libgenunix.so 161*ab65fd2aSRichard Lowe# must be built from a stripped object, thus we create an intermediary 162*ab65fd2aSRichard Lowe# libgenunix.o we can safely strip. 163*ab65fd2aSRichard LoweLIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o 164*ab65fd2aSRichard LoweCLEANFILES += $(LIBGENUNIX_O) 165*ab65fd2aSRichard Lowe 166*ab65fd2aSRichard Lowe$(LIBGENUNIX_O): $(OBJECTS) 167*ab65fd2aSRichard Lowe $(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS) 168*ab65fd2aSRichard Lowe $(STRIP) -x $(OBJS_DIR)/libgenunix.o 169*ab65fd2aSRichard Lowe 170*ab65fd2aSRichard Lowe$(LIBGEN): $(LIBGENUNIX_O) $(LIBSTUBS) 171*ab65fd2aSRichard Lowe $(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS) 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate$(IPCTF_TARGET) ipctf_target: FRC 1747c478bd9Sstevel@tonic-gate @cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR) 1757c478bd9Sstevel@tonic-gate @pwd 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS) 1787c478bd9Sstevel@tonic-gate $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS) 1797c478bd9Sstevel@tonic-gate $(CTFMERGE_GENUNIX_MERGE) 1807c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate# 1837c478bd9Sstevel@tonic-gate# Include common targets. 1847c478bd9Sstevel@tonic-gate# 1857c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/intel/Makefile.targ 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate# 1887c478bd9Sstevel@tonic-gate# Software workarounds for hardware "features". 1897c478bd9Sstevel@tonic-gate# 1907c478bd9Sstevel@tonic-gateinclude $(UTSBASE)/i86pc/Makefile.workarounds 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gateALL_DEFS += $(WORKAROUND_DEFS) 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate# 1957c478bd9Sstevel@tonic-gate# Override. 1967c478bd9Sstevel@tonic-gate# 1977c478bd9Sstevel@tonic-gate$(MODULE).lint := GEN_LINT_LIB = 198