# # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2014 Garrett D'Amore # Copyright 2016 Hans Rosenfeld # Copyright (c) 2017 by Delphix. All rights reserved. # Copyright 2019 Joyent, Inc. # # This Makefiles contains the common targets and definitions for # all kernels. It is to be included in the Makefiles for specific # implementation architectures and processor architecture dependent # modules: i.e.: all driving kernel Makefiles. # # # All C objects depend on inline files. However, cc(1) doesn't generate # the correct dependency info. Also, these Makefiles don't contain a # separate list of C-derived object files (but it is light weight to # let the assembler files think they depend upon this when they don't). # Fortunately, the inline files won't change very often. So, for now, # all objects depend on the inline files. Remove this when the inliner # is fixed to drop correct dependency information. # $(OBJECTS): $(INLINES) # # Partially link .o files to generate the kmod. The fake dependency # on modstubs simplifies things... # $(BINARY): $(OBJECTS) $(DTRACE_MAPFILE) $(MAPFILE) $(LD) -ztype=kmod $(LDFLAGS) -o $@ $(OBJECTS) $(CTFMERGE_UNIQUIFY_AGAINST_GENUNIX) $(POST_PROCESS) # # This target checks each kmod for undefined entry points. It does not # modify the kmod in any way. # $(MODULE).check: FRC @BUILD_TYPE=DBG32 $(MAKE) $(MODULE).check.targ $(MODULE).check.targ: $(BINARY) $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB) $(LD) -o /dev/null $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB) # # Since assym.h is a derived file, the dependency must be explicit for all # files including this file. The actual lists are defined in # */Makefile.files. # $(ASSYM_DEPS:%=$(OBJS_DIR)/%): $(DSF_DIR)/$(OBJS_DIR)/assym.h # # Everybody need to know how to create a modstubs.o built with the # appropriate flags and located in the appropriate location. # $(MODSTUBS_O): $(MODSTUBS) $(COMPILE.s) -o $@ $(MODSTUBS) # # Build the source file which contains the kernel's utsname, # with release, version and machine set as follows: # # release: contents of $(RELEASE) (Spaces replaced by '_') # version: contents of $(PATCHID) (Spaces replaced by '_') # machine: contents of $(UNAME_M) # # Build environment information is only contained in the comment section. # $(OBJS_DIR)/vers.o: $(OBJECTS) $(COMPILE.c) -DUTS_RELEASE=\"`$(ECHO) $(RELEASE) | sed -e 's/ /_/g'`\" \ -DUTS_VERSION=\"`$(ECHO) $(PATCHID) | sed -e 's/ /_/g'`\" \ -DUTS_PLATFORM=\"$(UNAME_M)\" -o $@ $(SRC)/uts/common/os/vers.c $(CTFCONVERT_O) $(POST_PROCESS_O) # # Installation targets and rules: # $(ROOT_MOD_DIR) $(USR_MOD_DIR): -$(INS.dir) $(ROOT_MOD_DIRS_32): $(ROOT_MOD_DIR) -$(INS.dir) $(USR_MOD_DIRS_32): $(USR_MOD_DIR) -$(INS.dir) $(ROOT_MOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC $(INS.file) $(ROOT_CPU_DIR)/%: $(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC $(INS.file) $(ROOT_DRV_DIR)/%: $(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC $(INS.file) $(ROOT_DTRACE_DIR)/%: $(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC $(INS.file) $(ROOT_EXEC_DIR)/%: $(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC $(INS.file) $(ROOT_FS_DIR)/%: $(OBJS_DIR)/% $(ROOT_FS_DIR) FRC $(INS.file) $(ROOT_SCHED_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC $(INS.file) $(ROOT_SOCK_DIR)/%: $(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC $(INS.file) $(ROOT_STRMOD_DIR)/%: $(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC $(INS.file) $(ROOT_IPP_DIR)/%: $(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC $(INS.file) $(ROOT_SYS_DIR)/%: $(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC $(INS.file) $(ROOT_MISC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC $(INS.file) $(ROOT_DACF_DIR)/%: $(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC $(INS.file) $(ROOT_BRAND_DIR)/%: $(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC $(INS.file) $(ROOT_CC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_CC_DIR) FRC $(INS.file) $(ROOT_CRYPTO_DIR)/%: $(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC $(INS.file) $(ROOT_KGSS_DIR)/%: $(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC $(INS.file) $(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC $(INS.file) $(ROOT_PMCS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC $(INS.file) $(ROOT_QLC_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC $(INS.file) $(ROOT_EMLXS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC $(INS.file) $(ROOT_MACH_DIR)/%: $(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC $(INS.file) $(ROOT_FONT_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC $(INS.file) $(ROOT_MAC_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC $(INS.file) $(USR_DRV_DIR)/%: $(OBJS_DIR)/% $(USR_DRV_DIR) FRC $(INS.file) $(USR_EXEC_DIR)/%: $(OBJS_DIR)/% $(USR_EXEC_DIR) FRC $(INS.file) $(USR_FS_DIR)/%: $(OBJS_DIR)/% $(USR_FS_DIR) FRC $(INS.file) $(USR_SCHED_DIR)/%: $(OBJS_DIR)/% $(USR_SCHED_DIR) FRC $(INS.file) $(USR_SOCK_DIR)/%: $(OBJS_DIR)/% $(USR_SOCK_DIR) FRC $(INS.file) $(USR_STRMOD_DIR)/%: $(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC $(INS.file) $(USR_SYS_DIR)/%: $(OBJS_DIR)/% $(USR_SYS_DIR) FRC $(INS.file) $(USR_MISC_DIR)/%: $(OBJS_DIR)/% $(USR_MISC_DIR) FRC $(INS.file) $(USR_DACF_DIR)/%: $(OBJS_DIR)/% $(USR_DACF_DIR) FRC $(INS.file) $(USR_PCBE_DIR)/%: $(OBJS_DIR)/% $(USR_PCBE_DIR) FRC $(INS.file) $(USR_DTRACE_DIR)/%: $(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC $(INS.file) $(USR_BRAND_DIR)/%: $(OBJS_DIR)/% $(USR_BRAND_DIR) FRC $(INS.file) $(ROOT_KICONV_DIR)/%: $(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC $(INS.file) $(ROOT_FIRMWARE_DIR)/$(MODULE): $(INS.dir) $(ROOT_FIRMWARE_DIR)/$(MODULE)/%:= FILEMODE = $(CFILEMODE) $(ROOT_FIRMWARE_DIR)/$(MODULE)/%: $(ROOT_FIRMWARE_DIR)/$(MODULE) $(FWDIR)/% $(INS.file) include $(SRC)/Makefile.psm.targ # # Target for 64b modules # $(ROOT_KERN_DIR_64): -$(INS.dir) $(ROOT_KERN_DIR_64)/%: $(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC $(INS.file) %/$(SUBDIR64): % -$(INS.dir) # # Targets for '.conf' file installation. # $(ROOT_CONFFILE): $(SRC_CONFFILE) $(ROOT_CONFFILE:%/$(CONFFILE)=%) $(INS.conffile) # # Targets for creating links between common platforms. ROOT_PLAT_LINKS # are are the /platform level while ROOT_PLAT_LINKS_2 are one level # down (/platform/`uname -i`/{lib|sbin|kernel}. # $(ROOT_PLAT_LINKS): $(INS.slink1) $(ROOT_PLAT_LINKS_2): $(INS.slink2) $(USR_PLAT_LINKS): $(INS.slink1) $(USR_PLAT_LINKS_2): $(INS.slink2) # # multiple builds support # def $(DEF_DEPS) := TARGET = def all $(ALL_DEPS) := TARGET = all clean $(CLEAN_DEPS) := TARGET = clean clobber $(CLOBBER_DEPS) := TARGET = clobber modlist $(MODLIST_DEPS) := TARGET = modlist modlist $(MODLIST_DEPS) := NO_STATE= -K $$MODSTATE$$$$ install $(INSTALL_DEPS) := TARGET = install symcheck $(SYM_DEPS) := TARGET = symcheck ALL_TARGS = def all clean clobber install symcheck ALL_OBJ32 = $(ALL_TARGS:%=%.obj32) $(ALL_OBJ32): FRC @BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ ALL_DEBUG32 = $(ALL_TARGS:%=%.debug32) $(ALL_DEBUG32): FRC @BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ ALL_OBJ64 = $(ALL_TARGS:%=%.obj64) $(ALL_OBJ64): FRC @BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ ALL_DEBUG64 = $(ALL_TARGS:%=%.debug64) $(ALL_DEBUG64): FRC @BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ # # Currently only the IP module needs symbol checking on obj64. # Other modules have the same global-objs nm output for debug64 and obj64. # $(SISCHECK_DEPS): $(DEF_DEPS) @TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \ MODSYMS=$(MODULE).symbols.$$TARG; \ if [ -f "$(MODULE).global-objs.$$TARG" ]; then \ $(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \ $(SORT) -u > $$MODSYMS.tmp; \ $(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \ $(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \ $(GREP) -v '\.[0-9]*$$' |$(SORT) -u \ > $$MODSYMS.tmp.new; \ $(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \ ($(ECHO) "warning: $(MODULE) symbol checking:" \ "global variable(s) introduced and/or removed."; \ $(CAT) $$MODSYMS.diff; exit 1) \ fi $(SISCLEAN_DEPS): -TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \ MODSYMS=$(MODULE).symbols.$$TARG; \ $(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove $(OBJS_DIR): -@mkdir -p $@ 2> /dev/null def.targ: $(OBJS_DIR) $(ALL_TARGET) all.targ: $(OBJS_DIR) $(ALL_TARGET) install.targ: $(OBJS_DIR) $(INSTALL_TARGET) # # Support for Install.sh. # modlist: $(MODLIST_DEPS) # paths relative to $(ROOT). RELMODULE = $(ROOTMODULE:$(ROOT)/%=%) RELCONF = $(ROOT_CONFFILE:$(ROOT)/%=%) RELLINK = $(ROOTLINK:$(ROOT)/%=%) RELUNIX = $(UNIX32_LINK:$(ROOT)/%=%) RELSOFTLINKS = $(ROOTSOFTLINKS:$(ROOT)/%=%) MODSRC:sh= pwd # # Generate module information for Install.sh, i.e., specify what files # Install.sh should include. Each line looks like # ... # where specifies the type of file, gives the source # path (useful if there is an error), and is one or more # additional bits of information that Install.sh needs (e.g., source # directory, install directory, filtering tags). See Install.sh for # details on the arguments for each tag type, especially the functions # copymod, filtmod, and filtimpl. # # Changes to this target may require corresponding changes to # Install.sh. # # Don't issue a MOD entry if it's not in the install list. # $(MODLIST_DEPS): FRC @case $@ in \ *32) \ class=32; \ [ -n "$(RELMODULE)" ] && relmodule=`dirname $(RELMODULE)`;; \ *64) \ class=64; \ [ -n "$(RELMODULE)" ] && \ relmodule=`dirname $(RELMODULE)`/$(SUBDIR64);; \ esac; \ if [ -z "$(THISIMPL)" ]; then \ impl=all; \ else \ impl=$(THISIMPL); \ fi; \ if [ -n "$(ROOTMODULE)" -a -n "$(INSTALL_TARGET)" ]; then \ if [ -z "$(MODULE)" ]; then \ module=`basename $(ROOTMODULE)`; \ else \ module=$(MODULE); \ fi; \ tinstall="$(INSTALL_TARGET)"; \ for t in $$tinstall; do \ if [ "$(ROOTMODULE)" = $$t ]; then \ echo MOD $(MODSRC) $$module $$relmodule \ $$class $$impl; \ break; \ fi \ done \ fi; \ if [ -n "$(CONF_SRCDIR)" ]; then \ tinstall="$(INSTALL_TARGET)"; \ for t in $$tinstall; do \ if [ $(ROOT_CONFFILE) = $$t ]; then \ echo CONF $(MODSRC) $(RELCONF) \ $(MODSRC)/$(CONF_SRCDIR) $$impl $$module; \ break; \ fi \ done \ fi; \ if [ -n "$(ROOTLINK)" ]; then \ rellinks="$(RELLINK)"; \ for r in $$rellinks; do \ if [ $$class = 32 ]; then \ linkdir=`dirname $$r`; \ else \ linkdir=`dirname $$r`/$(SUBDIR64); \ fi; \ echo LINK $(MODSRC) $$relmodule $$module \ $$linkdir `basename $$r` $$impl; \ done \ fi; \ if [ -n "$(UNIX32_LINK)" ]; then \ echo SYMLINK $(MODSRC) $(SUBDIR64)/$(UNIX) \ `dirname $(RELUNIX)` unix $$impl $$module; \ fi; \ trelsoftlinks="$(RELSOFTLINKS)"; \ for t in $$trelsoftlinks; do \ if [ $$class = 32 ]; then \ linkdir=`dirname $$t`; \ else \ linkdir=`dirname $$t`/$(SUBDIR64); \ fi; \ linkname=`basename $$t`; \ echo SYMLINK $(MODSRC) $(MODULE) $$linkdir $$linkname \ $$impl $$module; \ done # # Cleanliness is next to ... # clean.targ: -$(RM) $(CLEANFILES) Nothing_to_remove clobber.targ: -$(RM) $(CLOBBERFILES) Nothing_to_remove FRC: