xref: /illumos-gate/usr/src/uts/intel/Makefile (revision 3d393ee6c37fa10ac512ed6d36109ad616dc7c1a)
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# uts/intel/Makefile
22#
23# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28#
29#	This makefile drives the production of all implementation architecture
30#	independent modules for Intel processors.
31
32UTSBASE = ..
33
34include Makefile.intel
35
36LINT_KMODS_X1	= $(LINT_KMODS:nsmb=)
37LINT_KMODS_X2	= $(LINT_KMODS_X1:smbfs=)
38LINT_KMODLIBS	= $(LINT_KMODS_X2:e1000g=)
39LINT_LIBS	= $(LINT_LIB) $(GEN_LINT_LIB) \
40		  $(LINT_KMODLIBS:%=$(LINT_LIB_DIR)/llib-l%.ln) \
41		  $(CLOSED_LINT_KMODS:%=$(LINT_LIB_DIR)/llib-l%.ln)
42
43# EXPORT DELETE START
44$(CLOSED_BUILD)LINT_LIBS	+= $(SVVS_KMODS:%=$(LINT_LIB_DIR)/llib-l%.ln)
45$(CLOSED_BUILD)LINT_CLOSED_XMOD4	= $(CLOSED_XMODS:bnx=)
46$(CLOSED_BUILD)LINT_CLOSED_XMOD3	= $(LINT_CLOSED_XMOD4:lsimega=)
47$(CLOSED_BUILD)LINT_CLOSED_XMOD2	= $(LINT_CLOSED_XMOD3:spwr=)
48$(CLOSED_BUILD)LINT_CLOSED_XMOD1	= $(LINT_CLOSED_XMOD2:adpu320=)
49$(CLOSED_BUILD)LINT_LIBS	+= $(LINT_XMODLIBS:%=$(LINT_LIB_DIR)/llib-l%.ln)
50
51#
52# dprov is delivered in the SUNWcryptoint package.
53#
54DRV_KMODS	+= dprov
55
56# EXPORT DELETE END
57
58#
59#
60def		:=	TARGET= def
61def.prereq	:=	TARGET= def
62all		:=	TARGET= all
63all.prereq	:=	TARGET= all
64install		:=	TARGET= install
65install.prereq	:=	TARGET= all
66clean		:=	TARGET= clean
67clobber		:=	TARGET= clobber
68lint		:=	TARGET= lint
69lint.prereq	:=	TARGET= lint
70modlintlib	:=	TARGET= modlintlib
71modlist		:=	TARGET= modlist
72modlist		:=	NO_STATE= -K $$MODSTATE$$$$
73clean.lint	:=	TARGET= clean.lint
74check		:=	TARGET= check
75install_h	:=	TARGET= install_h
76install_h.prereq	:=	TARGET= install_h
77
78.KEEP_STATE:
79
80.PARALLEL:	$(PARALLEL_KMODS) $(CLOSED_KMODS) $(SVVS) $(XMODS) \
81		$(CLOSED_XMODS) config $(LINT_DEPS)
82
83def all install clean clobber modlist: genassym $(KMODS) $(CLOSED_KMODS) \
84	$(SVVS) $(XMODS) $(CLOSED_XMODS) config
85
86
87#
88# Privilege constants
89#
90# NOTE: The rules for generating priv_const.c file are shared between all
91# processor architectures and and should be kept in sync. If they are changed in
92# this file make sure that sparc rules are updated as well.
93#
94PRIVS_C = $(SRC)/uts/common/os/priv_const.c
95
96$(PRIVS_C): $(PRIVS_AWK) $(PRIVS_DEF)
97	$(NAWK) -f $(PRIVS_AWK) < $(PRIVS_DEF) cfile=$@
98
99#
100# Prerequisites
101#
102# The uts/Makefile defines build parallelism for x86 platforms such that i86pc,
103# i86xpv and intel are all built in parallel. This requires building certain
104# parts before the parallel build can start. The uts/Makefile appends the
105# '.prereq' string to the original target and executes this Makefile to build
106# any prerequisites needed before the full parallel build can start. After that
107# make continues with normal targets.
108#
109# Any build prerequisites for x86 builds should be described here.
110#
111# genassym is used to build intel/dtrace and genunix, so it should be built
112# first.
113#
114# priv_const.c is required to build genunix.
115#
116# genunix is used by everyone to ctf-merge with. Genunix is CTF-merged with
117#   intel/ip so as a side effect this dependency builds intel/ip as part of the
118#   prerequisites.
119#
120# intel/dtrace depends on i86pc/genassym, so we need to build both
121# i86pc/genassym and intel/genassym.
122#
123all.prereq install.prereq def.prereq: genassym genunix FRC
124	@cd ../i86pc/genassym; pwd; $(MAKE) $(@:%.prereq=%)
125
126#
127# i86pc lint libraries should be built first
128#
129lint.prereq: FRC
130	@cd ../i86pc; pwd; $(MAKE) $(NO_STATE) lint
131
132#
133# Nothing to do for any other prerequisite targets.
134#
135%.prereq:
136
137genunix: $(PRIVS_C)
138
139modlintlib clean.lint: $(LINT_KMODS) $(CLOSED_LINT_KMODS) $(SVVS) \
140	$(XMODS) $(CLOSED_XMODS)
141
142genassym $(KMODS) $(SUBDIRS) config:	FRC
143	@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
144
145$(CLOSED_KMODS):	FRC
146	cd $(CLOSED)/uts/intel/$@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
147
148$(XMODS):	FRC
149	@if [ -f $@/Makefile  ]; then \
150		cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET); \
151	else \
152		true; \
153	fi
154
155$(SVVS) $(CLOSED_XMODS):	FRC
156	@if [ -f $(CLOSED)/uts/intel/$@/Makefile  ]; then \
157		cd $(CLOSED)/uts/intel/$@; pwd; \
158		    $(MAKE) $(NO_STATE) $(TARGET); \
159	else \
160		true; \
161	fi
162
163install_h check:	FRC
164	@cd sys; pwd; $(MAKE) $(TARGET)
165	@cd asm; pwd; $(MAKE) $(TARGET)
166	@cd ia32/sys; pwd; $(MAKE) $(TARGET)
167	@cd amd64/sys; pwd; $(MAKE) $(TARGET)
168
169#
170# Work-around to disable acpica global crosscheck lint warnings
171#
172LGREP.intel =	grep -v 'intel/io/acpica'
173
174#
175#	Full kernel lint target.
176#
177LINT_TARGET	= globallint
178
179# workaround for multiply defined errors
180globallint := LINTFLAGS += -erroff=E_NAME_MULTIPLY_DEF2
181
182globallint:
183	@pwd
184	@-$(ECHO) "\nFULL KERNEL: global crosschecks:"
185	@-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.intel) | $(LGREP.2)
186
187lint:	modlintlib .WAIT $(LINT_DEPS)
188
189# EXPORT DELETE START
190
191EXPORT_SRC:
192	$(RM) Makefile+
193	sed -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
194	    < Makefile > Makefile+
195	$(MV) Makefile+ Makefile
196	$(CHMOD) 444 Makefile
197
198# EXPORT DELETE END
199
200include ../Makefile.targ
201