xref: /illumos-gate/usr/src/uts/intel/genunix/Makefile (revision ac2f5fbefc05314fcd97b03f2338b39e6efe643f)
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#
28
29#
30#	Path to the base of the uts directory tree (usually /usr/src/uts).
31#
32UTSBASE	= ../..
33
34#
35#	Define the module and object file sets.
36#
37MODULE		= genunix
38GENUNIX		= $(OBJS_DIR)/$(MODULE)
39
40OBJECTS		= $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \
41		  $(NOT_YET_KMODS:%=$(OBJS_DIR)/%)
42
43ROOTMODULE	= $(ROOT_KERN_DIR)/$(MODULE)
44
45LIBGEN		= $(OBJS_DIR)/libgenunix.so
46LIBSTUBS	= $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%)
47
48#
49#	Include common rules.
50#
51include $(UTSBASE)/intel/Makefile.intel
52
53#
54#	Define targets
55#
56ALL_TARGET	= $(LIBGEN) $(GENUNIX)
57INSTALL_TARGET	= $(LIBGEN) $(GENUNIX) $(ROOTMODULE)
58
59#
60#	Overrides
61#
62CLOBBERFILES	+= $(GENUNIX)
63CLEANFILES	+= $(LIBSTUBS) $(LIBGEN)
64BINARY		=
65
66#
67# Non-patch genunix builds merge a version of the ip module called ipctf.  This
68# is to ensure that the common network-related types are included in genunix and
69# can thus be uniquified out of other modules.  We don't want to do this for
70# patch builds, since we can't guarantee that ip and genunix will be in the same
71# patch.
72#
73IPCTF_TARGET	= $(IPCTF)
74$(PATCH_BUILD)IPCTF_TARGET =
75
76CPPFLAGS	+= -I$(SRC)/common
77CPPFLAGS	+= -I$(SRC)/uts/common/fs/zfs
78
79CPPFLAGS	+= -I$(UTSBASE)/i86pc
80
81CERRWARN	+= -_gcc=-Wno-unused-label
82CERRWARN	+= -_gcc=-Wno-unused-variable
83CERRWARN	+= -_gcc=-Wno-unused-value
84CERRWARN	+= -_gcc=-Wno-unused-function
85CERRWARN	+= -_gcc=-Wno-parentheses
86CERRWARN	+= -_gcc=-Wno-switch
87CERRWARN	+= -_gcc=-Wno-type-limits
88CERRWARN	+= $(CNOWARN_UNINIT)
89CERRWARN	+= -_gcc=-Wno-clobbered
90CERRWARN	+= -_gcc=-Wno-empty-body
91
92# very hairy
93$(OBJS_DIR)/u8_textprep.o := SMATCH=off
94
95# false positives
96SMOFF += index_overflow
97$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check
98$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check
99
100# need work still
101SMOFF += signed,indenting,all_func_returns
102$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check
103$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data
104$(OBJS_DIR)/klpd.o := SMOFF += cast_assign
105$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow
106$(OBJS_DIR)/process.o := SMOFF += or_vs_and
107$(OBJS_DIR)/sunpci.o := SMOFF += deref_check
108$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check
109
110# definitely wrong
111$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and
112
113#
114#	Default build targets.
115#
116.KEEP_STATE:
117
118def:		$(DEF_DEPS)
119
120all:		$(ALL_DEPS)
121
122clean:		$(CLEAN_DEPS)
123
124clobber:	$(CLOBBER_DEPS)
125
126install:	$(INSTALL_DEPS)
127
128# Due to what seems to be an issue in GCC 4 generated DWARF containing
129# symbolic relocations against non-allocatable .debug sections, libgenunix.so
130# must be built from a stripped object, thus we create an intermediary
131# libgenunix.o we can safely strip.
132LIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o
133CLEANFILES += $(LIBGENUNIX_O)
134
135$(LIBGENUNIX_O): $(OBJECTS)
136	$(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS)
137	$(STRIP) -x $(OBJS_DIR)/libgenunix.o
138
139$(LIBGEN):	$(LIBGENUNIX_O) $(LIBSTUBS)
140	$(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS)
141
142$(IPCTF_TARGET) ipctf_target: FRC
143	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
144	@pwd
145
146$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS)
147	$(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
148	$(CTFMERGE_GENUNIX_MERGE)
149	$(POST_PROCESS)
150
151#
152#	Include common targets.
153#
154include $(UTSBASE)/intel/Makefile.targ
155
156#
157#	Software workarounds for hardware "features".
158#
159include	$(UTSBASE)/i86pc/Makefile.workarounds
160
161ALL_DEFS += $(WORKAROUND_DEFS)
162