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

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

header.kmk,footer*.kmk: Made sure that paths are absolute (KB_FN_ASSERT_ABSPATH w/ KBUILD_INTERNAL_STRICT=1). This may break dependencies on installed files.

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