# # 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. # Copyright 2021 Oxide Computer Company # # 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. # # # 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) # # 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 # # 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 $(VERSION) (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) $(VERSION) | 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) $(ROOT_OVERLAY_DIR)/%: $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_OVERLAY_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_KTEST_DIR)/%: $(OBJS_DIR)/% $(USR_KTEST_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 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) # # Cleanliness is next to ... # clean.targ: -$(RM) $(CLEANFILES) Nothing_to_remove clobber.targ: -$(RM) $(CLOBBERFILES) Nothing_to_remove FRC: