xref: /illumos-gate/usr/src/uts/intel/genunix/Makefile (revision b6b206fc)
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 (c) 2018, Joyent, Inc.
27
28#
29#	This makefile drives the production of the generic
30#	unix kernel module.
31#
32#	x86 implementation architecture dependent
33#
34
35#
36#	Path to the base of the uts directory tree (usually /usr/src/uts).
37#
38UTSBASE	= ../..
39
40#
41#	Define the module and object file sets.
42#
43MODULE		= genunix
44GENUNIX		= $(OBJS_DIR)/$(MODULE)
45
46OBJECTS		= $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \
47		  $(NOT_YET_KMODS:%=$(OBJS_DIR)/%)
48
49LINTS		= $(GENUNIX_OBJS:%.o=$(LINTS_DIR)/%.ln) \
50		  $(NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln)
51
52ROOTMODULE	= $(ROOT_KERN_DIR)/$(MODULE)
53
54LIBGEN		= $(OBJS_DIR)/libgenunix.so
55LIBSTUBS	= $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%)
56
57#
58#	Include common rules.
59#
60include $(UTSBASE)/intel/Makefile.intel
61
62#
63#	Define targets
64#
65ALL_TARGET	= $(LIBGEN) $(GENUNIX)
66LINT_TARGET	= $(MODULE).lint
67INSTALL_TARGET	= $(LIBGEN) $(GENUNIX) $(ROOTMODULE)
68
69#
70#	Overrides
71#
72CLOBBERFILES	+= $(GENUNIX)
73CLEANFILES	+= $(LIBSTUBS) $(LIBGEN)
74BINARY		=
75
76#
77# Non-patch genunix builds merge a version of the ip module called ipctf.  This
78# is to ensure that the common network-related types are included in genunix and
79# can thus be uniquified out of other modules.  We don't want to do this for
80# patch builds, since we can't guarantee that ip and genunix will be in the same
81# patch.
82#
83IPCTF_TARGET	= $(IPCTF)
84$(PATCH_BUILD)IPCTF_TARGET =
85
86CPPFLAGS	+= -I$(SRC)/common
87CPPFLAGS	+= -I$(SRC)/uts/common/fs/zfs
88
89CPPFLAGS	+= -I$(UTSBASE)/i86pc
90
91#
92# For now, disable these lint checks; maintainers should endeavor
93# to investigate and remove these for maximum lint coverage.
94# Please do not carry these forward to new Makefiles.
95#
96LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
97LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
98LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
99LINTTAGS	+= -erroff=E_STATIC_UNUSED
100LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
101LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
102
103CERRWARN	+= -_gcc=-Wno-unused-label
104CERRWARN	+= -_gcc=-Wno-unused-variable
105CERRWARN	+= -_gcc=-Wno-unused-value
106CERRWARN	+= -_gcc=-Wno-unused-function
107CERRWARN	+= -_gcc=-Wno-parentheses
108CERRWARN	+= -_gcc=-Wno-switch
109CERRWARN	+= -_gcc=-Wno-type-limits
110CERRWARN	+= -_gcc=-Wno-uninitialized
111CERRWARN	+= -_gcc=-Wno-clobbered
112CERRWARN	+= -_gcc=-Wno-empty-body
113
114# false positives
115SMOFF += index_overflow
116$(OBJS_DIR)/seg_vn.o := SMOFF += deref_check
117$(OBJS_DIR)/ddi_intr_irm.o := SMOFF += deref_check
118
119# need work still
120SMOFF += signed,indenting,all_func_returns
121$(OBJS_DIR)/clock_highres.o := SMOFF += signed_integer_overflow_check
122$(OBJS_DIR)/evchannels.o := SMOFF += allocating_enough_data
123$(OBJS_DIR)/klpd.o := SMOFF += cast_assign
124$(OBJS_DIR)/lookup.o := SMOFF += strcpy_overflow
125$(OBJS_DIR)/process.o := SMOFF += or_vs_and
126$(OBJS_DIR)/sunpci.o := SMOFF += deref_check
127$(OBJS_DIR)/timers.o := SMOFF += signed_integer_overflow_check
128
129# definitely wrong
130$(OBJS_DIR)/acl_common.o := SMOFF += or_vs_and
131
132#
133# Ensure that lint sees 'struct cpu' containing a fully declared
134# embedded 'struct machcpu'
135#
136LINTFLAGS	+= -D_MACHDEP -I../../i86pc
137
138#
139#	Default build targets.
140#
141.KEEP_STATE:
142
143def:		$(DEF_DEPS)
144
145all:		$(ALL_DEPS)
146
147clean:		$(CLEAN_DEPS)
148
149clobber:	$(CLOBBER_DEPS)
150
151lint:		$(LINT_DEPS)
152
153modlintlib:	$(MODLINTLIB_DEPS)
154
155clean.lint:	$(CLEAN_LINT_DEPS)
156
157install:	$(INSTALL_DEPS)
158
159$(LIBGEN):	$(GENUNIX) $(LIBSTUBS)
160	$(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
161
162$(IPCTF_TARGET) ipctf_target: FRC
163	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
164	@pwd
165
166$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS)
167	$(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
168	$(CTFMERGE_GENUNIX_MERGE)
169	$(POST_PROCESS)
170
171#
172#	Include common targets.
173#
174include $(UTSBASE)/intel/Makefile.targ
175
176#
177#	Software workarounds for hardware "features".
178#
179include	$(UTSBASE)/i86pc/Makefile.workarounds
180
181ALL_DEFS += $(WORKAROUND_DEFS)
182
183#
184# Override.
185#
186$(MODULE).lint := GEN_LINT_LIB =
187