Unleashed v1.4
[unleashed.git] / usr / src / uts / Makefile.targ
blob03995a4048fa442b937b153f511b0ae54b37795e
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
23 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 # Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
26 #       This Makefiles contains the common targets and definitions for
27 #       all kernels. It is to be included in the Makefiles for specific
28 #       implementation architectures and processor architecture dependent
29 #       modules: i.e.: all driving kernel Makefiles.
33 #       Partially link .o files to generate the kmod. The fake dependency
34 #       on modstubs simplifies things...
36 $(BINARY):              $(OBJECTS)
37         $(LD) -r $(LDFLAGS) -o $@ $(OBJECTS)
38         $(CTFMERGE_MODULE)
39         $(POST_PROCESS)
42 #       This target checks each kmod for undefined entry points. It does not
43 #       modify the kmod in any way.
45 $(MODULE).check:        FRC
46         @BUILD_TYPE=DBG32 $(MAKE) $(MODULE).check.targ
48 $(MODULE).check.targ:   $(BINARY) $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
49         $(LD) -o /dev/null $(OBJECTS) $(EXTRA_CHECK_OBJS) $(UNIX_O) $(MODSTUBS_O) $(GENLIB)
52 # Since assym.h is a derived file, the dependency must be explicit for
53 # all files including this file. (This is only actually required in the
54 # instance when the .nse_depinfo file does not exist.) The actual lists are
55 # defined in */Makefile.files.
57 $(ASSYM_DEPS:%=$(OBJS_DIR)/%):  $(DSF_DIR)/$(OBJS_DIR)/assym.h
60 #       Everybody need to know how to create a modstubs.o built with the
61 #       appropriate flags and located in the appropriate location.
63 $(MODSTUBS_O):  $(MODSTUBS)
64         $(COMPILE64.s) -o $@ $(MODSTUBS)
67 # Build the source file which contains the kernel's utsname,
68 # with release, version and machine set as follows:
70 #       version: contents of $(VERSION)
72 # Build environment information is only contained in the comment section.
75 $(OBJS_DIR)/vers.o: $(OBJECTS)
76         $(COMPILE.c) \
77             -DUTS_VERSION=\"$(VERSION)\" -o $@ $(SRCTOP)/kernel/os/vers.c
78         $(CTFCONVERT_O)
79         $(POST_PROCESS_O)
82 #       Installation targets and rules:
84 $(ROOT_MOD_DIR) $(USR_MOD_DIR):
85         -$(INS.dir)
87 $(ROOT_MOD_DIRS):       $(ROOT_MOD_DIR)
88         -$(INS.dir)
90 $(USR_MOD_DIRS):        $(USR_MOD_DIR)
91         -$(INS.dir)
93 $(ROOT_MOD_DIR)/%:      $(OBJS_DIR)/% $(ROOT_MOD_DIR) FRC
94         $(INS.file)
96 $(ROOT_CPU_DIR)/%:      $(OBJS_DIR)/% $(ROOT_CPU_DIR) FRC
97         $(INS.file)
99 $(ROOT_DRV_DIR)/%:      $(OBJS_DIR)/% $(ROOT_DRV_DIR) FRC
100         $(INS.file)
102 $(ROOT_DTRACE_DIR)/%:   $(OBJS_DIR)/% $(ROOT_DTRACE_DIR) FRC
103         $(INS.file)
105 $(ROOT_EXEC_DIR)/%:     $(OBJS_DIR)/% $(ROOT_EXEC_DIR) FRC
106         $(INS.file)
108 $(ROOT_FS_DIR)/%:       $(OBJS_DIR)/% $(ROOT_FS_DIR) FRC
109         $(INS.file)
111 $(ROOT_SCHED_DIR)/%:    $(OBJS_DIR)/% $(ROOT_SCHED_DIR) FRC
112         $(INS.file)
114 $(ROOT_SOCK_DIR)/%:     $(OBJS_DIR)/% $(ROOT_SOCK_DIR) FRC
115         $(INS.file)
117 $(ROOT_STRMOD_DIR)/%:   $(OBJS_DIR)/% $(ROOT_STRMOD_DIR) FRC
118         $(INS.file)
120 $(ROOT_IPP_DIR)/%:      $(OBJS_DIR)/% $(ROOT_IPP_DIR) FRC
121         $(INS.file)
123 $(ROOT_SYS_DIR)/%:      $(OBJS_DIR)/% $(ROOT_SYS_DIR) FRC
124         $(INS.file)
126 $(ROOT_MISC_DIR)/%:     $(OBJS_DIR)/% $(ROOT_MISC_DIR) FRC
127         $(INS.file)
129 $(ROOT_DACF_DIR)/%:     $(OBJS_DIR)/% $(ROOT_DACF_DIR) FRC
130         $(INS.file)
132 $(ROOT_BRAND_DIR)/%:    $(OBJS_DIR)/% $(ROOT_BRAND_DIR) FRC
133         $(INS.file)
135 $(ROOT_CRYPTO_DIR)/%:   $(OBJS_DIR)/% $(ROOT_CRYPTO_DIR) FRC
136         $(INS.file)
138 $(ROOT_KGSS_DIR)/%:     $(OBJS_DIR)/% $(ROOT_KGSS_DIR) FRC
139         $(INS.file)
141 $(ROOT_SCSI_VHCI_DIR)/%: $(OBJS_DIR)/% $(ROOT_SCSI_VHCI_DIR) FRC
142         $(INS.file)
144 $(ROOT_PMCS_FW_DIR)/%:  $(OBJS_DIR)/% $(ROOT_PMCS_FW_DIR) FRC
145         $(INS.file)
147 $(ROOT_QLC_FW_DIR)/%:   $(OBJS_DIR)/% $(ROOT_QLC_FW_DIR) FRC
148         $(INS.file)
150 $(ROOT_EMLXS_FW_DIR)/%: $(OBJS_DIR)/% $(ROOT_EMLXS_FW_DIR) FRC
151         $(INS.file)
153 $(ROOT_MACH_DIR)/%:     $(OBJS_DIR)/% $(ROOT_MACH_DIR) FRC
154         $(INS.file)
156 $(ROOT_FONT_DIR)/%:     $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_FONT_DIR) FRC
157         $(INS.file)
159 $(ROOT_MAC_DIR)/%:      $(OBJS_DIR)/% $(ROOT_MOD_DIR) $(ROOT_MAC_DIR) FRC
160         $(INS.file)
162 $(USR_DRV_DIR)/%:       $(OBJS_DIR)/% $(USR_DRV_DIR) FRC
163         $(INS.file)
165 $(USR_EXEC_DIR)/%:      $(OBJS_DIR)/% $(USR_EXEC_DIR) FRC
166         $(INS.file)
168 $(USR_FS_DIR)/%:        $(OBJS_DIR)/% $(USR_FS_DIR) FRC
169         $(INS.file)
171 $(USR_SCHED_DIR)/%:     $(OBJS_DIR)/% $(USR_SCHED_DIR) FRC
172         $(INS.file)
174 $(USR_SOCK_DIR)/%:      $(OBJS_DIR)/% $(USR_SOCK_DIR) FRC
175         $(INS.file)
177 $(USR_STRMOD_DIR)/%:    $(OBJS_DIR)/% $(USR_STRMOD_DIR) FRC
178         $(INS.file)
180 $(USR_SYS_DIR)/%:       $(OBJS_DIR)/% $(USR_SYS_DIR) FRC
181         $(INS.file)
183 $(USR_MISC_DIR)/%:      $(OBJS_DIR)/% $(USR_MISC_DIR) FRC
184         $(INS.file)
186 $(USR_DACF_DIR)/%:      $(OBJS_DIR)/% $(USR_DACF_DIR) FRC
187         $(INS.file)
189 $(USR_PCBE_DIR)/%:      $(OBJS_DIR)/% $(USR_PCBE_DIR) FRC
190         $(INS.file)
192 $(USR_DTRACE_DIR)/%:    $(OBJS_DIR)/% $(USR_DTRACE_DIR) FRC
193         $(INS.file)
195 $(USR_BRAND_DIR)/%:     $(OBJS_DIR)/% $(USR_BRAND_DIR) FRC
196         $(INS.file)
198 $(ROOT_KICONV_DIR)/%:   $(OBJS_DIR)/% $(ROOT_KICONV_DIR) FRC
199         $(INS.file)
201 $(ROOT_FIRMWARE_DIR)/$(MODULE):
202         $(INS.dir)
204 $(ROOT_FIRMWARE_DIR)/$(MODULE)/%:= FILEMODE = $(CFILEMODE)
206 $(ROOT_FIRMWARE_DIR)/$(MODULE)/%: $(ROOT_FIRMWARE_DIR)/$(MODULE) $(FWDIR)/%
207         $(INS.file)
209 include $(SRC)/Makefile.psm.targ
212 #       Target for 64b modules
214 $(ROOT_KERN_DIR_64):
215         -$(INS.dir)
217 $(ROOT_KERN_DIR_64)/%:  $(OBJS_DIR)/% $(ROOT_KERN_DIR_64) FRC
218         $(INS.file)
220 %/$(SUBDIR64):          %
221         -$(INS.dir)
224 #       Targets for '.conf' file installation.
226 $(ROOT_CONFFILE):       $(SRC_CONFFILE) $(ROOT_CONFFILE:%/$(CONFFILE)=%)
227         $(INS.conffile)
230 # multiple builds support
232 def $(DEF_DEPS)                 := TARGET = def
233 all $(ALL_DEPS)                 := TARGET = all
234 clean $(CLEAN_DEPS)             := TARGET = clean
235 clobber $(CLOBBER_DEPS)         := TARGET = clobber
236 modlist $(MODLIST_DEPS)         := TARGET = modlist
237 modlist $(MODLIST_DEPS)         := NO_STATE= -K $$MODSTATE$$$$
238 install $(INSTALL_DEPS)         := TARGET = install
239 symcheck $(SYM_DEPS)            := TARGET = symcheck
241 ALL_TARGS       = def all clean clobber install symcheck
243 ALL_OBJ32       = $(ALL_TARGS:%=%.obj32)
245 $(ALL_OBJ32):   FRC
246         @BUILD_TYPE=OBJ32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
248 ALL_DEBUG32     = $(ALL_TARGS:%=%.debug32)
250 $(ALL_DEBUG32): FRC
251         @BUILD_TYPE=DBG32 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
253 ALL_OBJ64       = $(ALL_TARGS:%=%.obj64)
255 $(ALL_OBJ64):   FRC
256         @BUILD_TYPE=OBJ64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
258 ALL_DEBUG64     = $(ALL_TARGS:%=%.debug64)
260 $(ALL_DEBUG64): FRC
261         @BUILD_TYPE=DBG64 VERSION='$(VERSION)' $(MAKE) $(NO_STATE) $(TARGET).targ
264 #       Currently only the IP module needs symbol checking on obj64.
265 #       Other modules have the same global-objs nm output for debug64 and obj64.
267 $(SISCHECK_DEPS):       $(DEF_DEPS)
268         @TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
269         MODSYMS=$(MODULE).symbols.$$TARG; \
270         if [ -f "$(MODULE).global-objs.$$TARG" ]; then \
271                 $(GREP) -v '#' $(MODULE).global-objs.$$TARG |$(GREP) . | \
272                     $(SORT) -u > $$MODSYMS.tmp; \
273                 $(NM) $$TARG/$(MODULE) |$(GREP) OBJT |$(GREP) -v UNDEF | \
274                     $(CUT) -d'|' -f8 |$(GREP) -v '^___const_' | \
275                     $(GREP) -v '\.[0-9]*$$' |$(SORT) -u \
276                     > $$MODSYMS.tmp.new; \
277                 $(DIFF) $$MODSYMS.tmp $$MODSYMS.tmp.new > $$MODSYMS.diff || \
278                     ($(ECHO) "warning: $(MODULE) symbol checking:" \
279                     "global variable(s) introduced and/or removed."; \
280                     $(CAT) $$MODSYMS.diff; exit 1) \
281         fi
283 $(SISCLEAN_DEPS):
284         -TARG=`$(ECHO) $@ | $(CUT) -d'.' -f2`; \
285         MODSYMS=$(MODULE).symbols.$$TARG; \
286         $(RM) $$MODSYMS.tmp $$MODSYMS.tmp.new $$MODSYMS.diff Nothing_to_remove
289 $(OBJS_DIR):
290         -@mkdir -p $@ 2> /dev/null
292 def.targ:               $(OBJS_DIR) $(ALL_TARGET)
294 all.targ:               $(OBJS_DIR) $(ALL_TARGET)
296 install.targ:           $(OBJS_DIR) $(INSTALL_TARGET)
299 # Support for Install.sh.
302 modlist:        $(MODLIST_DEPS)
304 # paths relative to $(ROOT).
305 RELMODULE = $(ROOTMODULE:$(ROOT)/%=%)
306 RELCONF = $(ROOT_CONFFILE:$(ROOT)/%=%)
307 RELLINK = $(ROOTLINK:$(ROOT)/%=%)
308 RELUNIX = $(UNIX32_LINK:$(ROOT)/%=%)
309 RELSOFTLINKS = $(ROOTSOFTLINKS:$(ROOT)/%=%)
311 MODSRC:sh=              pwd
314 # Generate module information for Install.sh, i.e., specify what files
315 # Install.sh should include.  Each line looks like
316 #   <tag> <srcdir> <arg1> <arg2> ...
317 # where <tag> specifies the type of file, <srcdir> gives the source
318 # path (useful if there is an error), and <argN> is one or more
319 # additional bits of information that Install.sh needs (e.g., source
320 # directory, install directory, filtering tags).  See Install.sh for
321 # details on the arguments for each tag type, especially the functions
322 # copymod, filtmod, and filtimpl.
324 # Changes to this target may require corresponding changes to
325 # Install.sh.
327 # Don't issue a MOD entry if it's not in the install list.
330 $(MODLIST_DEPS): FRC
331         @case $@ in \
332         *32) \
333                 class=32; \
334                 [ -n "$(RELMODULE)" ] && relmodule=`dirname $(RELMODULE)`;; \
335         *64) \
336                 class=64; \
337                 [ -n "$(RELMODULE)" ] && \
338                     relmodule=`dirname $(RELMODULE)`/$(SUBDIR64);; \
339         esac; \
340         if [ -z "$(THISIMPL)" ]; then \
341                 impl=all; \
342         else \
343                 impl=$(THISIMPL); \
344         fi; \
345         if [ -n "$(ROOTMODULE)" -a -n "$(INSTALL_TARGET)" ]; then \
346                 if [ -z "$(MODULE)" ]; then \
347                         module=`basename $(ROOTMODULE)`; \
348                 else \
349                         module=$(MODULE); \
350                 fi; \
351                 tinstall="$(INSTALL_TARGET)"; \
352                 for t in $$tinstall; do \
353                         if [ "$(ROOTMODULE)" = $$t ]; then \
354                                 echo MOD $(MODSRC) $$module $$relmodule \
355                                     $$class $$impl; \
356                                 break; \
357                         fi \
358                 done \
359         fi; \
360         if [ -n "$(CONF_SRCDIR)" ]; then \
361                 tinstall="$(INSTALL_TARGET)"; \
362                 for t in $$tinstall; do \
363                         if [ $(ROOT_CONFFILE) = $$t ]; then \
364                                 echo CONF $(MODSRC) $(RELCONF) \
365                                     $(MODSRC)/$(CONF_SRCDIR) $$impl $$module; \
366                                 break; \
367                         fi \
368                 done \
369         fi; \
370         if [ -n "$(ROOTLINK)" ]; then \
371                 rellinks="$(RELLINK)"; \
372                 for r in $$rellinks; do \
373                         if [ $$class = 32 ]; then \
374                                 linkdir=`dirname $$r`; \
375                         else \
376                                 linkdir=`dirname $$r`/$(SUBDIR64); \
377                         fi; \
378                         echo LINK $(MODSRC) $$relmodule $$module \
379                                 $$linkdir `basename $$r` $$impl; \
380                 done \
381         fi; \
382         if [ -n "$(UNIX32_LINK)" ]; then \
383                 echo SYMLINK $(MODSRC) $(SUBDIR64)/$(UNIX) \
384                     `dirname $(RELUNIX)` unix $$impl $$module; \
385         fi; \
386         trelsoftlinks="$(RELSOFTLINKS)"; \
387         for t in $$trelsoftlinks; do \
388                 if [ $$class = 32 ]; then \
389                         linkdir=`dirname $$t`; \
390                 else \
391                         linkdir=`dirname $$t`/$(SUBDIR64); \
392                 fi; \
393                 linkname=`basename $$t`; \
394                 echo SYMLINK $(MODSRC) $(MODULE) $$linkdir $$linkname \
395                     $$impl $$module; \
396         done
399 #       Cleanliness is next to ...
401 clean.targ:
402         -$(RM) $(CLEANFILES) Nothing_to_remove
404 clobber.targ:
405         -$(RM) $(CLOBBERFILES) Nothing_to_remove
407 FRC: