xref: /illumos-gate/usr/src/uts/intel/genunix/Makefile (revision ae115bc7)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29#
30#	This makefile drives the production of the generic
31#	unix kernel module.
32#
33#	x86 implementation architecture dependent
34#
35
36#
37#	Path to the base of the uts directory tree (usually /usr/src/uts).
38#
39UTSBASE	= ../..
40
41#
42#	Define the module and object file sets.
43#
44MODULE		= genunix
45GENUNIX		= $(OBJS_DIR)/$(MODULE)
46
47OBJECTS		= $(GENUNIX_OBJS:%=$(OBJS_DIR)/%) \
48		  $(NOT_YET_KMODS:%=$(OBJS_DIR)/%)
49
50LINTS		= $(GENUNIX_OBJS:%.o=$(LINTS_DIR)/%.ln) \
51		  $(NOT_YET_KMODS:%.o=$(LINTS_DIR)/%.ln)
52
53ROOTMODULE	= $(ROOT_KERN_DIR)/$(MODULE)
54
55LIBGEN		= $(OBJS_DIR)/libgenunix.so
56LIBSTUBS	= $(GENSTUBS_OBJS:%=$(OBJS_DIR)/%)
57
58#
59#	Include common rules.
60#
61include $(UTSBASE)/intel/Makefile.intel
62
63#
64#	Define targets
65#
66ALL_TARGET	= $(LIBGEN)
67LINT_TARGET	= $(MODULE).lint
68INSTALL_TARGET	= $(GENUNIX) $(ROOTMODULE)
69
70#
71#	Overrides
72#
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
87
88#
89# For now, disable these lint checks; maintainers should endeavor
90# to investigate and remove these for maximum lint coverage.
91# Please do not carry these forward to new Makefiles.
92#
93LINTTAGS	+= -erroff=E_SUSPICIOUS_COMPARISON
94LINTTAGS	+= -erroff=E_BAD_PTR_CAST_ALIGN
95LINTTAGS	+= -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED
96LINTTAGS	+= -erroff=E_STATIC_UNUSED
97LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
98LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
99
100#
101#	Default build targets.
102#
103.KEEP_STATE:
104
105.PARALLEL:	$(LIBSTUBS)
106
107def:		$(DEF_DEPS)
108
109all:		$(ALL_DEPS)
110
111clean:		$(CLEAN_DEPS)
112
113clobber:	$(CLOBBER_DEPS)
114
115lint:		$(LINT_DEPS)
116
117modlintlib:	$(MODLINTLIB_DEPS)
118
119clean.lint:	$(CLEAN_LINT_DEPS)
120
121#
122# if test is an ugly hack for race where genunix
123# doesn't install sometimes
124#
125install:	$(INSTALL_DEPS)
126	if [ ! -f "$(ROOT_KERN_DIR)/$(MODULE)" -o \
127	     ! -f "$(ROOT_KERN_DIR)/amd64/$(MODULE)" ]; then \
128		$(MAKE) install; \
129	fi;
130
131$(LIBGEN):	$(GENUNIX) $(LIBSTUBS)
132	$(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
133
134$(IPCTF_TARGET) ipctf_target: FRC
135	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
136	@pwd
137
138$(GENUNIX): $(IPCTF_TARGET) $(OBJECTS)
139	$(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
140	$(CTFMERGE_GENUNIX_MERGE)
141	$(POST_PROCESS)
142
143#
144#	Include common targets.
145#
146include $(UTSBASE)/intel/Makefile.targ
147
148#
149#	Software workarounds for hardware "features".
150#
151include	$(UTSBASE)/i86pc/Makefile.workarounds
152
153ALL_DEFS += $(WORKAROUND_DEFS)
154
155#
156# Override.
157#
158$(MODULE).lint := GEN_LINT_LIB =
159