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

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

footer-pass2-installs.kmk: Fixed symlink regression.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
Line 
1# $Id: footer-pass2-installs.kmk 2526 2011-08-01 14:35:35Z bird $
2## @file
3# kBuild - Footer - Target lists - Pass 2 - Installs.
4#
5
6#
7# Copyright (c) 2004-2011 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
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
13# the Free Software Foundation; either version source of the License, or
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
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26# As a special exception you are granted permission to include this file, via
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.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34
35#
36# INSTALLS
37#
38
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)
46endef
47$(eval-opt-var def_install_src_rule_staging)
48
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#
59define def_install_src
60
61# deal with '=>' in the source file name.
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
71local srcdst := $(subst =>, ,$(src))
72local srcsrc := $(firstword $(srcdst))
73local srcdstdir := $(dir $(word 2,$(srcdst)))
74local srcdst := $(word $(words $(srcdst)),$(srcdst))
75
76# instfun, mode, uid and gid.
77ifdef $(srcsrc)_INSTFUN
78 local instfun := $(srcsrc)_INSTFUN
79else
80 local instfun := $(top_instfun)
81endif
82local mode := $(firstword \
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))
96local uid := $(firstword \
97 $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
98 $($(target)_$(srcsrc)_UID.$(bld_trg)) \
99 $($(target)_$(srcsrc)_UID) \
100 $($(target)_$(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
101 $($(target)_$(srcdst)_UID.$(bld_trg)) \
102 $($(target)_$(srcdst)_UID) \
103 $($(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
104 $($(srcsrc)_UID.$(bld_trg)) \
105 $($(srcsrc)_UID) \
106 $($(srcdst)_UID.$(bld_trg).$(bld_trg_arch)) \
107 $($(srcdst)_UID.$(bld_trg)) \
108 $($(srcdst)_UID) \
109 $(top_uid))
110local gid := $(firstword \
111 $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
112 $($(target)_$(srcsrc)_GID.$(bld_trg)) \
113 $($(target)_$(srcsrc)_GID) \
114 $($(target)_$(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
115 $($(target)_$(srcdst)_GID.$(bld_trg)) \
116 $($(target)_$(srcdst)_GID) \
117 $($(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
118 $($(srcsrc)_GID.$(bld_trg)) \
119 $($(srcsrc)_GID) \
120 $($(srcdst)_GID.$(bld_trg).$(bld_trg_arch)) \
121 $($(srcdst)_GID.$(bld_trg)) \
122 $($(srcdst)_GID) \
123 $(top_gid))
124local flags := \
125 $(top_ifflags) \
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))
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))
151
152
153# Adjust the source if we got a default PATH. (This must be done this late!)
154ifdef $(target)_DEFPATH
155local defpath := $($(target)_DEFPATH)
156else ifdef $(target)_PATH
157local defpath := $($(target)_PATH)
158else
159local defpath :=
160endif
161ifneq ($(defpath),)
162 local srcsrc := $(abspathex $(srcsrc),$(defpath))
163endif
164
165# Generate the staging rule (requires double evaluation).
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
175 local stage := $(abspath $(stage))/
176 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
177 local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
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
183ifdef $(srcsrc)_INSTALLER
184 local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
185else ifdef $(target)_INSTALLER
186 local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
187else
188 local stagecmd := $$(INSTALL_STAGING)\
189 $(if $(uid),-o $(uid))\
190 $(if $(gid),-g $(gid))\
191 $(if $(mode),-m $(mode))\
192 $(flags) -- \
193 $(srcsrc) $(stagedst)
194endif
195$(eval $(def_install_src_rule_staging))
196$(target)_2_STAGE_TARGETS += $(stagedst)
197
198# Generate the install rule
199ifeq ($(insttype),both)
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
211 ifdef $(srcsrc)_INSTALLER
212 local instcmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
213 else ifdef $(target)_INSTALLER
214 local instcmd := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
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
223 $(eval $(def_install_src_rule_installing))
224 $(target)_2_INST_TARGETS += $(instdst)
225endif
226
227#$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => instdst=$(instdst); stage=$(stage) => stagedst=$(stagedst))
228endef # def_install_src
229$(eval-opt-var def_install_src)
230
231
232##
233# Generate the symlink rules.
234#
235define def_install_symlink_rule_staging
236$(stagedst) : | $(dir $(stagedst))
237 %$$(call MSG_INST_SYM,$(stagedst),$(symdst))
238 $$(QUIET)$$(RM) -f -- $$@
239 $$(QUIET)$$(LN_SYMLINK) $(symdst) $(stagedst)
240endef
241$(eval-opt-var def_install_symlink_rule_staging)
242
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#
255define def_install_symlink
256
257# deal with '=>' in the source file name.
258local symdst := $(subst =>, ,$(src))
259local symlnk := $(firstword $(symdst))
260local symdst := $(word $(words $(symdst)),$(symdst))
261
262# Figure which install function to use below.
263ifdef $(symlnk)_INSTFUN
264 local instfun := $(symlnk)_INSTFUN
265else
266 local instfun := $(top_instfun)
267endif
268
269# Calc stage destination and generate the rule (requires double evaluation).
270local stage := $(strip $(firstdefined $(symlnk)_STAGE $(symlnk)_INST $(target)_1_STAGE,value))
271if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
272 $(warning kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
273 local stage := $(stage)/
274endif
275local stage := $(stage)$(dir $(symlnk))
276ifeq ($(root $(stage)),)
277 local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_STAGE))
278else
279 local stage := $(abspath $(stage))/
280 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
281 local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
282 local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_OBJ))
283 else
284 $(error kBuild: Symlink $(symlnk) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
285 endif
286endif
287
288$(eval $(def_install_symlink_rule_staging))
289$(target)_2_STAGE_TARGETS += $(stagedst)
290
291# Calcuate the install destiation and generate the rule (if necessary).
292ifeq ($(instmode),both)
293 local inst := $(strip $(firstdefined $(symlnk)_INST $(target)_1_INST,value))
294 if "$(substr $(inst),-1)" != "/" && "$(inst)" != ""
295 $(warning kBuild: Symlink $(symlnk) in install target $(target) has a INST property without a trailing slash: '$(inst)')
296 local inst := $(inst)/
297 endif
298 ifneq ($(root $(inst)),)
299 $(error kBuild: Symlink $(symlnk) in install target $(target) has a INST property with an absolute path: '$(inst)')
300 endif
301 local inst := $(inst)$(dir $(symlnk))
302 local instdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
303 $(eval $(def_install_symlink_rule_installing))
304 $(target)_2_INST_TARGETS += $(instdst)
305endif
306
307#$(warning symlnk=$(symlnk) symdst=$(symdst) instdst=$(instdst) stagedst=$(stagedst) instfun=$(instfun) inst=$(inst) stage='$(stage)')
308endef # def_install_symlink
309$(optmize def_install_symlink)
310
311
312##
313# Generate an directory installtion rule.
314# Note. Used both for staging and real install rules.
315#
316define def_install_directory_rule
317# the install rule
318$(insdst):
319 %$$(call MSG_INST_DIR,$(insdst))
320 $$(QUIET)$$(INSTALL) -d \
321 $(if $(uid),-o $(uid))\
322 $(if $(gid),-g $(gid))\
323 $(if $(mode),-m $(mode))\
324 $(flags) -- \
325 $(insdst)
326
327.NOTPARALLEL: $(insdst)
328endef # def_install_directory_rule
329$(eval-opt-var def_install_directory_rule)
330
331##
332# Create one directory.
333#
334define def_install_directory
335
336# gather common properties.
337local mode := $(firstword \
338 $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
339 $($(target)_$(directory)_MODE.$(bld_trg)) \
340 $($(target)_$(directory)_MODE) \
341 $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
342 $($(directory)_MODE.$(bld_trg)) \
343 $($(directory)_MODE) \
344 $(top_mode) )
345local uid := $(firstword \
346 $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
347 $($(target)_$(directory)_UID.$(bld_trg)) \
348 $($(target)_$(directory)_UID) \
349 $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
350 $($(directory)_UID.$(bld_trg)) \
351 $($(directory)_UID) \
352 $(top_uid) )
353local gid := $(firstword \
354 $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
355 $($(target)_$(directory)_GID.$(bld_trg)) \
356 $($(target)_$(directory)_GID) \
357 $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
358 $($(directory)_GID.$(bld_trg)) \
359 $($(directory)_GID) \
360 $(top_gid) )
361local flags := \
362 $(top_idflags) \
363 $($(directory)_IDFLAGS) \
364 $($(directory)_IDFLAGS.$(bld_trg)) \
365 $($(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
366 $($(target)_$(directory)_IDFLAGS) \
367 $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
368 $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
369
370# The staging rule (requires double evaluation).
371local stage := $(strip $(firstdefined $(directory)_STAGE $(directory)_INST $(target)_1_STAGE,value))
372if "$(substr $(stage),-1)" != "/" && "$(stage)" != ""
373 $(warning kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property without a trailing slash: '$(stage)')
374 local stage := $(stage)/
375endif
376ifeq ($(root $(stage)),)
377 local insdst := $(PATH_STAGE)/$(stage)$(directory)/
378else
379 local stage := $(abspath $(stage))/
380 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
381 local insdst := $(stage)$(directory)/
382 else
383 $(error kBuild: Directory $(directory) in install target $(target) has a STAGE/INST property with an absolute path outside PATH_OBJ: '$(stage)')
384 endif
385endif
386
387$(target)_2_STAGE_DIR_TARGETS += $(insdst)
388$(eval $(def_install_directory_rule))
389
390# The install rule.
391ifeq ($(insttype),both)
392 local inst := $(strip $(firstdefined $(directory)_INST $(target)_1_INST,value))
393 ifneq ($(substr $(inst),-1),/)
394 $(warning kBuild: Directory $(directory) in install target $(target) has a INST property without a trailing slash: '$(inst)')
395 local inst := $(inst)/
396 endif
397 ifneq ($(root $(stage)),)
398 $(error kBuild: Directory $(directory) in install target $(target) has a INST property with an absolute path: '$(inst)')
399 endif
400 local insdst := $(PATH_INS)/$(inst)$(directory)/
401 $(target)_2_INST_DIR_TARGETS += $(insdst)
402 $(eval $(def_install_directory_rule))
403endif
404
405#$(warning directory=$(directory) inst=$(inst) stage=$(stage) mode=$(mode) gid=$(gid) uid=$(uid))
406endef # def_install_directory
407$(eval-opt-var def_install_directory)
408
409
410##
411# Process one install target.
412#
413define def_install
414# the basics.
415local bld_type := $(firstword $($(target)_BLD_TYPE) $(KBUILD_TYPE))
416local bld_trg := $(firstword $($(target)_BLD_TRG) $(KBUILD_TARGET))
417local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
418local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(KBUILD_TARGET_CPU))
419local insttype := $($(target)_1_INSTTYPE)
420
421ifneq ($(insttype),none)
422 $(target)_2_STAGE_TARGETS := $($(target)_GOALS) $($(target)_STAGE_ONLY_GOALS)
423else
424 $(target)_2_STAGE_TARGETS :=
425endif
426$(target)_2_STAGE_DIR_TARGETS :=
427
428ifeq ($(insttype),both)
429 $(target)_2_INST_TARGETS := $($(target)_GOALS) $($(target)_INST_ONLY_GOALS)
430else
431 $(target)_2_INST_TARGETS :=
432endif
433$(target)_2_INST_DIR_TARGETS :=
434
435
436local outbase := $(call TARGET_BASE,$(target),$(target))
437$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
438$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
439
440ifneq ($(insttype),none)
441 # cache top level target properties.
442 local top_mode := $(firstword \
443 $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
444 $($(target)_MODE.$(bld_trg)) \
445 $($(target)_MODE) )
446 local top_exec_mode := $(firstword \
447 $($(target)_EXEC_MODE.$(bld_trg).$(bld_trg_arch)) \
448 $($(target)_EXEC_MODE.$(bld_trg)) \
449 $($(target)_EXEC_MODE) )
450 local top_uid := $(firstword \
451 $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
452 $($(target)_UID.$(bld_trg)) \
453 $($(target)_UID) )
454 local top_gid := $(firstword \
455 $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
456 $($(target)_GID.$(bld_trg)) \
457 $($(target)_GID) )
458 local top_ifflags := \
459 $($(target)_IFFLAGS) \
460 $($(target)_IFFLAGS.$(bld_trg)) \
461 $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
462 local top_idflags := \
463 $($(target)_IDFLAGS) \
464 $($(target)_IDFLAGS.$(bld_trg)) \
465 $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
466 ifdef $(target)_INSTFUN
467 local top_instfun := $(target)_INSTFUN
468 else
469 local top_instfun := _INSTALL_FILE
470 endif
471
472 $(foreach directory, \
473 $($(target)_DIRS) \
474 $($(target)_DIRS.$(bld_trg)) \
475 $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) \
476 $($(target)_DIRS.$(bld_trg_arch)) \
477 $($(target)_DIRS.$(bld_trg_cpu)) \
478 $($(target)_DIRS.$(bld_type)), \
479 $(evalval def_install_directory))
480
481 local clean_files := \
482 $($(target)_CLEAN) \
483 $($(target)_CLEAN.$(bld_trg)) \
484 $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
485 $($(target)_CLEAN.$(bld_trg_arch)) \
486 $($(target)_CLEAN.$(bld_trg_cpu)) \
487 $($(target)_CLEAN.$(bld_type))
488
489 local source_type_prefix :=
490 local source_type_mode := $(firstword $(top_mode) a+r,u+w)
491 $(foreach src,\
492 $($(target)_SOURCES) \
493 $($(target)_SOURCES.$(bld_trg)) \
494 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
495 $($(target)_SOURCES.$(bld_trg_arch)) \
496 $($(target)_SOURCES.$(bld_trg_cpu)) \
497 $($(target)_SOURCES.$(bld_type)), \
498 $(evalval def_install_src))
499
500 local source_type_prefix := EXEC_
501 local source_type_mode := $(firstword $(top_exec_mode) a+xr,u+w)
502 $(foreach src,\
503 $($(target)_EXEC_SOURCES) \
504 $($(target)_EXEC_SOURCES.$(bld_trg)) \
505 $($(target)_EXEC_SOURCES.$(bld_trg).$(bld_trg_arch)) \
506 $($(target)_EXEC_SOURCES.$(bld_trg_arch)) \
507 $($(target)_EXEC_SOURCES.$(bld_trg_cpu)) \
508 $($(target)_EXEC_SOURCES.$(bld_type)), \
509 $(evalval def_install_src))
510
511 $(foreach src,\
512 $($(target)_SYMLINKS) \
513 $($(target)_SYMLINKS.$(bld_trg)) \
514 $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) \
515 $($(target)_SYMLINKS.$(bld_trg_arch)) \
516 $($(target)_SYMLINKS.$(bld_trg_cpu)) \
517 $($(target)_SYMLINKS.$(bld_type)), \
518 $(evalval def_install_symlink))
519else # none
520 local clean_files :=
521endif
522
523# The collection targets (staging only).
524local clean_files += $($(target)_1_TARGET)
525$($(target)_1_TARGET): $$($(target)_2_STAGE_TARGETS) | $$($(target)_2_STAGE_DIR_TARGETS) $$(dir $$@)
526 @$(QUIET2)$(APPEND) $@
527
528$(target): $$($(target)_1_TARGET)
529
530# Update Global lists.
531_INSTALLS += $($(target)_1_TARGET)
532_STAGE_FILES += $($(target)_2_STAGE_TARGETS)
533_STAGE_DIRS += $($(target)_2_STAGE_DIR_TARGETS)
534_INSTALLS_FILES += $($(target)_2_INST_TARGETS)
535_INSTALLS_DIRS += $($(target)_2_INST_DIR_TARGETS)
536_CLEAN_FILES += $(clean_files)
537_DIRS += \
538 $($(target)_0_OUTDIR) \
539 $($(target)_BLDDIRS) \
540 $($(target)_BLDDIRS.$(bld_trg)) \
541 $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) \
542 $($(target)_BLDDIRS.$(bld_trg_arch)) \
543 $($(target)_BLDDIRS.$(bld_trg_cpu)) \
544 $($(target)_BLDDIRS.$(bld_type))
545
546# Deprecated properties.
547INSTARGET_$(target) := $($(target)_2_STAGE_TARGETS)
548INSTARGET_DIRS_$(target) := $($(target)_2_STAGE_DIR_TARGETS)
549
550endef # def_install
551$(eval-opt-var def_install)
552
553## Do pass 1 on the implicit targets and add them to the list.
554$(foreach target, $(_ALL_INSTALLS_IMPLICIT), \
555 $(evalval def_pass1_install))
556_ALL_INSTALLS += $(_ALL_INSTALLS_IMPLICIT)
557
558## Do pass 2 on all install targets.
559$(foreach target, $(_ALL_INSTALLS), \
560 $(evalvalctx def_install))
561
562ifdef KBUILD_PROFILE_SELF
563 $(evalcall def_profile_self, done install targets)
564endif
565
566#
567# Some introspection targets that can be useful for package maintainers.
568#
569.PHONY: kbuild-show-install-files kbuild-show-install-dirs
570kbuild-show-install-files::
571 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_FILES)))
572
573kbuild-show-install-dirs::
574 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_DIRS)))
575
576kbuild-show-stage-files::
577 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_FILES)))
578
579kbuild-show-stage-dirs::
580 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_DIRS)))
581
582
Note: See TracBrowser for help on using the repository browser.