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