xref: /titanic_41/usr/src/uts/Makefile.targ (revision 2e2ba02ab7624d286e5c33d91b8e60a515e88126)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
5fb9f9b97Skupfer# Common Development and Distribution License (the "License").
6fb9f9b97Skupfer# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
2284d8c05bSMike Kupfer# Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
237c478bd9Sstevel@tonic-gate#
247c478bd9Sstevel@tonic-gate#	This Makefiles contains the common targets and definitions for
257c478bd9Sstevel@tonic-gate#	all kernels. It is to be included in the Makefiles for specific
267c478bd9Sstevel@tonic-gate#	implementation architectures and processor architecture dependent
277c478bd9Sstevel@tonic-gate#	modules: i.e.: all driving kernel Makefiles.
287c478bd9Sstevel@tonic-gate#
297c478bd9Sstevel@tonic-gate
307c478bd9Sstevel@tonic-gate#
317c478bd9Sstevel@tonic-gate#	Default rule for building the lint library directory:
327c478bd9Sstevel@tonic-gate#
337c478bd9Sstevel@tonic-gate$(LINT_LIB_DIR):
347c478bd9Sstevel@tonic-gate	-@mkdir -p $@ 2> /dev/null
357c478bd9Sstevel@tonic-gate
367c478bd9Sstevel@tonic-gate#
377c478bd9Sstevel@tonic-gate#	All C objects depend on inline files. However, cc(1) doesn't generate
387c478bd9Sstevel@tonic-gate#	the correct dependency info. Also, these Makefiles don't contain a
397c478bd9Sstevel@tonic-gate#	separate list of C-derived object files (but it is light weight to
407c478bd9Sstevel@tonic-gate#	let the assembler files think they depend upon this when they don't).
417c478bd9Sstevel@tonic-gate#	Fortunately, the inline files won't change very often. So, for now,
427c478bd9Sstevel@tonic-gate#	all objects depend on the inline files. Remove this when the inliner
437c478bd9Sstevel@tonic-gate#	is fixed to drop correct dependency information.
447c478bd9Sstevel@tonic-gate#
457c478bd9Sstevel@tonic-gate$(OBJECTS): $(INLINES)
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate#
487c478bd9Sstevel@tonic-gate#	Partially link .o files to generate the kmod. The fake dependency
497c478bd9Sstevel@tonic-gate#	on modstubs simplifies things...
507c478bd9Sstevel@tonic-gate#	ELFSIGN_MOD is defined in the individual KCF plug-in modules Makefiles,
517c478bd9Sstevel@tonic-gate#	and will sign the ELF objects using elfsign(1).
527c478bd9Sstevel@tonic-gate#
537c478bd9Sstevel@tonic-gate$(BINARY):		$(OBJECTS)
547c478bd9Sstevel@tonic-gate	$(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
557c478bd9Sstevel@tonic-gate	$(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX)
567c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
577c478bd9Sstevel@tonic-gate	$(ELFSIGN_MOD)
587c478bd9Sstevel@tonic-gate
597c478bd9Sstevel@tonic-gate#
607c478bd9Sstevel@tonic-gate#	This target checks each kmod for undefined entry points. It does not
617c478bd9Sstevel@tonic-gate#	modify the kmod in any way.
627c478bd9Sstevel@tonic-gate#
637c478bd9Sstevel@tonic-gate$(MODULE).check:	FRC
647c478bd9Sstevel@tonic-gate	@BUILD_TYPE=DBG32 $(MAKE) $(MODULE).check.targ
657c478bd9Sstevel@tonic-gate
667c478bd9Sstevel@tonic-gate$(MODULE).check.targ:	$(BINARY) $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
677c478bd9Sstevel@tonic-gate	$(LD) -o /dev/null $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
687c478bd9Sstevel@tonic-gate
697c478bd9Sstevel@tonic-gate#
707c478bd9Sstevel@tonic-gate#	Module lint library construction targets.
717c478bd9Sstevel@tonic-gate#
727c478bd9Sstevel@tonic-gateMOD_LINT_LIB	= $(LINT_LIB_DIR)/llib-l$(LINT_MODULE).ln
737c478bd9Sstevel@tonic-gate
747c478bd9Sstevel@tonic-gate$(MOD_LINT_LIB):	$(LINT_LIB_DIR) $(LINTS)
757c478bd9Sstevel@tonic-gate	@-$(ECHO) "\n$(OBJS_DIR)/$(MODULE): (library construction):"
76878eeb1bSGordon Ross	@($(LINT) -o $(LINT_MODULE)-$(OBJS_DIR) \
77878eeb1bSGordon Ross		$(LINTFLAGS) $(LINTS) $(LTAIL))
78ae115bc7Smrj	@$(MV) llib-l$(LINT_MODULE)-$(OBJS_DIR).ln $@
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate$(LINT_MODULE).lint:	$(MOD_LINT_LIB) $(LINT_LIB) $(GEN_LINT_LIB)
817c478bd9Sstevel@tonic-gate	@-$(ECHO) "\n$(OBJS_DIR)/$(LINT_MODULE): global crosschecks:"
82878eeb1bSGordon Ross	@($(LINT) $(LINTFLAGS) $(MOD_LINT_LIB) \
83878eeb1bSGordon Ross		$(LINT_LIB) $(GEN_LINT_LIB) $(LTAIL))
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate#
867c478bd9Sstevel@tonic-gate# Since assym.h is a derived file, the dependency must be explicit for
877c478bd9Sstevel@tonic-gate# all files including this file. (This is only actually required in the
887c478bd9Sstevel@tonic-gate# instance when the .nse_depinfo file does not exist.) It may seem that
897c478bd9Sstevel@tonic-gate# the lint targets should also have a similar dependency, but they don't
907c478bd9Sstevel@tonic-gate# since only C headers are included when #defined(lint) is true. The
917c478bd9Sstevel@tonic-gate# actual lists are defined in */Makefile.files.
927c478bd9Sstevel@tonic-gate#
937c478bd9Sstevel@tonic-gate$(ASSYM_DEPS:%=$(OBJS_DIR)/%):	$(DSF_DIR)/$(OBJS_DIR)/assym.h
947c478bd9Sstevel@tonic-gate
957c478bd9Sstevel@tonic-gate#
967c478bd9Sstevel@tonic-gate#	Everybody need to know how to create a modstubs.o built with the
977c478bd9Sstevel@tonic-gate#	appropriate flags and located in the appropriate location.
987c478bd9Sstevel@tonic-gate#
997c478bd9Sstevel@tonic-gate$(MODSTUBS_O):	$(MODSTUBS)
1007c478bd9Sstevel@tonic-gate	$(COMPILE.s) -o $@ $(MODSTUBS)
1017c478bd9Sstevel@tonic-gate
1027c478bd9Sstevel@tonic-gate$(LINTS_DIR)/modstubs.ln:	$(MODSTUBS)
1037c478bd9Sstevel@tonic-gate	@($(LHEAD) $(LINT.s) $(MODSTUBS) $(LTAIL))
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate#
1067c478bd9Sstevel@tonic-gate# Build the source file which contains the kernel's utsname,
1077c478bd9Sstevel@tonic-gate# with release, version and machine set as follows:
1087c478bd9Sstevel@tonic-gate#
1097c478bd9Sstevel@tonic-gate#	release: contents of $(RELEASE) (Spaces replaced by '_')
1107c478bd9Sstevel@tonic-gate#	version: contents of $(PATCHID) (Spaces replaced by '_')
111ae115bc7Smrj#	machine: contents of $(UNAME_M)
1127c478bd9Sstevel@tonic-gate#
1137c478bd9Sstevel@tonic-gate# Build environment information is only contained in the comment section.
1147c478bd9Sstevel@tonic-gate#
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gate$(OBJS_DIR)/vers.o: $(OBJECTS)
1177c478bd9Sstevel@tonic-gate	$(COMPILE.c) -DUTS_RELEASE=\"`$(ECHO) $(RELEASE) | sed -e 's/ /_/g'`\" \
118*2e2ba02aSJosef 'Jeff' Sipek	    -DUTS_VERSION=\"`$(ECHO) $(PATCHID) | sed -e 's/ /_/g'`\" \
119ae115bc7Smrj	    -DUTS_PLATFORM=\"$(UNAME_M)\" -o $@ $(SRC)/uts/common/os/vers.c
1207c478bd9Sstevel@tonic-gate	$(CTFCONVERT_O)
1217c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
1227c478bd9Sstevel@tonic-gate
1237c478bd9Sstevel@tonic-gate$(LINTS_DIR)/vers.ln: $(SRC)/uts/common/os/vers.c
1247c478bd9Sstevel@tonic-gate	@($(LHEAD) $(LINT.c) -DUTS_RELEASE=\"\" -DUTS_VERSION=\"\" \
1257c478bd9Sstevel@tonic-gate	    -DUTS_PLATFORM=\"\" $(SRC)/uts/common/os/vers.c $(LTAIL))
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate#
1287c478bd9Sstevel@tonic-gate#	Installation targets and rules:
1297c478bd9Sstevel@tonic-gate#
1307c478bd9Sstevel@tonic-gate$(ROOT_MOD_DIR) $(USR_MOD_DIR):
13148bc00d6Sjmcp	-$(INS.dir)
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gate$(ROOT_MOD_DIRS_32):	$(ROOT_MOD_DIR)
13448bc00d6Sjmcp	-$(INS.dir)
1357c478bd9Sstevel@tonic-gate
1367c478bd9Sstevel@tonic-gate$(USR_MOD_DIRS_32):	$(USR_MOD_DIR)
13748bc00d6Sjmcp	-$(INS.dir)
1387c478bd9Sstevel@tonic-gate
1397c478bd9Sstevel@tonic-gate$(ROOT_MOD_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC
1407c478bd9Sstevel@tonic-gate	$(INS.file)
1417c478bd9Sstevel@tonic-gate
1427aec1d6eScindi$(ROOT_CPU_DIR)/%:	$(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC
1437aec1d6eScindi	$(INS.file)
1447aec1d6eScindi
1457c478bd9Sstevel@tonic-gate$(ROOT_DRV_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC
1467c478bd9Sstevel@tonic-gate	$(INS.file)
1477c478bd9Sstevel@tonic-gate
1487c478bd9Sstevel@tonic-gate$(ROOT_DTRACE_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC
1497c478bd9Sstevel@tonic-gate	$(INS.file)
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate$(ROOT_EXEC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC
1527c478bd9Sstevel@tonic-gate	$(INS.file)
1537c478bd9Sstevel@tonic-gate
1547c478bd9Sstevel@tonic-gate$(ROOT_FS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_FS_DIR) FRC
1557c478bd9Sstevel@tonic-gate	$(INS.file)
1567c478bd9Sstevel@tonic-gate
1577c478bd9Sstevel@tonic-gate$(ROOT_SCHED_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC
1587c478bd9Sstevel@tonic-gate	$(INS.file)
1597c478bd9Sstevel@tonic-gate
1600f1702c5SYu Xiangning$(ROOT_SOCK_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC
1610f1702c5SYu Xiangning	$(INS.file)
1620f1702c5SYu Xiangning
1637c478bd9Sstevel@tonic-gate$(ROOT_STRMOD_DIR)/%:	$(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC
1647c478bd9Sstevel@tonic-gate	$(INS.file)
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gate$(ROOT_IPP_DIR)/%:	$(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC
1677c478bd9Sstevel@tonic-gate	$(INS.file)
1687c478bd9Sstevel@tonic-gate
1697c478bd9Sstevel@tonic-gate$(ROOT_SYS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC
1707c478bd9Sstevel@tonic-gate	$(INS.file)
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gate$(ROOT_MISC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC
1737c478bd9Sstevel@tonic-gate	$(INS.file)
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gate$(ROOT_DACF_DIR)/%:	$(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC
1767c478bd9Sstevel@tonic-gate	$(INS.file)
1777c478bd9Sstevel@tonic-gate
1789acbbeafSnn35248$(ROOT_BRAND_DIR)/%:	$(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC
1799acbbeafSnn35248	$(INS.file)
1809acbbeafSnn35248
1817c478bd9Sstevel@tonic-gate$(ROOT_CRYPTO_DIR)/%:	$(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC
1827c478bd9Sstevel@tonic-gate	$(INS.file)
1837c478bd9Sstevel@tonic-gate
1847c478bd9Sstevel@tonic-gate$(ROOT_KGSS_DIR)/%:	$(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC
1857c478bd9Sstevel@tonic-gate	$(INS.file)
1867c478bd9Sstevel@tonic-gate
1871e1ddd6cScth$(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC
1881e1ddd6cScth	$(INS.file)
1891e1ddd6cScth
1904c06356bSdh142964$(ROOT_PMCS_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC
1914c06356bSdh142964	$(INS.file)
1924c06356bSdh142964
193fcf3ce44SJohn Forte$(ROOT_QLC_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC
194fcf3ce44SJohn Forte	$(INS.file)
195fcf3ce44SJohn Forte
196291a2b48SSukumar Swaminathan$(ROOT_EMLXS_FW_DIR)/%:	$(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC
197291a2b48SSukumar Swaminathan	$(INS.file)
198291a2b48SSukumar Swaminathan
1997c478bd9Sstevel@tonic-gate$(ROOT_MACH_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC
2007c478bd9Sstevel@tonic-gate	$(INS.file)
2017c478bd9Sstevel@tonic-gate
2027c478bd9Sstevel@tonic-gate$(ROOT_FONT_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC
2037c478bd9Sstevel@tonic-gate	$(INS.file)
2047c478bd9Sstevel@tonic-gate
205ba2e4443Sseb$(ROOT_MAC_DIR)/%:	$(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC
206ba2e4443Sseb	$(INS.file)
207ba2e4443Sseb
2087c478bd9Sstevel@tonic-gate$(USR_DRV_DIR)/%:	$(OBJS_DIR)/% $(USR_DRV_DIR) FRC
2097c478bd9Sstevel@tonic-gate	$(INS.file)
2107c478bd9Sstevel@tonic-gate
2117c478bd9Sstevel@tonic-gate$(USR_EXEC_DIR)/%:	$(OBJS_DIR)/% $(USR_EXEC_DIR) FRC
2127c478bd9Sstevel@tonic-gate	$(INS.file)
2137c478bd9Sstevel@tonic-gate
2147c478bd9Sstevel@tonic-gate$(USR_FS_DIR)/%:	$(OBJS_DIR)/% $(USR_FS_DIR) FRC
2157c478bd9Sstevel@tonic-gate	$(INS.file)
2167c478bd9Sstevel@tonic-gate
2177c478bd9Sstevel@tonic-gate$(USR_SCHED_DIR)/%:	$(OBJS_DIR)/% $(USR_SCHED_DIR) FRC
2187c478bd9Sstevel@tonic-gate	$(INS.file)
2197c478bd9Sstevel@tonic-gate
2200a0e9771SDarren Reed$(USR_SOCK_DIR)/%:	$(OBJS_DIR)/% $(USR_SOCK_DIR) FRC
2210a0e9771SDarren Reed	$(INS.file)
2220a0e9771SDarren Reed
2237c478bd9Sstevel@tonic-gate$(USR_STRMOD_DIR)/%:	$(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC
2247c478bd9Sstevel@tonic-gate	$(INS.file)
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate$(USR_SYS_DIR)/%:	$(OBJS_DIR)/% $(USR_SYS_DIR) FRC
2277c478bd9Sstevel@tonic-gate	$(INS.file)
2287c478bd9Sstevel@tonic-gate
2297c478bd9Sstevel@tonic-gate$(USR_MISC_DIR)/%:	$(OBJS_DIR)/% $(USR_MISC_DIR) FRC
2307c478bd9Sstevel@tonic-gate	$(INS.file)
2317c478bd9Sstevel@tonic-gate
2327c478bd9Sstevel@tonic-gate$(USR_DACF_DIR)/%:	$(OBJS_DIR)/% $(USR_DACF_DIR) FRC
2337c478bd9Sstevel@tonic-gate	$(INS.file)
2347c478bd9Sstevel@tonic-gate
2357c478bd9Sstevel@tonic-gate$(USR_PCBE_DIR)/%:	$(OBJS_DIR)/% $(USR_PCBE_DIR) FRC
2367c478bd9Sstevel@tonic-gate	$(INS.file)
2377c478bd9Sstevel@tonic-gate
2389a9ae70fSjv227347$(USR_DTRACE_DIR)/%:	$(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC
2399a9ae70fSjv227347	$(INS.file)
2409a9ae70fSjv227347
2419a9ae70fSjv227347$(USR_BRAND_DIR)/%:	$(OBJS_DIR)/% $(USR_BRAND_DIR) FRC
2429a9ae70fSjv227347	$(INS.file)
2439a9ae70fSjv227347
244d14d7d31Sis$(ROOT_KICONV_DIR)/%:	$(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC
245d14d7d31Sis	$(INS.file)
246d14d7d31Sis
2477c478bd9Sstevel@tonic-gateinclude $(SRC)/Makefile.psm.targ
2487c478bd9Sstevel@tonic-gate
2497c478bd9Sstevel@tonic-gate#
2507c478bd9Sstevel@tonic-gate#	Target for 64b modules
2517c478bd9Sstevel@tonic-gate#
2527c478bd9Sstevel@tonic-gate$(ROOT_KERN_DIR_64):
25348bc00d6Sjmcp	-$(INS.dir)
2547c478bd9Sstevel@tonic-gate
2557c478bd9Sstevel@tonic-gate$(ROOT_KERN_DIR_64)/%:	$(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC
2567c478bd9Sstevel@tonic-gate	$(INS.file)
2577c478bd9Sstevel@tonic-gate
2587c478bd9Sstevel@tonic-gate%/$(SUBDIR64):		%
25948bc00d6Sjmcp	-$(INS.dir)
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate#
2627c478bd9Sstevel@tonic-gate#	Targets for '.conf' file installation.
2637c478bd9Sstevel@tonic-gate#
2647c478bd9Sstevel@tonic-gate$(ROOT_CONFFILE):	$(SRC_CONFFILE)	$(ROOT_CONFFILE:%/$(CONFFILE)=%)
2657c478bd9Sstevel@tonic-gate	$(INS.conffile)
2667c478bd9Sstevel@tonic-gate
2677c478bd9Sstevel@tonic-gate#
2687c478bd9Sstevel@tonic-gate#	Targets for creating links between common platforms. ROOT_PLAT_LINKS
2697c478bd9Sstevel@tonic-gate#	are are the /platform level while ROOT_PLAT_LINKS_2 are one level
2707c478bd9Sstevel@tonic-gate#	down (/platform/`uname -i`/{lib|sbin|kernel}.
2717c478bd9Sstevel@tonic-gate#
2727c478bd9Sstevel@tonic-gate$(ROOT_PLAT_LINKS):
2737c478bd9Sstevel@tonic-gate	$(INS.slink1)
2747c478bd9Sstevel@tonic-gate
2757c478bd9Sstevel@tonic-gate$(ROOT_PLAT_LINKS_2):
2767c478bd9Sstevel@tonic-gate	$(INS.slink2)
2777c478bd9Sstevel@tonic-gate
2787c478bd9Sstevel@tonic-gate$(USR_PLAT_LINKS):
2797c478bd9Sstevel@tonic-gate	$(INS.slink1)
2807c478bd9Sstevel@tonic-gate
2817c478bd9Sstevel@tonic-gate$(USR_PLAT_LINKS_2):
2827c478bd9Sstevel@tonic-gate	$(INS.slink2)
2837c478bd9Sstevel@tonic-gate
2847c478bd9Sstevel@tonic-gate#
2857c478bd9Sstevel@tonic-gate# multiple builds support
2867c478bd9Sstevel@tonic-gate#
2877c478bd9Sstevel@tonic-gatedef $(DEF_DEPS)			:= TARGET = def
2887c478bd9Sstevel@tonic-gateall $(ALL_DEPS)			:= TARGET = all
2897c478bd9Sstevel@tonic-gateclean $(CLEAN_DEPS)		:= TARGET = clean
2907c478bd9Sstevel@tonic-gateclobber $(CLOBBER_DEPS)		:= TARGET = clobber
2917c478bd9Sstevel@tonic-gatelint $(LINT_DEPS)		:= TARGET = lint
2927c478bd9Sstevel@tonic-gatemodlintlib $(MODLINTLIB_DEPS)	:= TARGET = modlintlib
293fb9f9b97Skupfermodlist	$(MODLIST_DEPS)		:= TARGET = modlist
294fb9f9b97Skupfermodlist	$(MODLIST_DEPS)		:= NO_STATE= -K $$MODSTATE$$$$
2957c478bd9Sstevel@tonic-gateclean.lint $(CLEAN_LINT_DEPS)	:= TARGET = clean.lint
2967c478bd9Sstevel@tonic-gateinstall $(INSTALL_DEPS)		:= TARGET = install
2977c478bd9Sstevel@tonic-gatesymcheck $(SYM_DEPS)		:= TARGET = symcheck
2987c478bd9Sstevel@tonic-gate
299fb9f9b97SkupferALL_TARGS	= def all clean clobber lint modlintlib \
300fb9f9b97Skupfer		  clean.lint lintlib install symcheck
3017c478bd9Sstevel@tonic-gate
3027c478bd9Sstevel@tonic-gateALL_OBJ32	= $(ALL_TARGS:%=%.obj32)
3037c478bd9Sstevel@tonic-gate
3047c478bd9Sstevel@tonic-gate$(ALL_OBJ32):	FRC
305fb9f9b97Skupfer	@BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3067c478bd9Sstevel@tonic-gate
3077c478bd9Sstevel@tonic-gateALL_DEBUG32	= $(ALL_TARGS:%=%.debug32)
3087c478bd9Sstevel@tonic-gate
3097c478bd9Sstevel@tonic-gate$(ALL_DEBUG32):	FRC
310fb9f9b97Skupfer	@BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3117c478bd9Sstevel@tonic-gate
3127c478bd9Sstevel@tonic-gateALL_OBJ64	= $(ALL_TARGS:%=%.obj64)
3137c478bd9Sstevel@tonic-gate
3147c478bd9Sstevel@tonic-gate$(ALL_OBJ64):	FRC
315fb9f9b97Skupfer	@BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gateALL_DEBUG64	= $(ALL_TARGS:%=%.debug64)
3187c478bd9Sstevel@tonic-gate
3197c478bd9Sstevel@tonic-gate$(ALL_DEBUG64):	FRC
320fb9f9b97Skupfer	@BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
3217c478bd9Sstevel@tonic-gate
322112f9fc1Syz155240#
323112f9fc1Syz155240#	Currently only the IP module needs symbol checking on obj64.
324112f9fc1Syz155240#	Other modules have the same global-objs nm output for debug64 and obj64.
325112f9fc1Syz155240#
326112f9fc1Syz155240$(SISCHECK_DEPS):	$(DEF_DEPS)
327112f9fc1Syz155240	@TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
328112f9fc1Syz155240	MODSYMS=$(MODULE).symbols.$$TARG; \
329112f9fc1Syz155240	if [ -f "$(MODULE).global-objs.$$TARG" ]; then \
330112f9fc1Syz155240		$(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \
331112f9fc1Syz155240		    $(SORT) -u > $$MODSYMS.tmp; \
332112f9fc1Syz155240		$(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \
333756e192dSyz155240		    $(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \
334756e192dSyz155240		    $(GREP) -v '\.[0-9]*$$' |$(SORT) -u \
335112f9fc1Syz155240		    > $$MODSYMS.tmp.new; \
336112f9fc1Syz155240		$(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \
337112f9fc1Syz155240		    ($(ECHO) "warning: $(MODULE) symbol checking:" \
338112f9fc1Syz155240		    "global variable(s) introduced and/or removed."; \
339112f9fc1Syz155240		    $(CAT) $$MODSYMS.diff; exit 1) \
340112f9fc1Syz155240	fi
341112f9fc1Syz155240
342112f9fc1Syz155240$(SISCLEAN_DEPS):
343112f9fc1Syz155240	-TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
344112f9fc1Syz155240	MODSYMS=$(MODULE).symbols.$$TARG; \
345112f9fc1Syz155240	$(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove
346112f9fc1Syz155240
3477c478bd9Sstevel@tonic-gate
3487c478bd9Sstevel@tonic-gate$(OBJS_DIR):
3497c478bd9Sstevel@tonic-gate	-@mkdir -p $@ 2> /dev/null
3507c478bd9Sstevel@tonic-gate
3517c478bd9Sstevel@tonic-gatedef.targ:		$(OBJS_DIR) $(ALL_TARGET)
3527c478bd9Sstevel@tonic-gate
3537c478bd9Sstevel@tonic-gateall.targ:		$(OBJS_DIR) $(ALL_TARGET)
3547c478bd9Sstevel@tonic-gate
3557c478bd9Sstevel@tonic-gatelint.targ:		$(OBJS_DIR) $(LINT_TARGET)
3567c478bd9Sstevel@tonic-gate
3577c478bd9Sstevel@tonic-gatemodlintlib.targ:	$(OBJS_DIR) $(MOD_LINT_LIB)
3587c478bd9Sstevel@tonic-gate
3597c478bd9Sstevel@tonic-gateinstall.targ:		$(OBJS_DIR) $(INSTALL_TARGET)
3607c478bd9Sstevel@tonic-gate
3617c478bd9Sstevel@tonic-gate#
362fb9f9b97Skupfer# Support for Install.sh.
363fb9f9b97Skupfer#
364fb9f9b97Skupfer
365fb9f9b97Skupfermodlist:	$(MODLIST_DEPS)
366fb9f9b97Skupfer
367fb9f9b97Skupfer# paths relative to $(ROOT).
368fb9f9b97SkupferRELMODULE = $(ROOTMODULE:$(ROOT)/%=%)
369fb9f9b97SkupferRELCONF = $(ROOT_CONFFILE:$(ROOT)/%=%)
370fb9f9b97SkupferRELLINK = $(ROOTLINK:$(ROOT)/%=%)
371fb9f9b97SkupferRELUNIX = $(UNIX32_LINK:$(ROOT)/%=%)
372fb9f9b97SkupferRELSOFTLINKS = $(ROOTSOFTLINKS:$(ROOT)/%=%)
373fb9f9b97Skupfer
374fb9f9b97SkupferMODSRC:sh=		pwd
375fb9f9b97Skupfer
376fb9f9b97Skupfer#
37784d8c05bSMike Kupfer# Generate module information for Install.sh, i.e., specify what files
37884d8c05bSMike Kupfer# Install.sh should include.  Each line looks like
37984d8c05bSMike Kupfer#   <tag> <srcdir> <arg1> <arg2> ...
38084d8c05bSMike Kupfer# where <tag> specifies the type of file, <srcdir> gives the source
38184d8c05bSMike Kupfer# path (useful if there is an error), and <argN> is one or more
38284d8c05bSMike Kupfer# additional bits of information that Install.sh needs (e.g., source
38384d8c05bSMike Kupfer# directory, install directory, filtering tags).  See Install.sh for
38484d8c05bSMike Kupfer# details on the arguments for each tag type, especially the functions
38584d8c05bSMike Kupfer# copymod, filtmod, and filtimpl.
38684d8c05bSMike Kupfer#
387fb9f9b97Skupfer# Changes to this target may require corresponding changes to
388fb9f9b97Skupfer# Install.sh.
38984d8c05bSMike Kupfer#
390fb9f9b97Skupfer# Don't issue a MOD entry if it's not in the install list.
391fb9f9b97Skupfer#
39284d8c05bSMike Kupfer
393fb9f9b97Skupfer$(MODLIST_DEPS): FRC
394fb9f9b97Skupfer	@case $@ in \
395fb9f9b97Skupfer	*32) \
396fb9f9b97Skupfer		class=32; \
39784d8c05bSMike Kupfer		[ -n "$(RELMODULE)" ] && relmodule=`dirname $(RELMODULE)`;; \
398fb9f9b97Skupfer	*64) \
399fb9f9b97Skupfer		class=64; \
40084d8c05bSMike Kupfer		[ -n "$(RELMODULE)" ] && \
4010f1702c5SYu Xiangning		    relmodule=`dirname $(RELMODULE)`/$(SUBDIR64);; \
402fb9f9b97Skupfer	esac; \
403fb9f9b97Skupfer	if [ -z "$(THISIMPL)" ]; then \
404fb9f9b97Skupfer		impl=all; \
405fb9f9b97Skupfer	else \
406fb9f9b97Skupfer		impl=$(THISIMPL); \
407fb9f9b97Skupfer	fi; \
408fb9f9b97Skupfer	if [ -n "$(ROOTMODULE)" -a -n "$(INSTALL_TARGET)" ]; then \
409fb9f9b97Skupfer		if [ -z "$(MODULE)" ]; then \
410fb9f9b97Skupfer			module=`basename $(ROOTMODULE)`; \
411fb9f9b97Skupfer		else \
412fb9f9b97Skupfer			module=$(MODULE); \
413fb9f9b97Skupfer		fi; \
414fb9f9b97Skupfer		tinstall="$(INSTALL_TARGET)"; \
415fb9f9b97Skupfer		for t in $$tinstall; do \
416fb9f9b97Skupfer			if [ "$(ROOTMODULE)" = $$t ]; then \
41784d8c05bSMike Kupfer				echo MOD $(MODSRC) $$module $$relmodule \
41884d8c05bSMike Kupfer				    $$class $$impl; \
419fb9f9b97Skupfer				break; \
420fb9f9b97Skupfer			fi \
421fb9f9b97Skupfer		done \
422fb9f9b97Skupfer	fi; \
423fb9f9b97Skupfer	if [ -n "$(CONF_SRCDIR)" ]; then \
424fb9f9b97Skupfer		tinstall="$(INSTALL_TARGET)"; \
425fb9f9b97Skupfer		for t in $$tinstall; do \
426fb9f9b97Skupfer			if [ $(ROOT_CONFFILE) = $$t ]; then \
42784d8c05bSMike Kupfer				echo CONF $(MODSRC) $(RELCONF) \
428fb9f9b97Skupfer				    $(MODSRC)/$(CONF_SRCDIR) $$impl $$module; \
429fb9f9b97Skupfer				break; \
430fb9f9b97Skupfer			fi \
431fb9f9b97Skupfer		done \
432fb9f9b97Skupfer	fi; \
433fb9f9b97Skupfer	if [ -n "$(ROOTLINK)" ]; then \
4340f1702c5SYu Xiangning		rellinks="$(RELLINK)"; \
4350f1702c5SYu Xiangning		for r in $$rellinks; do \
4360f1702c5SYu Xiangning			if [ $$class = 32 ]; then \
4370f1702c5SYu Xiangning				linkdir=`dirname $$r`; \
4380f1702c5SYu Xiangning			else \
4390f1702c5SYu Xiangning				linkdir=`dirname $$r`/$(SUBDIR64); \
4400f1702c5SYu Xiangning			fi; \
44184d8c05bSMike Kupfer			echo LINK $(MODSRC) $$relmodule $$module \
4420f1702c5SYu Xiangning				$$linkdir `basename $$r` $$impl; \
4430f1702c5SYu Xiangning		done \
444fb9f9b97Skupfer	fi; \
445fb9f9b97Skupfer	if [ -n "$(UNIX32_LINK)" ]; then \
44684d8c05bSMike Kupfer		echo SYMLINK $(MODSRC) $(SUBDIR64)/$(UNIX) \
447fb9f9b97Skupfer		    `dirname $(RELUNIX)` unix $$impl $$module; \
448fb9f9b97Skupfer	fi; \
449fb9f9b97Skupfer	trelsoftlinks="$(RELSOFTLINKS)"; \
450fb9f9b97Skupfer	for t in $$trelsoftlinks; do \
451fb9f9b97Skupfer		if [ $$class = 32 ]; then \
452fb9f9b97Skupfer			linkdir=`dirname $$t`; \
453fb9f9b97Skupfer		else \
454fb9f9b97Skupfer			linkdir=`dirname $$t`/$(SUBDIR64); \
455fb9f9b97Skupfer		fi; \
456fb9f9b97Skupfer		linkname=`basename $$t`; \
45784d8c05bSMike Kupfer		echo SYMLINK $(MODSRC) $(MODULE) $$linkdir $$linkname \
458fb9f9b97Skupfer		    $$impl $$module; \
459fb9f9b97Skupfer	done
460fb9f9b97Skupfer
461fb9f9b97Skupfer#
4627c478bd9Sstevel@tonic-gate#	Cleanliness is next to ...
4637c478bd9Sstevel@tonic-gate#
4647c478bd9Sstevel@tonic-gateclean.targ:
4657c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANFILES) Nothing_to_remove
4667c478bd9Sstevel@tonic-gate
4677c478bd9Sstevel@tonic-gateclobber.targ:
4687c478bd9Sstevel@tonic-gate	-$(RM) $(CLOBBERFILES) Nothing_to_remove
4697c478bd9Sstevel@tonic-gate
4707c478bd9Sstevel@tonic-gateclean.lint.targ:
4717c478bd9Sstevel@tonic-gate	-$(RM) $(CLEANLINTFILES) Nothing_to_remove
4727c478bd9Sstevel@tonic-gate
4737c478bd9Sstevel@tonic-gate#
4747c478bd9Sstevel@tonic-gate#	Create fake lintlibs in the 64b dirs so
4757c478bd9Sstevel@tonic-gate#	global linting works
4767c478bd9Sstevel@tonic-gate#
4777c478bd9Sstevel@tonic-gatelint64:
4787c478bd9Sstevel@tonic-gate	@$(ECHO) $(MODULE) fake lints
4797c478bd9Sstevel@tonic-gate	@for dir in $(LINT64_DIRS); do \
4807c478bd9Sstevel@tonic-gate		if [ ! -d $$dir ]; then mkdir $$dir; fi \
4817c478bd9Sstevel@tonic-gate	done
4827c478bd9Sstevel@tonic-gate	@for file in $(LINT64_FILES); do \
4837c478bd9Sstevel@tonic-gate		if [ ! -f $$file ]; then touch $$file; fi \
4847c478bd9Sstevel@tonic-gate	done
4857c478bd9Sstevel@tonic-gate
4867c478bd9Sstevel@tonic-gate#
4877c478bd9Sstevel@tonic-gate#	In some places we also need to create fake lintlibs for 32b
4887c478bd9Sstevel@tonic-gate#	dirs so global linting works
4897c478bd9Sstevel@tonic-gate#
4907c478bd9Sstevel@tonic-gatelint32:
4917c478bd9Sstevel@tonic-gate	@$(ECHO) $(MODULE) fake lints
4927c478bd9Sstevel@tonic-gate	@for dir in $(LINT32_DIRS); do \
4937c478bd9Sstevel@tonic-gate		if [ ! -d $$dir ]; then mkdir $$dir; fi \
4947c478bd9Sstevel@tonic-gate	done
4957c478bd9Sstevel@tonic-gate	@for file in $(LINT32_FILES); do \
4967c478bd9Sstevel@tonic-gate		if [ ! -f $$file ]; then touch $$file; fi \
4977c478bd9Sstevel@tonic-gate	done
498ae115bc7Smrj
4997c478bd9Sstevel@tonic-gateFRC:
500