Contents of /tags/mkinitrd-6_3_4/klibc/usr/Kbuild
Parent Directory | Revision Log
Revision 1189 -
(show annotations)
(download)
Thu Dec 16 01:27:43 2010 UTC (13 years, 9 months ago) by niro
File size: 2649 byte(s)
Thu Dec 16 01:27:43 2010 UTC (13 years, 9 months ago) by niro
File size: 2649 byte(s)
tagged 'mkinitrd-6_3_4'
1 | # |
2 | # kbuild file for usr/ - including initramfs image and klibc |
3 | # |
4 | |
5 | CONFIG_KLIBC := 1 |
6 | |
7 | include-subdir := include |
8 | klibc-subdir := klibc |
9 | usr-subdirs := kinit utils dash gzip |
10 | subdir- := $(include-subdir) $(klibc-subdir) $(usr-subdirs) |
11 | |
12 | usr-subdirs := $(addprefix _usr_,$(usr-subdirs)) |
13 | klibc-subdir := $(addprefix _usr_,$(klibc-subdir)) |
14 | |
15 | # klibc binaries |
16 | ifdef CONFIG_KLIBC |
17 | |
18 | # .initramfs_data.cpio.gz.d is used to identify all files included |
19 | # in initramfs and to detect if any files are added/removed. |
20 | # Removed files are identified by directory timestamp being updated |
21 | # The dependency list is generated by gen_initramfs.sh -l |
22 | ifneq ($(wildcard $(obj)/.initramfs_data.cpio.gz.d),) |
23 | include $(obj)/.initramfs_data.cpio.gz.d |
24 | endif |
25 | |
26 | # build klibc library before the klibc programs |
27 | # build klibc programs before cpio.gz |
28 | .PHONY: initramfs $(usr-subdirs) $(klibc-subdir) $(include-subdir) |
29 | initramfs: $(usr-subdirs) $(klibc-subdir) $(include-subdir) |
30 | $(deps_initramfs): $(usr-subdirs) $(klibc-subdir) $(include-subdir) |
31 | |
32 | $(usr-subdirs): $(klibc-subdir) |
33 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) |
34 | |
35 | $(klibc-subdir): $(include-subdir) |
36 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) |
37 | |
38 | $(include-subdir): |
39 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) |
40 | endif |
41 | |
42 | |
43 | # Generate builtin.o based on initramfs_data.o |
44 | obj-y := initramfs_data.o |
45 | |
46 | # initramfs_data.o contains the initramfs_data.cpio.gz image. |
47 | # The image is included using .incbin, a dependency which is not |
48 | # tracked automatically. |
49 | $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE |
50 | |
51 | ##### |
52 | # Generate the initramfs cpio archive |
53 | |
54 | hostprogs-y := gen_init_cpio |
55 | ginitramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh |
56 | ramfs-def := $(srctree)/$(src)/initramfs.default |
57 | ramfs-input := $(shell echo $(CONFIG_INITRAMFS_SOURCE)) |
58 | ramfs-input := $(if $(ramfs-input), $(ramfs-input), $(ramfs-def)) |
59 | |
60 | ramfs-args := \ |
61 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ |
62 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) |
63 | |
64 | quiet_cmd_initfs = GEN $@ |
65 | cmd_initfs = $(ginitramfs) -o $@ $(ramfs-args) $(ramfs-input) |
66 | |
67 | targets := initramfs_data.cpio.gz |
68 | # We rebuild initramfs_data.cpio.gz if: |
69 | # 1) Any included file is newer then initramfs_data.cpio.gz |
70 | # 2) There are changes in which files are included (added or deleted) |
71 | # 3) If gen_init_cpio are newer than initramfs_data.cpio.gz |
72 | # 4) arguments to gen_initramfs.sh changes |
73 | $(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(deps_initramfs) initramfs |
74 | $(Q)$(ginitramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.gz.d |
75 | $(call if_changed,initfs) |