17c478bdstevel@tonic-gate#
27c478bdstevel@tonic-gate# CDDL HEADER START
37c478bdstevel@tonic-gate#
47c478bdstevel@tonic-gate# The contents of this file are subject to the terms of the
5fb9f9b9kupfer# Common Development and Distribution License (the "License").
6fb9f9b9kupfer# You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate#
87c478bdstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate# See the License for the specific language governing permissions
117c478bdstevel@tonic-gate# and limitations under the License.
127c478bdstevel@tonic-gate#
137c478bdstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate#
197c478bdstevel@tonic-gate# CDDL HEADER END
207c478bdstevel@tonic-gate#
217c478bdstevel@tonic-gate#
2284d8c05Mike Kupfer# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
23cd27764Garrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org>
24f73e030Hans Rosenfeld# Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
2545a4b79Sebastien Roy# Copyright (c) 2017 by Delphix. All rights reserved.
267c478bdstevel@tonic-gate#
277c478bdstevel@tonic-gate#	This Makefiles contains the common targets and definitions for
287c478bdstevel@tonic-gate#	all kernels. It is to be included in the Makefiles for specific
297c478bdstevel@tonic-gate#	implementation architectures and processor architecture dependent
307c478bdstevel@tonic-gate#	modules: i.e.: all driving kernel Makefiles.
317c478bdstevel@tonic-gate#
327c478bdstevel@tonic-gate
337c478bdstevel@tonic-gate#
347c478bdstevel@tonic-gate#	Default rule for building the lint library directory:
357c478bdstevel@tonic-gate#
367c478bdstevel@tonic-gate$(LINT_LIB_DIR):
377c478bdstevel@tonic-gate	-@mkdir -p $@ 2> /dev/null
387c478bdstevel@tonic-gate
397c478bdstevel@tonic-gate#
407c478bdstevel@tonic-gate#	All C objects depend on inline files. However, cc(1) doesn't generate
417c478bdstevel@tonic-gate#	the correct dependency info. Also, these Makefiles don't contain a
427c478bdstevel@tonic-gate#	separate list of C-derived object files (but it is light weight to
437c478bdstevel@tonic-gate#	let the assembler files think they depend upon this when they don't).
447c478bdstevel@tonic-gate#	Fortunately, the inline files won't change very often. So, for now,
457c478bdstevel@tonic-gate#	all objects depend on the inline files. Remove this when the inliner
467c478bdstevel@tonic-gate#	is fixed to drop correct dependency information.
477c478bdstevel@tonic-gate#
487c478bdstevel@tonic-gate$(OBJECTS): $(INLINES)
497c478bdstevel@tonic-gate
507c478bdstevel@tonic-gate#
517c478bdstevel@tonic-gate#	Partially link .o files to generate the kmod. The fake dependency
527c478bdstevel@tonic-gate#	on modstubs simplifies things...
537c478bdstevel@tonic-gate#
543e3ca1cRobert Mustacchi$(BINARY):		$(OBJECTS) $(DTRACE_MAPFILE)
557c478bdstevel@tonic-gate	$(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
567c478bdstevel@tonic-gate	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
577c478bdstevel@tonic-gate	$(POST_PROCESS)
587c478bdstevel@tonic-gate
597c478bdstevel@tonic-gate#
607c478bdstevel@tonic-gate#	This target checks each kmod for undefined entry points. It does not
617c478bdstevel@tonic-gate#	modify the kmod in any way.
627c478bdstevel@tonic-gate#
637c478bdstevel@tonic-gate$(MODULE).check:	FRC
647c478bdstevel@tonic-gate	@BUILD_TYPE=DBG32 $(MAKE) $(MODULE).check.targ
657c478bdstevel@tonic-gate
667c478bdstevel@tonic-gate$(MODULE).check.targ:	$(BINARY) $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
677c478bdstevel@tonic-gate	$(LD) -o /dev/null $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
687c478bdstevel@tonic-gate
697c478bdstevel@tonic-gate#
707c478bdstevel@tonic-gate#	Module lint library construction targets.
717c478bdstevel@tonic-gate#
727c478bdstevel@tonic-gateMOD_LINT_LIB	= $(LINT_LIB_DIR)/llib-l$(LINT_MODULE).ln
737c478bdstevel@tonic-gate
747c478bdstevel@tonic-gate$(MOD_LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
757c478bdstevel@tonic-gate	@-$(ECHO) "\n$(OBJS_DIR)/$(MODULE): (library construction):"
76878eeb1Gordon Ross	@($(LINT) -o $(LINT_MODULE)-$(OBJS_DIR) \
77878eeb1Gordon Ross		$(LINTFLAGS) $(LINTS) $(LTAIL))
78ae115bcmrj	@$(MV) llib-l$(LINT_MODULE)-$(OBJS_DIR).ln $@
797c478bdstevel@tonic-gate
807c478bdstevel@tonic-gate$(LINT_MODULE).lint:	$(MOD_LINT_LIB) $(LINT_LIB) $(GEN_LINT_LIB)
817c478bdstevel@tonic-gate	@-$(ECHO) "\n$(OBJS_DIR)/$(LINT_MODULE): global crosschecks:"
82878eeb1Gordon Ross	@($(LINT) $(LINTFLAGS) $(MOD_LINT_LIB) \
83878eeb1Gordon Ross		$(LINT_LIB) $(GEN_LINT_LIB) $(LTAIL))
847c478bdstevel@tonic-gate
857c478bdstevel@tonic-gate#
867c478bdstevel@tonic-gate# Since assym.h is a derived file, the dependency must be explicit for
877c478bdstevel@tonic-gate# all files including this file. (This is only actually required in the
887c478bdstevel@tonic-gate# instance when the .nse_depinfo file does not exist.) It may seem that
897c478bdstevel@tonic-gate# the lint targets should also have a similar dependency, but they don't
907c478bdstevel@tonic-gate# since only C headers are included when #defined(lint) is true. The
917c478bdstevel@tonic-gate# actual lists are defined in */Makefile.files.
927c478bdstevel@tonic-gate#
937c478bdstevel@tonic-gate$(ASSYM_DEPS:%=$(OBJS_DIR)/%):	$(DSF_DIR)/$(OBJS_DIR)/assym.h
947c478bdstevel@tonic-gate
957c478bdstevel@tonic-gate#
967c478bdstevel@tonic-gate#	Everybody need to know how to create a modstubs.o built with the
977c478bdstevel@tonic-gate#	appropriate flags and located in the appropriate location.
987c478bdstevel@tonic-gate#
997c478bdstevel@tonic-gate$(MODSTUBS_O):	$(MODSTUBS)
1007c478bdstevel@tonic-gate	$(COMPILE.s) -o $@ $(MODSTUBS)
1017c478bdstevel@tonic-gate
1027c478bdstevel@tonic-gate$(LINTS_DIR)/modstubs.ln:	$(MODSTUBS)
1037c478bdstevel@tonic-gate	@($(LHEAD) $(LINT.s) $(MODSTUBS) $(LTAIL))
1047c478bdstevel@tonic-gate
1057c478bdstevel@tonic-gate#
1067c478bdstevel@tonic-gate# Build the source file which contains the kernel's utsname,
1077c478bdstevel@tonic-gate# with release, version and machine set as follows:
1087c478bdstevel@tonic-gate#
1097c478bdstevel@tonic-gate#	release: contents of $(RELEASE) (Spaces replaced by '_')
1107c478bdstevel@tonic-gate#	version: contents of $(PATCHID) (Spaces replaced by '_')
111ae115bcmrj#	machine: contents of $(UNAME_M)
1127c478bdstevel@tonic-gate#
1137c478bdstevel@tonic-gate# Build environment information is only contained in the comment section.
1147c478bdstevel@tonic-gate#
1157c478bdstevel@tonic-gate
1167c478bdstevel@tonic-gate$(OBJS_DIR)/vers.o: $(OBJECTS)
1177c478bdstevel@tonic-gate	$(COMPILE.c) -DUTS_RELEASE=\"`$(ECHO) $(RELEASE) | sed -e 's/ /_/g'`\" \
11834ae5cdJosef 'Jeff' Sipek	    -DUTS_VERSION=\"`$(ECHO) $(PATCHID) | sed -e 's/ /_/g'`\" \
119ae115bcmrj	    -DUTS_PLATFORM=\"$(UNAME_M)\" -o $@ $(SRC)/uts/common/os/vers.c
1207c478bdstevel@tonic-gate	$(CTFCONVERT_O)
1217c478bdstevel@tonic-gate	$(POST_PROCESS_O)
1227c478bdstevel@tonic-gate
1237c478bdstevel@tonic-gate$(LINTS_DIR)/vers.ln: $(SRC)/uts/common/os/vers.c
1247c478bdstevel@tonic-gate	@($(LHEAD) $(LINT.c) -DUTS_RELEASE=\"\" -DUTS_VERSION=\"\" \
1257c478bdstevel@tonic-gate	    -DUTS_PLATFORM=\"\" $(SRC)/uts/common/os/vers.c $(LTAIL))
1267c478bdstevel@tonic-gate
1277c478bdstevel@tonic-gate#
1287c478bdstevel@tonic-gate#	Installation targets and rules:
1297c478bdstevel@tonic-gate#
1307c478bdstevel@tonic-gate$(ROOT_MOD_DIR) $(USR_MOD_DIR):
13148bc00djmcp	-$(INS.dir)
1327c478bdstevel@tonic-gate
1337c478bdstevel@tonic-gate$(ROOT_MOD_DIRS_32):	$(ROOT_MOD_DIR)
13448bc00djmcp	-$(INS.dir)
1357c478bdstevel@tonic-gate
1367c478bdstevel@tonic-gate$(USR_MOD_DIRS_32):	$(USR_MOD_DIR)
13748bc00djmcp	-$(INS.dir)
1387c478bdstevel@tonic-gate
1397c478bdstevel@tonic-gate$(ROOT_MOD_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC
1407c478bdstevel@tonic-gate	$(INS.file)
1417c478bdstevel@tonic-gate
1427aec1d6cindi$(ROOT_CPU_DIR)/%:	$(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC
1437aec1d6cindi	$(INS.file)
1447aec1d6cindi
1457c478bdstevel@tonic-gate$(ROOT_DRV_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC
1467c478bdstevel@tonic-gate	$(INS.file)
1477c478bdstevel@tonic-gate
1487c478bdstevel@tonic-gate$(ROOT_DTRACE_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC
1497c478bdstevel@tonic-gate	$(INS.file)
1507c478bdstevel@tonic-gate
1517c478bdstevel@tonic-gate$(ROOT_EXEC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC
1527c478bdstevel@tonic-gate	$(INS.file)
1537c478bdstevel@tonic-gate
1547c478bdstevel@tonic-gate$(ROOT_FS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_FS_DIR) FRC
1557c478bdstevel@tonic-gate	$(INS.file)
1567c478bdstevel@tonic-gate
1577c478bdstevel@tonic-gate$(ROOT_SCHED_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC
1587c478bdstevel@tonic-gate	$(INS.file)
1597c478bdstevel@tonic-gate
1600f1702cYu Xiangning<Eric.Yu@Sun.COM>$(ROOT_SOCK_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC
1610f1702cYu Xiangning<Eric.Yu@Sun.COM>	$(INS.file)
1620f1702cYu Xiangning<Eric.Yu@Sun.COM>
1637c478bdstevel@tonic-gate$(ROOT_STRMOD_DIR)/%:	$(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC
1647c478bdstevel@tonic-gate	$(INS.file)
1657c478bdstevel@tonic-gate
1667c478bdstevel@tonic-gate$(ROOT_IPP_DIR)/%:	$(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC
1677c478bdstevel@tonic-gate	$(INS.file)
1687c478bdstevel@tonic-gate
1697c478bdstevel@tonic-gate$(ROOT_SYS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC
1707c478bdstevel@tonic-gate	$(INS.file)
1717c478bdstevel@tonic-gate
1727c478bdstevel@tonic-gate$(ROOT_MISC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC
1737c478bdstevel@tonic-gate	$(INS.file)
1747c478bdstevel@tonic-gate
1757c478bdstevel@tonic-gate$(ROOT_DACF_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC
1767c478bdstevel@tonic-gate	$(INS.file)
1777c478bdstevel@tonic-gate
1789acbbeann$(ROOT_BRAND_DIR)/%:	$(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC
1799acbbeann	$(INS.file)
1809acbbeann
18145a4b79Sebastien Roy$(ROOT_CC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_CC_DIR) FRC
18245a4b79Sebastien Roy	$(INS.file)
18345a4b79Sebastien Roy
1847c478bdstevel@tonic-gate$(ROOT_CRYPTO_DIR)/%:	$(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC
1857c478bdstevel@tonic-gate	$(INS.file)
1867c478bdstevel@tonic-gate
1877c478bdstevel@tonic-gate$(ROOT_KGSS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC
1887c478bdstevel@tonic-gate	$(INS.file)
1897c478bdstevel@tonic-gate
1901e1ddd6cth$(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC
1911e1ddd6cth	$(INS.file)
1921e1ddd6cth
1934c06356dh$(ROOT_PMCS_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC
1944c06356dh	$(INS.file)
1954c06356dh
196fcf3ce4John Forte$(ROOT_QLC_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC
197fcf3ce4John Forte	$(INS.file)
198fcf3ce4John Forte
199291a2b4Sukumar Swaminathan$(ROOT_EMLXS_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC
200291a2b4Sukumar Swaminathan	$(INS.file)
201291a2b4Sukumar Swaminathan
2027c478bdstevel@tonic-gate$(ROOT_MACH_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC
2037c478bdstevel@tonic-gate	$(INS.file)
2047c478bdstevel@tonic-gate
2057c478bdstevel@tonic-gate$(ROOT_FONT_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC
2067c478bdstevel@tonic-gate	$(INS.file)
2077c478bdstevel@tonic-gate
208ba2e444seb$(ROOT_MAC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC
209ba2e444seb	$(INS.file)
210ba2e444seb
2117c478bdstevel@tonic-gate$(USR_DRV_DIR)/%:	$(OBJS_DIR)/% $(USR_DRV_DIR) FRC
2127c478bdstevel@tonic-gate	$(INS.file)
2137c478bdstevel@tonic-gate
2147c478bdstevel@tonic-gate$(USR_EXEC_DIR)/%:	$(OBJS_DIR)/% $(USR_EXEC_DIR) FRC
2157c478bdstevel@tonic-gate	$(INS.file)
2167c478bdstevel@tonic-gate
2177c478bdstevel@tonic-gate$(USR_FS_DIR)/%:	$(OBJS_DIR)/% $(USR_FS_DIR) FRC
2187c478bdstevel@tonic-gate	$(INS.file)
2197c478bdstevel@tonic-gate
2207c478bdstevel@tonic-gate$(USR_SCHED_DIR)/%:	$(OBJS_DIR)/% $(USR_SCHED_DIR) FRC
2217c478bdstevel@tonic-gate	$(INS.file)
2227c478bdstevel@tonic-gate
2230a0e977Darren Reed$(USR_SOCK_DIR)/%:	$(OBJS_DIR)/% $(USR_SOCK_DIR) FRC
2240a0e977Darren Reed	$(INS.file)
2250a0e977Darren Reed
2267c478bdstevel@tonic-gate$(USR_STRMOD_DIR)/%:	$(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC
2277c478bdstevel@tonic-gate	$(INS.file)
2287c478bdstevel@tonic-gate
2297c478bdstevel@tonic-gate$(USR_SYS_DIR)/%:	$(OBJS_DIR)/% $(USR_SYS_DIR) FRC
2307c478bdstevel@tonic-gate	$(INS.file)
2317c478bdstevel@tonic-gate
2327c478bdstevel@tonic-gate$(USR_MISC_DIR)/%:	$(OBJS_DIR)/% $(USR_MISC_DIR) FRC
2337c478bdstevel@tonic-gate	$(INS.file)
2347c478bdstevel@tonic-gate
2357c478bdstevel@tonic-gate$(USR_DACF_DIR)/%:	$(OBJS_DIR)/% $(USR_DACF_DIR) FRC
2367c478bdstevel@tonic-gate	$(INS.file)
2377c478bdstevel@tonic-gate
2387c478bdstevel@tonic-gate$(USR_PCBE_DIR)/%:	$(OBJS_DIR)/% $(USR_PCBE_DIR) FRC
2397c478bdstevel@tonic-gate	$(INS.file)
2407c478bdstevel@tonic-gate
2419a9ae70jv$(USR_DTRACE_DIR)/%:	$(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC
2429a9ae70jv	$(INS.file)
2439a9ae70jv
2449a9ae70jv$(USR_BRAND_DIR)/%:	$(OBJS_DIR)/% $(USR_BRAND_DIR) FRC
2459a9ae70jv	$(INS.file)
2469a9ae70jv
247d14d7d3is$(ROOT_KICONV_DIR)/%:	$(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC
248d14d7d3is	$(INS.file)
249d14d7d3is
250f73e030Hans Rosenfeld$(ROOT_FIRMWARE_DIR)/$(MODULE):
251f73e030Hans Rosenfeld	$(INS.dir)
252f73e030Hans Rosenfeld
253f73e030Hans Rosenfeld$(ROOT_FIRMWARE_DIR)/$(MODULE)/%:= FILEMODE = $(CFILEMODE)
254f73e030Hans Rosenfeld
255f73e030Hans Rosenfeld$(ROOT_FIRMWARE_DIR)/$(MODULE)/%: $(ROOT_FIRMWARE_DIR)/$(MODULE) $(FWDIR)/%
256f73e030Hans Rosenfeld	$(INS.file)
257f73e030Hans Rosenfeld
2587c478bdstevel@tonic-gateinclude $(SRC)/Makefile.psm.targ
2597c478bdstevel@tonic-gate
2607c478bdstevel@tonic-gate#
2617c478bdstevel@tonic-gate#	Target for 64b modules
2627c478bdstevel@tonic-gate#
2637c478bdstevel@tonic-gate$(ROOT_KERN_DIR_64):
26448bc00djmcp	-$(INS.dir)
2657c478bdstevel@tonic-gate
2667c478bdstevel@tonic-gate$(ROOT_KERN_DIR_64)/%:	$(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC
2677c478bdstevel@tonic-gate	$(INS.file)
2687c478bdstevel@tonic-gate
2697c478bdstevel@tonic-gate%/$(SUBDIR64):		%
27048bc00djmcp	-$(INS.dir)
2717c478bdstevel@tonic-gate
2727c478bdstevel@tonic-gate#
2737c478bdstevel@tonic-gate#	Targets for '.conf' file installation.
2747c478bdstevel@tonic-gate#
2757c478bdstevel@tonic-gate$(ROOT_CONFFILE):	$(SRC_CONFFILE)	$(ROOT_CONFFILE:%/$(CONFFILE)=%)
2767c478bdstevel@tonic-gate	$(INS.conffile)
2777c478bdstevel@tonic-gate
2787c478bdstevel@tonic-gate#
2797c478bdstevel@tonic-gate#	Targets for creating links between common platforms. ROOT_PLAT_LINKS
2807c478bdstevel@tonic-gate#	are are the /platform level while ROOT_PLAT_LINKS_2 are one level
2817c478bdstevel@tonic-gate#	down (/platform/`uname -i`/{lib|sbin|kernel}.
2827c478bdstevel@tonic-gate#
2837c478bdstevel@tonic-gate$(ROOT_PLAT_LINKS):
2847c478bdstevel@tonic-gate	$(INS.slink1)
2857c478bdstevel@tonic-gate
2867c478bdstevel@tonic-gate$(ROOT_PLAT_LINKS_2):
2877c478bdstevel@tonic-gate	$(INS.slink2)
2887c478bdstevel@tonic-gate
2897c478bdstevel@tonic-gate$(USR_PLAT_LINKS):
2907c478bdstevel@tonic-gate	$(INS.slink1)
2917c478bdstevel@tonic-gate
2927c478bdstevel@tonic-gate$(USR_PLAT_LINKS_2):
2937c478bdstevel@tonic-gate	$(INS.slink2)
2947c478bdstevel@tonic-gate
2957c478bdstevel@tonic-gate#
2967c478bdstevel@tonic-gate# multiple builds support
2977c478bdstevel@tonic-gate#
2987c478bdstevel@tonic-gatedef $(DEF_DEPS)			:= TARGET = def
2997c478bdstevel@tonic-gateall $(ALL_DEPS)			:= TARGET = all
3007c478bdstevel@tonic-gateclean $(CLEAN_DEPS)		:= TARGET = clean
3017c478bdstevel@tonic-gateclobber $(CLOBBER_DEPS)		:= TARGET = clobber
3027c478bdstevel@tonic-gatelint $(LINT_DEPS)		:= TARGET = lint
3037c478bdstevel@tonic-gatemodlintlib $(MODLINTLIB_DEPS)	:= TARGET = modlintlib
304fb9f9b9kupfermodlist	$(MODLIST_DEPS)		:= TARGET = modlist
305fb9f9b9kupfermodlist	$(MODLIST_DEPS)		:= NO_STATE= -K $$MODSTATE$$$$
3067c478bdstevel@tonic-gateclean.lint $(CLEAN_LINT_DEPS)	:= TARGET = clean.lint
3077c478bdstevel@tonic-gateinstall $(INSTALL_DEPS)		:= TARGET = install
3087c478bdstevel@tonic-gatesymcheck $(SYM_DEPS)		:= TARGET = symcheck
3097c478bdstevel@tonic-gate
310fb9f9b9kupferALL_TARGS	= def all clean clobber lint modlintlib \
311fb9f9b9kupfer		  clean.lint lintlib install symcheck
3127c478bdstevel@tonic-gate
313bbbed74Gordon RossALL_OBJ32	= $(ALL_TARGS:%=%.obj32)
314bbbed74Gordon Ross
315bbbed74Gordon Ross$(ALL_OBJ32):	FRC
316bbbed74Gordon Ross	@BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
317bbbed74Gordon Ross
318bbbed74Gordon RossALL_DEBUG32	= $(ALL_TARGS:%=%.debug32)
319bbbed74Gordon Ross
320bbbed74Gordon Ross$(ALL_DEBUG32):	FRC
321bbbed74Gordon Ross	@BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
322bbbed74Gordon Ross
3237c478bdstevel@tonic-gateALL_OBJ64	= $(ALL_TARGS:%=%.obj64)
3247c478bdstevel@tonic-gate
3257c478bdstevel@tonic-gate$(ALL_OBJ64):	FRC
326fb9f9b9kupfer	@BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3277c478bdstevel@tonic-gate
3287c478bdstevel@tonic-gateALL_DEBUG64	= $(ALL_TARGS:%=%.debug64)
3297c478bdstevel@tonic-gate
3307c478bdstevel@tonic-gate$(ALL_DEBUG64):	FRC
331fb9f9b9kupfer	@BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3327c478bdstevel@tonic-gate
333112f9fcyz#
334112f9fcyz#	Currently only the IP module needs symbol checking on obj64.
335112f9fcyz#	Other modules have the same global-objs nm output for debug64 and obj64.
336112f9fcyz#
337112f9fcyz$(SISCHECK_DEPS):	$(DEF_DEPS)
338112f9fcyz	@TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
339112f9fcyz	MODSYMS=$(MODULE).symbols.$$TARG; \
340112f9fcyz	if [ -f "$(MODULE).global-objs.$$TARG" ]; then \
341112f9fcyz		$(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \
342112f9fcyz		    $(SORT) -u > $$MODSYMS.tmp; \
343112f9fcyz		$(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \
344756e192yz		    $(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \
345756e192yz		    $(GREP) -v '\.[0-9]*$$' |$(SORT) -u \
346112f9fcyz		    > $$MODSYMS.tmp.new; \
347112f9fcyz		$(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \
348112f9fcyz		    ($(ECHO) "warning: $(MODULE) symbol checking:" \
349112f9fcyz		    "global variable(s) introduced and/or removed."; \
350112f9fcyz		    $(CAT) $$MODSYMS.diff; exit 1) \
351112f9fcyz	fi
352112f9fcyz
353112f9fcyz$(SISCLEAN_DEPS):
354112f9fcyz	-TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
355112f9fcyz	MODSYMS=$(MODULE).symbols.$$TARG; \
356112f9fcyz	$(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove
357112f9fcyz
3587c478bdstevel@tonic-gate
3597c478bdstevel@tonic-gate$(OBJS_DIR):
3607c478bdstevel@tonic-gate	-@mkdir -p $@ 2> /dev/null
3617c478bdstevel@tonic-gate
3627c478bdstevel@tonic-gatedef.targ:		$(OBJS_DIR) $(ALL_TARGET)
3637c478bdstevel@tonic-gate
3647c478bdstevel@tonic-gateall.targ:		$(OBJS_DIR) $(ALL_TARGET)
3657c478bdstevel@tonic-gate
3667c478bdstevel@tonic-gatelint.targ:		$(OBJS_DIR) $(LINT_TARGET)
3677c478bdstevel@tonic-gate
3687c478bdstevel@tonic-gatemodlintlib.targ:	$(OBJS_DIR) $(MOD_LINT_LIB)
3697c478bdstevel@tonic-gate
3707c478bdstevel@tonic-gateinstall.targ:		$(OBJS_DIR) $(INSTALL_TARGET)
3717c478bdstevel@tonic-gate
3727c478bdstevel@tonic-gate#
373fb9f9b9kupfer# Support for Install.sh.
374fb9f9b9kupfer#
375fb9f9b9kupfer
376fb9f9b9kupfermodlist:	$(MODLIST_DEPS)
377fb9f9b9kupfer
378fb9f9b9kupfer# paths relative to $(ROOT).
379fb9f9b9kupferRELMODULE = $(ROOTMODULE:$(ROOT)/%=%)
380fb9f9b9kupferRELCONF = $(ROOT_CONFFILE:$(ROOT)/%=%)
381fb9f9b9kupferRELLINK = $(ROOTLINK:$(ROOT)/%=%)
382fb9f9b9kupferRELUNIX = $(UNIX32_LINK:$(ROOT)/%=%)
383fb9f9b9kupferRELSOFTLINKS = $(ROOTSOFTLINKS:$(ROOT)/%=%)
384fb9f9b9kupfer
385fb9f9b9kupferMODSRC:sh=		pwd
386fb9f9b9kupfer
387fb9f9b9kupfer#
38884d8c05Mike Kupfer# Generate module information for Install.sh, i.e., specify what files
38984d8c05Mike Kupfer# Install.sh should include.  Each line looks like
39084d8c05Mike Kupfer#   <tag> <srcdir> <arg1> <arg2> ...
39184d8c05Mike Kupfer# where <tag> specifies the type of file, <srcdir> gives the source
39284d8c05Mike Kupfer# path (useful if there is an error), and <argN> is one or more
39384d8c05Mike Kupfer# additional bits of information that Install.sh needs (e.g., source
39484d8c05Mike Kupfer# directory, install directory, filtering tags).  See Install.sh for
39584d8c05Mike Kupfer# details on the arguments for each tag type, especially the functions
39684d8c05Mike Kupfer# copymod, filtmod, and filtimpl.
39784d8c05Mike Kupfer#
398fb9f9b9kupfer# Changes to this target may require corresponding changes to
399fb9f9b9kupfer# Install.sh.
40084d8c05Mike Kupfer#
401fb9f9b9kupfer# Don't issue a MOD entry if it's not in the install list.
402fb9f9b9kupfer#
40384d8c05Mike Kupfer
404fb9f9b9kupfer$(MODLIST_DEPS): FRC
405fb9f9b9kupfer	@case $@ in \
406fb9f9b9kupfer	*32) \
407fb9f9b9kupfer		class=32; \
40884d8c05Mike Kupfer		[ -n "$(RELMODULE)" ] && relmodule=`dirname $(RELMODULE)`;; \
409fb9f9b9kupfer	*64) \
410fb9f9b9kupfer		class=64; \
41184d8c05Mike Kupfer		[ -n "$(RELMODULE)" ] && \
41284d8c05Mike Kupfer		    relmodule=`dirname $(RELMODULE)`/$(SUBDIR64);; \
413fb9f9b9kupfer	esac; \
414fb9f9b9kupfer	if [ -z "$(THISIMPL)" ]; then \
415fb9f9b9kupfer		impl=all; \
416fb9f9b9kupfer	else \
417fb9f9b9kupfer		impl=$(THISIMPL); \
418fb9f9b9kupfer	fi; \
419fb9f9b9kupfer	if [ -n "$(ROOTMODULE)" -a -n "$(INSTALL_TARGET)" ]; then \
420fb9f9b9kupfer		if [ -z "$(MODULE)" ]; then \
421fb9f9b9kupfer			module=`basename $(ROOTMODULE)`; \
422fb9f9b9kupfer		else \
423fb9f9b9kupfer			module=$(MODULE); \
424fb9f9b9kupfer		fi; \
425fb9f9b9kupfer		tinstall="$(INSTALL_TARGET)"; \
426fb9f9b9kupfer		for t in $$tinstall; do \
427fb9f9b9kupfer			if [ "$(ROOTMODULE)" = $$t ]; then \
42884d8c05Mike Kupfer				echo MOD $(MODSRC) $$module $$relmodule \
42984d8c05Mike Kupfer				    $$class $$impl; \
430fb9f9b9kupfer				break; \
431fb9f9b9kupfer			fi \
432fb9f9b9kupfer		done \
433fb9f9b9kupfer	fi; \
434fb9f9b9kupfer	if [ -n "$(CONF_SRCDIR)" ]; then \
435fb9f9b9kupfer		tinstall="$(INSTALL_TARGET)"; \
436fb9f9b9kupfer		for t in $$tinstall; do \
437fb9f9b9kupfer			if [ $(ROOT_CONFFILE) = $$t ]; then \
43884d8c05Mike Kupfer				echo CONF $(MODSRC) $(RELCONF) \
439fb9f9b9kupfer				    $(MODSRC)/$(CONF_SRCDIR) $$impl $$module; \
440fb9f9b9kupfer				break; \
441fb9f9b9kupfer			fi \
442fb9f9b9kupfer		done \
443fb9f9b9kupfer	fi; \
444fb9f9b9kupfer	if [ -n "$(ROOTLINK)" ]; then \
4450f1702cYu Xiangning<Eric.Yu@Sun.COM>		rellinks="$(RELLINK)"; \
4460f1702cYu Xiangning<Eric.Yu@Sun.COM>		for r in $$rellinks; do \
44784d8c05Mike Kupfer			if [ $$class = 32 ]; then \
44884d8c05Mike Kupfer				linkdir=`dirname $$r`; \
44984d8c05Mike Kupfer			else \
45084d8c05Mike Kupfer				linkdir=`dirname $$r`/$(SUBDIR64); \
45184d8c05Mike Kupfer			fi; \
45284d8c05Mike Kupfer			echo LINK $(MODSRC) $$relmodule $$module \
45384d8c05Mike Kupfer				$$linkdir `basename $$r` $$impl; \
4540f1702cYu Xiangning<Eric.Yu@Sun.COM>		done \
455fb9f9b9kupfer	fi; \
456fb9f9b9kupfer	if [ -n "$(UNIX32_LINK)" ]; then \
45784d8c05Mike Kupfer		echo SYMLINK $(MODSRC) $(SUBDIR64)/$(UNIX) \
458fb9f9b9kupfer		    `dirname $(RELUNIX)` unix $$impl $$module; \
459fb9f9b9kupfer	fi; \
460fb9f9b9kupfer	trelsoftlinks="$(RELSOFTLINKS)"; \
461fb9f9b9kupfer	for t in $$trelsoftlinks; do \
462fb9f9b9kupfer		if [ $$class = 32 ]; then \
463fb9f9b9kupfer			linkdir=`dirname $$t`; \
464fb9f9b9kupfer		else \
465fb9f9b9kupfer			linkdir=`dirname $$t`/$(SUBDIR64); \
466fb9f9b9kupfer		fi; \
467fb9f9b9kupfer		linkname=`basename $$t`; \
46884d8c05Mike Kupfer		echo SYMLINK $(MODSRC) $(MODULE) $$linkdir $$linkname \
469fb9f9b9kupfer		    $$impl $$module; \
470fb9f9b9kupfer	done
471fb9f9b9kupfer
472fb9f9b9kupfer#
4737c478bdstevel@tonic-gate#	Cleanliness is next to ...
4747c478bdstevel@tonic-gate#
4757c478bdstevel@tonic-gateclean.targ:
4767c478bdstevel@tonic-gate	-$(RM) $(CLEANFILES) Nothing_to_remove
4777c478bdstevel@tonic-gate
4787c478bdstevel@tonic-gateclobber.targ:
4797c478bdstevel@tonic-gate	-$(RM) $(CLOBBERFILES) Nothing_to_remove
4807c478bdstevel@tonic-gate
4817c478bdstevel@tonic-gateclean.lint.targ:
4827c478bdstevel@tonic-gate	-$(RM) $(CLEANLINTFILES) Nothing_to_remove
4837c478bdstevel@tonic-gate
4847c478bdstevel@tonic-gate#
4857c478bdstevel@tonic-gate#	Create fake lintlibs in the 64b dirs so
4867c478bdstevel@tonic-gate#	global linting works
4877c478bdstevel@tonic-gate#
4887c478bdstevel@tonic-gatelint64:
4897c478bdstevel@tonic-gate	@$(ECHO) $(MODULE) fake lints
4907c478bdstevel@tonic-gate	@for dir in $(LINT64_DIRS); do \
4917c478bdstevel@tonic-gate		if [ ! -d $$dir ]; then mkdir $$dir; fi \
4927c478bdstevel@tonic-gate	done
4937c478bdstevel@tonic-gate	@for file in $(LINT64_FILES); do \
4947c478bdstevel@tonic-gate		if [ ! -f $$file ]; then touch $$file; fi \
4957c478bdstevel@tonic-gate	done
4967c478bdstevel@tonic-gate
497bbbed74Gordon Ross#
498bbbed74Gordon Ross#	In some places we also need to create fake lintlibs for 32b
499bbbed74Gordon Ross#	dirs so global linting works
500bbbed74Gordon Ross#
501bbbed74Gordon Rosslint32:
502bbbed74Gordon Ross	@$(ECHO) $(MODULE) fake lints
503bbbed74Gordon Ross	@for dir in $(LINT32_DIRS); do \
504bbbed74Gordon Ross		if [ ! -d $$dir ]; then mkdir $$dir; fi \
505bbbed74Gordon Ross	done
506bbbed74Gordon Ross	@for file in $(LINT32_FILES); do \
507bbbed74Gordon Ross		if [ ! -f $$file ]; then touch $$file; fi \
508bbbed74Gordon Ross	done
509bbbed74Gordon Ross
5107c478bdstevel@tonic-gateFRC:
511