xref: /illumos-gate/usr/src/uts/intel/genunix/Makefile (revision 15f90b02bdacbf0ae47fa105944f15b6596f9748)
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-variable
83CERRWARN	+= -_gcc=-Wno-unused-value
84CERRWARN	+= -_gcc=-Wno-unused-function
85CERRWARN	+= -_gcc=-Wno-parentheses
86CERRWARN	+= $(CNOWARN_UNINIT)
87CERRWARN	+= -_gcc=-Wno-clobbered
88CERRWARN	+= -_gcc=-Wno-empty-body
89
90#
91# Some compilers default to stripping unused debug information from
92# objects. Since genunix is used as the uniquification source for CTF data
93# in the kernel, explicitly keep as much debug data as possible.
94#
95CFLAGS		+= $(CALLSYMS)
96
97# very hairy
98$(OBJS_DIR)/u8_textprep.o := SMATCH=off
99
100# false positives
101SMOFF += index_overflow
102$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check
103$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check
104
105# need work still
106SMOFF += signed,all_func_returns
107$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check
108$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data
109$(OBJS_DIR)/klpd.o := SMOFF += cast_assign
110$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow
111$(OBJS_DIR)/process.o := SMOFF += or_vs_and
112$(OBJS_DIR)/sunpci.o := SMOFF += deref_check
113$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check
114
115# 3rd party code
116$(OBJS_DIR)/bz2bzlib.o := SMOFF += indenting
117
118#
119#	Default build targets.
120#
121.KEEP_STATE:
122
123def:		$(DEF_DEPS)
124
125all:		$(ALL_DEPS)
126
127clean:		$(CLEAN_DEPS)
128
129clobber:	$(CLOBBER_DEPS)
130
131install:	$(INSTALL_DEPS)
132
133# Due to what seems to be an issue in GCC 4 generated DWARF containing
134# symbolic relocations against non-allocatable .debug sections, libgenunix.so
135# must be built from a stripped object, thus we create an intermediary
136# libgenunix.o we can safely strip.
137LIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o
138CLEANFILES += $(LIBGENUNIX_O)
139
140$(LIBGENUNIX_O): $(OBJECTS)
141	$(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS)
142	$(STRIP) -x $(OBJS_DIR)/libgenunix.o
143
144$(LIBGEN):	$(LIBGENUNIX_O) $(LIBSTUBS)
145	$(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS)
146
147$(IPCTF_TARGET) ipctf_target: FRC
148	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
149	@pwd
150
151$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS)
152	$(LD) -ztype=kmod $(LDFLAGS) -o $@ $(OBJECTS)
153	$(CTFMERGE_GENUNIX_MERGE)
154	$(POST_PROCESS)
155
156#
157#	Include common targets.
158#
159include $(UTSBASE)/intel/Makefile.targ
160
161#
162#	Software workarounds for hardware "features".
163#
164include	$(UTSBASE)/i86pc/Makefile.workarounds
165
166ALL_DEFS += $(WORKAROUND_DEFS)
167