source: trunk/kBuild/footer-pass2-installs.kmk@ 2530

Last change on this file since 2530 was 2530, checked in by bird, 14 years ago

disable debug displays.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.0 KB
RevLine 
[72]1# $Id: footer-pass2-installs.kmk 2530 2011-08-02 10:57:48Z bird $
2## @file
[2521]3# kBuild - Footer - Target lists - Pass 2 - Installs.
[72]4#
[1547]5
6#
[2521]7# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
[72]8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
[106]13# the Free Software Foundation; either version source of the License, or
[72]14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
[353]23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
[72]24#
25#
[1547]26# As a special exception you are granted permission to include this file, via
[1599]27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
[1547]29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
[72]33
34
35#
[353]36# INSTALLS
37#
[72]38
[2475]39##
40# Generate the staging rules.
41#
42define def_install_src_rule_staging
43$(stagedst) : $(srcsrc) | $(dir $(stagedst))
44 %$$(call MSG_INST_FILE,$(srcsrc),$(stagedst))
45 $$(QUIET)$(stagecmd)
[353]46endef
[2475]47$(eval-opt-var def_install_src_rule_staging)
[353]48
[2475]49define def_install_src_rule_installing
50$(instdst) : $(srcsrc) | $(dir $(instdst))
51 %$$(call MSG_INST_FILE,$(srcsrc),$(instdst))
52 $$(QUIET)$(instcmd)
53endef
54$(eval-opt-var def_install_src_rule_installing)
55
56##
57# Install one file.
58#
[353]59define def_install_src
60
61# deal with '=>' in the source file name.
[2220]62ifeq ($(src),=>)
63 $(error kBuild: Install target '$(target)' has a bad source specifier containing '=>' without any file names)
64endif
65ifeq ($(substr $(src),1,2),=>)
66 $(warning kBuild: Install target '$(target)' has a bad source specifier: $(src))
67endif
68ifeq ($(substr $(src),-2),=>)
69 $(warning kBuild: Install target '$(target)' has a bad source specifier: $(src))
70endif
[2475]71local srcdst := $(subst =>, ,$(src))
72local srcsrc := $(firstword $(srcdst))
[1496]73local srcdstdir := $(dir $(word 2,$(srcdst)))
[2475]74local srcdst := $(word $(words $(srcdst)),$(srcdst))
[353]75
[2518]76# instfun, mode, uid and gid.
[353]77ifdef $(srcsrc)_INSTFUN
[1496]78 local instfun := $(srcsrc)_INSTFUN
[353]79else
[2475]80 local instfun := $(top_instfun)
[353]81endif
[1496]82local mode := $(firstword \
[2483]83 $($(target)_$(srcsrc)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
84 $($(target)_$(srcsrc)$(source_type_prefix)_MODE.$(bld_trg)) \
85 $($(target)_$(srcsrc)$(source_type_prefix)_MODE) \
86 $($(target)_$(srcdst)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
87 $($(target)_$(srcdst)$(source_type_prefix)_MODE.$(bld_trg)) \
88 $($(target)_$(srcdst)$(source_type_prefix)_MODE) \
89 $($(srcsrc)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
90 $($(srcsrc)$(source_type_prefix)_MODE.$(bld_trg)) \
91 $($(srcsrc)$(source_type_prefix)_MODE) \
92 $($(srcdst)$(source_type_prefix)_MODE.$(bld_trg).$(bld_trg_arch)) \
93 $($(srcdst)$(source_type_prefix)_MODE.$(bld_trg)) \
94 $($(srcdst)$(source_type_prefix)_MODE) \
95 $(source_type_mode))
[1496]96local uid := $(firstword \
[481]97 $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
[414]98 $($(target)_$(srcsrc)_UID.$(bld_trg)) \
99 $($(target)_$(srcsrc)_UID) \
[481]100 $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
[414]101 $($(target)_$(srcdst)_UID.$(bld_trg)) \
102 $($(target)_$(srcdst)_UID) \
[481]103 $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
[414]104 $($(srcsrc)_UID.$(bld_trg)) \
105 $($(srcsrc)_UID) \
[481]106 $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
[414]107 $($(srcdst)_UID.$(bld_trg)) \
108 $($(srcdst)_UID) \
[2475]109 $(top_uid))
[1496]110local gid := $(firstword \
[481]111 $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
[414]112 $($(target)_$(srcsrc)_GID.$(bld_trg)) \
113 $($(target)_$(srcsrc)_GID) \
[481]114 $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
[414]115 $($(target)_$(srcdst)_GID.$(bld_trg)) \
116 $($(target)_$(srcdst)_GID) \
[481]117 $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
[414]118 $($(srcsrc)_GID.$(bld_trg)) \
119 $($(srcsrc)_GID) \
[481]120 $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
[414]121 $($(srcdst)_GID.$(bld_trg)) \
122 $($(srcdst)_GID) \
[2475]123 $(top_gid))
[1496]124local flags := \
[2475]125 $(top_ifflags) \
[2483]126 $($(srcdst)$(source_type_prefix)_IFFLAGS) \
127 $($(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
128 $($(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
129 $($(srcsrc)$(source_type_prefix)_IFFLAGS) \
130 $($(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
131 $($(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
132 $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS) \
133 $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
134 $($(target)_$(srcdst)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
135 $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS) \
136 $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg)) \
137 $($(target)_$(srcsrc)$(source_type_prefix)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
[1614]138clean_files += \
139 $($(srcdst)_CLEAN) \
140 $($(srcdst)_CLEAN.$(bld_trg)) \
141 $($(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
142 $($(srcsrc)_CLEAN) \
143 $($(srcsrc)_CLEAN.$(bld_trg)) \
144 $($(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
145 $($(target)_$(srcdst)_CLEAN) \
146 $($(target)_$(srcdst)_CLEAN.$(bld_trg)) \
147 $($(target)_$(srcdst)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
148 $($(target)_$(srcsrc)_CLEAN) \
149 $($(target)_$(srcsrc)_CLEAN.$(bld_trg)) \
150 $($(target)_$(srcsrc)_CLEAN.$(bld_trg).$(bld_trg_arch))
[414]151
[725]152
153# Adjust the source if we got a default PATH. (This must be done this late!)
[2477]154ifdef $(target)_DEFPATH
155local defpath := $($(target)_DEFPATH)
156else ifdef $(target)_PATH
157local defpath := $($(target)_PATH)
158else
159local defpath :=
160endif
[1755]161ifneq ($(defpath),)
162 local srcsrc := $(abspathex $(srcsrc),$(defpath))
[725]163endif
164
[2479]165# Generate the staging rule (requires double evaluation).
[2517]166local stage := $(strip $(firstdefined $(srcsrc)_STAGE $(srcsrc)_INST $(target)_1_STAGE,value))
167if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
168 $(warning kBuild: File $(srcsrc) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
169 local stage := $(stage)/
170endif
171local stage := $(stage)$(dir $(srcdstdir))
172ifeq ($(root $(stage)),)
173 local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_STAGE))
174else
[2518]175 local stage := $(abspath $(stage))/
[2517]176 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
[2518]177 local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
[2517]178 local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_OBJ))
179 else
180 $(error kBuild: File $(srcsrc) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
181 endif
182endif
[353]183ifdef $(srcsrc)_INSTALLER
[2479]184 local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
[830]185else ifdef $(target)_INSTALLER
[2479]186 local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
[353]187else
[2479]188 local stagecmd := $$(INSTALL_STAGING)\
[414]189 $(if $(uid),-o $(uid))\
190 $(if $(gid),-g $(gid))\
191 $(if $(mode),-m $(mode))\
[1599]192 $(flags) -- \
[2475]193 $(srcsrc) $(stagedst)
[353]194endif
[2475]195$(eval $(def_install_src_rule_staging))
196$(target)_2_STAGE_TARGETS += $(stagedst)
[353]197
[2475]198# Generate the install rule
199ifeq ($(insttype),both)
[2517]200 local inst := $(strip $(firstdefined $(srcsrc)_INST $(target)_1_INST,value))
201 if "$(substr $(inst),-1)" != "/" && "$(inst)" != ""
202 $(warning kBuild: File $(srcsrc) in install target $(target) has a INST property without a trailing slash: '$(inst)')
203 local inst := $(inst)/
204 endif
205 local inst := $(inst)$(dir $(srcdstdir))
206 ifneq ($(root $(inst)),)
207 $(error kBuild: File $(srcsrc) in install target $(target) has a INST property with an absolute path: '$(inst)')
208 endif
209 local instdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
210
[2479]211 ifdef $(srcsrc)_INSTALLER
[2517]212 local instcmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
[2479]213 else ifdef $(target)_INSTALLER
[2517]214 local instcmd := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
[2479]215 else
216 local instcmd := $$(INSTALL)\
217 $(if $(uid),-o $(uid))\
218 $(if $(gid),-g $(gid))\
219 $(if $(mode),-m $(mode))\
220 $(flags) -- \
221 $(srcsrc) $(instdst)
222 endif
[2475]223 $(eval $(def_install_src_rule_installing))
224 $(target)_2_INST_TARGETS += $(instdst)
225endif
226
[2517]227#$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => instdst=$(instdst); stage=$(stage) => stagedst=$(stagedst))
[1936]228endef # def_install_src
229$(eval-opt-var def_install_src)
[353]230
231
[2475]232##
233# Generate the symlink rules.
234#
235define def_install_symlink_rule_staging
236$(stagedst) : | $(dir $(stagedst))
237 %$$(call MSG_INST_SYM,$(stagedst),$(symdst))
[1599]238 $$(QUIET)$$(RM) -f -- $$@
[2475]239 $$(QUIET)$$(LN_SYMLINK) $(symdst) $(stagedst)
240endef
241$(eval-opt-var def_install_symlink_rule_staging)
[353]242
[2475]243define def_install_symlink_rule_installing
244$(instdst) : | $(dir $(instdst))
245 %$$(call MSG_INST_SYM,$(instdst),$(symdst))
246 $$(QUIET)$$(RM) -f -- $$@
247 $$(QUIET)$$(LN_SYMLINK) $(symdst) $(instdst)
248endef
249$(eval-opt-var def_install_symlink_rule_installing)
250
251
252##
253# Create one symlink.
254#
[353]255define def_install_symlink
256
257# deal with '=>' in the source file name.
[1496]258local symdst := $(subst =>, ,$(src))
259local symlnk := $(firstword $(symdst))
260local symdst := $(word $(words $(symdst)),$(symdst))
[2529]261local symlnkdir := $(dir $(symlnk))
262ifeq ($(symlnkdir),./)
263 local symlnkdir :=
264endif
[353]265
[2517]266# Figure which install function to use below.
[380]267ifdef $(symlnk)_INSTFUN
[1496]268 local instfun := $(symlnk)_INSTFUN
[353]269else
[2475]270 local instfun := $(top_instfun)
[353]271endif
272
[2517]273# Calc stage destination and generate the rule (requires double evaluation).
274local stage := $(strip $(firstdefined $(symlnk)_STAGE $(symlnk)_INST $(target)_1_STAGE,value))
275if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
276 $(warning kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
277 local stage := $(stage)/
[353]278endif
[2529]279local stage := $(stage)$(symlnkdir)
[2517]280ifeq ($(root $(stage)),)
281 local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_STAGE))
282else
[2518]283 local stage := $(abspath $(stage))/
[2517]284 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
[2518]285 local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
[2517]286 local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_OBJ))
287 else
288 $(error kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
289 endif
[2475]290endif
[353]291
[2475]292$(eval $(def_install_symlink_rule_staging))
293$(target)_2_STAGE_TARGETS += $(stagedst)
[353]294
[2517]295# Calcuate the install destiation and generate the rule (if necessary).
[2475]296ifeq ($(instmode),both)
[2517]297 local inst := $(strip $(firstdefined $(symlnk)_INST $(target)_1_INST,value))
298 if "$(substr $(inst),-1)" != "/" && "$(inst)" != ""
299 $(warning kBuild: Symlink $(symlnk) in install target $(target) has a INST property without a trailing slash: '$(inst)')
300 local inst := $(inst)/
301 endif
302 ifneq ($(root $(inst)),)
303 $(error kBuild: Symlink $(symlnk) in install target $(target) has a INST property with an absolute path: '$(inst)')
304 endif
[2529]305 local inst := $(inst)$(symlnkdir)
[2517]306 local instdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
[2475]307 $(eval $(def_install_symlink_rule_installing))
308 $(target)_2_INST_TARGETS += $(instdst)
309endif
310
[2530]311#$(warning symlnk=$(symlnk) symdst=$(symdst) instdst=$(instdst) stagedst=$(stagedst) instfun=$(instfun) inst=$(inst) stage='$(stage)')
[1936]312endef # def_install_symlink
313$(optmize def_install_symlink)
[353]314
[412]315
[2475]316##
317# Generate an directory installtion rule.
318# Note. Used both for staging and real install rules.
319#
[380]320define def_install_directory_rule
321# the install rule
322$(insdst):
[1496]323 %$$(call MSG_INST_DIR,$(insdst))
[696]324 $$(QUIET)$$(INSTALL) -d \
[380]325 $(if $(uid),-o $(uid))\
326 $(if $(gid),-g $(gid))\
327 $(if $(mode),-m $(mode))\
[1599]328 $(flags) -- \
[380]329 $(insdst)
[412]330
331.NOTPARALLEL: $(insdst)
[1936]332endef # def_install_directory_rule
333$(eval-opt-var def_install_directory_rule)
[380]334
[2475]335##
336# Create one directory.
337#
[380]338define def_install_directory
339
[2475]340# gather common properties.
[1496]341local mode := $(firstword \
[481]342 $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
[380]343 $($(target)_$(directory)_MODE.$(bld_trg)) \
344 $($(target)_$(directory)_MODE) \
[481]345 $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
[380]346 $($(directory)_MODE.$(bld_trg)) \
347 $($(directory)_MODE) \
[2475]348 $(top_mode) )
[1496]349local uid := $(firstword \
[481]350 $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
[380]351 $($(target)_$(directory)_UID.$(bld_trg)) \
352 $($(target)_$(directory)_UID) \
[481]353 $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
[380]354 $($(directory)_UID.$(bld_trg)) \
355 $($(directory)_UID) \
[2475]356 $(top_uid) )
[1496]357local gid := $(firstword \
[481]358 $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
[380]359 $($(target)_$(directory)_GID.$(bld_trg)) \
360 $($(target)_$(directory)_GID) \
[481]361 $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
[380]362 $($(directory)_GID.$(bld_trg)) \
363 $($(directory)_GID) \
[2475]364 $(top_gid) )
[1496]365local flags := \
[2475]366 $(top_idflags) \
[830]367 $($(directory)_IDFLAGS) \
368 $($(directory)_IDFLAGS.$(bld_trg)) \
369 $($(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
370 $($(target)_$(directory)_IDFLAGS) \
371 $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
[2475]372 $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
[380]373
[2475]374# The staging rule (requires double evaluation).
[2517]375local stage := $(strip $(firstdefined $(directory)_STAGE $(directory)_INST $(target)_1_STAGE,value))
376if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
377 $(warning kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
378 local stage := $(stage)/
379endif
380ifeq ($(root $(stage)),)
381 local insdst := $(PATH_STAGE)/$(stage)$(directory)/
382else
[2518]383 local stage := $(abspath $(stage))/
[2517]384 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
385 local insdst := $(stage)$(directory)/
386 else
387 $(error kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
388 endif
389endif
390
[2475]391$(target)_2_STAGE_DIR_TARGETS += $(insdst)
[380]392$(eval $(def_install_directory_rule))
393
[2475]394# The install rule.
395ifeq ($(insttype),both)
[2517]396 local inst := $(strip $(firstdefined $(directory)_INST $(target)_1_INST,value))
397 ifneq ($(substr $(inst),-1),/)
398 $(warning kBuild: Directory $(directory) in install target $(target) has a INST property without a trailing slash: '$(inst)')
399 local inst := $(inst)/
400 endif
[2519]401 ifneq ($(root $(stage)),)
402 $(error kBuild: Directory $(directory) in install target $(target) has a INST property with an absolute path: '$(inst)')
[2517]403 endif
[2514]404 local insdst := $(PATH_INS)/$(inst)$(directory)/
[2475]405 $(target)_2_INST_DIR_TARGETS += $(insdst)
406 $(eval $(def_install_directory_rule))
407endif
408
[2517]409#$(warning directory=$(directory) inst=$(inst) stage=$(stage) mode=$(mode) gid=$(gid) uid=$(uid))
[1936]410endef # def_install_directory
411$(eval-opt-var def_install_directory)
[380]412
413
[2475]414##
415# Process one install target.
416#
[353]417define def_install
[744]418# the basics.
[2475]419local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
420local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
421local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
422local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
423local insttype := $($(target)_1_INSTTYPE)
[353]424
[2475]425ifneq ($(insttype),none)
426 $(target)_2_STAGE_TARGETS := $($(target)_GOALS) $($(target)_STAGE_ONLY_GOALS)
427else
428 $(target)_2_STAGE_TARGETS :=
429endif
430$(target)_2_STAGE_DIR_TARGETS :=
431
432ifeq ($(insttype),both)
433 $(target)_2_INST_TARGETS := $($(target)_GOALS) $($(target)_INST_ONLY_GOALS)
434else
435 $(target)_2_INST_TARGETS :=
436endif
437$(target)_2_INST_DIR_TARGETS :=
438
439
440local outbase := $(call TARGET_BASE,$(target),$(target))
[2239]441$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
[2436]442$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
[380]443
[2475]444ifneq ($(insttype),none)
445 # cache top level target properties.
446 local top_mode := $(firstword \
447 $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
448 $($(target)_MODE.$(bld_trg)) \
449 $($(target)_MODE) )
[2483]450 local top_exec_mode := $(firstword \
451 $($(target)_EXEC_MODE.$(bld_trg).$(bld_trg_arch)) \
452 $($(target)_EXEC_MODE.$(bld_trg)) \
453 $($(target)_EXEC_MODE) )
[2475]454 local top_uid := $(firstword \
455 $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
456 $($(target)_UID.$(bld_trg)) \
457 $($(target)_UID) )
458 local top_gid := $(firstword \
459 $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
460 $($(target)_GID.$(bld_trg)) \
461 $($(target)_GID) )
462 local top_ifflags := \
463 $($(target)_IFFLAGS) \
464 $($(target)_IFFLAGS.$(bld_trg)) \
[2477]465 $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
[2475]466 local top_idflags := \
467 $($(target)_IDFLAGS) \
468 $($(target)_IDFLAGS.$(bld_trg)) \
469 $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
470 ifdef $(target)_INSTFUN
471 local top_instfun := $(target)_INSTFUN
472 else
473 local top_instfun := _INSTALL_FILE
474 endif
[1614]475
[2475]476 $(foreach directory, \
477 $($(target)_DIRS) \
478 $($(target)_DIRS.$(bld_trg)) \
479 $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) \
480 $($(target)_DIRS.$(bld_trg_arch)) \
481 $($(target)_DIRS.$(bld_trg_cpu)) \
482 $($(target)_DIRS.$(bld_type)), \
483 $(evalval def_install_directory))
[380]484
[2475]485 local clean_files := \
486 $($(target)_CLEAN) \
487 $($(target)_CLEAN.$(bld_trg)) \
488 $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
489 $($(target)_CLEAN.$(bld_trg_arch)) \
490 $($(target)_CLEAN.$(bld_trg_cpu)) \
491 $($(target)_CLEAN.$(bld_type))
[353]492
[2483]493 local source_type_prefix :=
494 local source_type_mode := $(firstword $(top_mode) a+r,u+w)
[2475]495 $(foreach src,\
496 $($(target)_SOURCES) \
497 $($(target)_SOURCES.$(bld_trg)) \
498 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
499 $($(target)_SOURCES.$(bld_trg_arch)) \
500 $($(target)_SOURCES.$(bld_trg_cpu)) \
501 $($(target)_SOURCES.$(bld_type)), \
502 $(evalval def_install_src))
[353]503
[2483]504 local source_type_prefix := EXEC_
505 local source_type_mode := $(firstword $(top_exec_mode) a+xr,u+w)
[2475]506 $(foreach src,\
[2483]507 $($(target)_EXEC_SOURCES) \
508 $($(target)_EXEC_SOURCES.$(bld_trg)) \
509 $($(target)_EXEC_SOURCES.$(bld_trg).$(bld_trg_arch)) \
510 $($(target)_EXEC_SOURCES.$(bld_trg_arch)) \
511 $($(target)_EXEC_SOURCES.$(bld_trg_cpu)) \
512 $($(target)_EXEC_SOURCES.$(bld_type)), \
513 $(evalval def_install_src))
514
515 $(foreach src,\
[2475]516 $($(target)_SYMLINKS) \
517 $($(target)_SYMLINKS.$(bld_trg)) \
518 $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) \
519 $($(target)_SYMLINKS.$(bld_trg_arch)) \
520 $($(target)_SYMLINKS.$(bld_trg_cpu)) \
521 $($(target)_SYMLINKS.$(bld_type)), \
522 $(evalval def_install_symlink))
523else # none
524 local clean_files :=
525endif
526
527# The collection targets (staging only).
528local clean_files += $($(target)_1_TARGET)
529$($(target)_1_TARGET): $$($(target)_2_STAGE_TARGETS) | $$($(target)_2_STAGE_DIR_TARGETS) $$(dir $$@)
[827]530 @$(QUIET2)$(APPEND) $@
531
[2238]532$(target): $$($(target)_1_TARGET)
[827]533
[2475]534# Update Global lists.
535_INSTALLS += $($(target)_1_TARGET)
536_STAGE_FILES += $($(target)_2_STAGE_TARGETS)
537_STAGE_DIRS += $($(target)_2_STAGE_DIR_TARGETS)
538_INSTALLS_FILES += $($(target)_2_INST_TARGETS)
539_INSTALLS_DIRS += $($(target)_2_INST_DIR_TARGETS)
540_CLEAN_FILES += $(clean_files)
541_DIRS += \
542 $($(target)_0_OUTDIR) \
543 $($(target)_BLDDIRS) \
544 $($(target)_BLDDIRS.$(bld_trg)) \
545 $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) \
546 $($(target)_BLDDIRS.$(bld_trg_arch)) \
547 $($(target)_BLDDIRS.$(bld_trg_cpu)) \
548 $($(target)_BLDDIRS.$(bld_type))
549
550# Deprecated properties.
551INSTARGET_$(target) := $($(target)_2_STAGE_TARGETS)
552INSTARGET_DIRS_$(target) := $($(target)_2_STAGE_DIR_TARGETS)
553
[1936]554endef # def_install
555$(eval-opt-var def_install)
[353]556
[2479]557## Do pass 1 on the implicit targets and add them to the list.
558$(foreach target, $(_ALL_INSTALLS_IMPLICIT), \
559 $(evalval def_pass1_install))
560_ALL_INSTALLS += $(_ALL_INSTALLS_IMPLICIT)
561
562## Do pass 2 on all install targets.
[1648]563$(foreach target, $(_ALL_INSTALLS), \
[1614]564 $(evalvalctx def_install))
[353]565
[988]566ifdef KBUILD_PROFILE_SELF
[2008]567 $(evalcall def_profile_self, done install targets)
[988]568endif
[353]569
[2475]570#
[2227]571# Some introspection targets that can be useful for package maintainers.
[2475]572#
[2227]573.PHONY: kbuild-show-install-files kbuild-show-install-dirs
574kbuild-show-install-files::
575 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_FILES)))
576
577kbuild-show-install-dirs::
578 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_DIRS)))
579
[2475]580kbuild-show-stage-files::
581 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_FILES)))
[2227]582
[2475]583kbuild-show-stage-dirs::
584 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_DIRS)))
585
586
Note: See TracBrowser for help on using the repository browser.