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