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

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

footer.kmk: Split it up into several files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.9 KB
RevLine 
[72]1# $Id: footer-pass2-installs.kmk 2521 2011-07-26 18:18:19Z 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))
[353]261
[2517]262# Figure which install function to use below.
[380]263ifdef $(symlnk)_INSTFUN
[1496]264 local instfun := $(symlnk)_INSTFUN
[353]265else
[2475]266 local instfun := $(top_instfun)
[353]267endif
268
[2517]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)/
[353]274endif
[2517]275local stage := $(stage)$(dir $(srcdstdir))
276ifeq ($(root $(stage)),)
277 local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_STAGE))
278else
[2518]279 local stage := $(abspath $(stage))/
[2517]280 ifeq ($(pos $(PATH_OBJ),$(stage)),1)
[2518]281 local stage := $(substr $(stage), $(expr $(length-var PATH_OBJ) + 2))
[2517]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
[2475]286endif
[353]287
[2475]288$(eval $(def_install_symlink_rule_staging))
289$(target)_2_STAGE_TARGETS += $(stagedst)
[353]290
[2517]291# Calcuate the install destiation and generate the rule (if necessary).
[2475]292ifeq ($(instmode),both)
[2517]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 $(srcdstdir))
302 local instdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
[2475]303 $(eval $(def_install_symlink_rule_installing))
304 $(target)_2_INST_TARGETS += $(instdst)
305endif
306
[2517]307#$(warning symlnk=$(symlnk) symdst=$(symdst) instdst=$(instdst) stagedst=$(stagedst) instfun=$(instfun) inst=$(inst) stage='$(stage)')
[1936]308endef # def_install_symlink
309$(optmize def_install_symlink)
[353]310
[412]311
[2475]312##
313# Generate an directory installtion rule.
314# Note. Used both for staging and real install rules.
315#
[380]316define def_install_directory_rule
317# the install rule
318$(insdst):
[1496]319 %$$(call MSG_INST_DIR,$(insdst))
[696]320 $$(QUIET)$$(INSTALL) -d \
[380]321 $(if $(uid),-o $(uid))\
322 $(if $(gid),-g $(gid))\
323 $(if $(mode),-m $(mode))\
[1599]324 $(flags) -- \
[380]325 $(insdst)
[412]326
327.NOTPARALLEL: $(insdst)
[1936]328endef # def_install_directory_rule
329$(eval-opt-var def_install_directory_rule)
[380]330
[2475]331##
332# Create one directory.
333#
[380]334define def_install_directory
335
[2475]336# gather common properties.
[1496]337local mode := $(firstword \
[481]338 $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
[380]339 $($(target)_$(directory)_MODE.$(bld_trg)) \
340 $($(target)_$(directory)_MODE) \
[481]341 $($(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
[380]342 $($(directory)_MODE.$(bld_trg)) \
343 $($(directory)_MODE) \
[2475]344 $(top_mode) )
[1496]345local uid := $(firstword \
[481]346 $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
[380]347 $($(target)_$(directory)_UID.$(bld_trg)) \
348 $($(target)_$(directory)_UID) \
[481]349 $($(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
[380]350 $($(directory)_UID.$(bld_trg)) \
351 $($(directory)_UID) \
[2475]352 $(top_uid) )
[1496]353local gid := $(firstword \
[481]354 $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
[380]355 $($(target)_$(directory)_GID.$(bld_trg)) \
356 $($(target)_$(directory)_GID) \
[481]357 $($(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
[380]358 $($(directory)_GID.$(bld_trg)) \
359 $($(directory)_GID) \
[2475]360 $(top_gid) )
[1496]361local flags := \
[2475]362 $(top_idflags) \
[830]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)) \
[2475]368 $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
[380]369
[2475]370# The staging rule (requires double evaluation).
[2517]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
[2518]379 local stage := $(abspath $(stage))/
[2517]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
[2475]387$(target)_2_STAGE_DIR_TARGETS += $(insdst)
[380]388$(eval $(def_install_directory_rule))
389
[2475]390# The install rule.
391ifeq ($(insttype),both)
[2517]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
[2519]397 ifneq ($(root $(stage)),)
398 $(error kBuild: Directory $(directory) in install target $(target) has a INST property with an absolute path: '$(inst)')
[2517]399 endif
[2514]400 local insdst := $(PATH_INS)/$(inst)$(directory)/
[2475]401 $(target)_2_INST_DIR_TARGETS += $(insdst)
402 $(eval $(def_install_directory_rule))
403endif
404
[2517]405#$(warning directory=$(directory) inst=$(inst) stage=$(stage) mode=$(mode) gid=$(gid) uid=$(uid))
[1936]406endef # def_install_directory
407$(eval-opt-var def_install_directory)
[380]408
409
[2475]410##
411# Process one install target.
412#
[353]413define def_install
[744]414# the basics.
[2475]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)
[353]420
[2475]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))
[2239]437$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
[2436]438$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
[380]439
[2475]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) )
[2483]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) )
[2475]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)) \
[2477]461 $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch))
[2475]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
[1614]471
[2475]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))
[380]480
[2475]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))
[353]488
[2483]489 local source_type_prefix :=
490 local source_type_mode := $(firstword $(top_mode) a+r,u+w)
[2475]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))
[353]499
[2483]500 local source_type_prefix := EXEC_
501 local source_type_mode := $(firstword $(top_exec_mode) a+xr,u+w)
[2475]502 $(foreach src,\
[2483]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,\
[2475]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 $$@)
[827]526 @$(QUIET2)$(APPEND) $@
527
[2238]528$(target): $$($(target)_1_TARGET)
[827]529
[2475]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
[1936]550endef # def_install
551$(eval-opt-var def_install)
[353]552
[2479]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.
[1648]559$(foreach target, $(_ALL_INSTALLS), \
[1614]560 $(evalvalctx def_install))
[353]561
[988]562ifdef KBUILD_PROFILE_SELF
[2008]563 $(evalcall def_profile_self, done install targets)
[988]564endif
[353]565
[2475]566#
[2227]567# Some introspection targets that can be useful for package maintainers.
[2475]568#
[2227]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
[2475]576kbuild-show-stage-files::
577 $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_FILES)))
[2227]578
[2475]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.