[PATCH] USBATM: xusbatm rewrite
[linux-2.6.22.y-op.git] / usr / Makefile
blobe2129cb570bba89a6790afaa045e7aad65300f34
2 obj-y := initramfs_data.o
4 hostprogs-y := gen_init_cpio
6 clean-files := initramfs_data.cpio.gz initramfs_list
8 # initramfs_data.o contains the initramfs_data.cpio.gz image.
9 # The image is included using .incbin, a dependency which is not
10 # tracked automatically.
11 $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
13 ifdef CONFIG_INITRAMFS_ROOT_UID
14 gen_initramfs_args += -u $(CONFIG_INITRAMFS_ROOT_UID)
15 endif
17 ifdef CONFIG_INITRAMFS_ROOT_GID
18 gen_initramfs_args += -g $(CONFIG_INITRAMFS_ROOT_GID)
19 endif
21 # The $(shell echo $(CONFIG_INITRAMFS_SOURCE)) is to remove the
22 # gratuitous begin and end quotes from the Kconfig string type.
23 # Internal, escaped quotes in the Kconfig string will loose the
24 # escape and become active quotes.
25 quotefixed_initramfs_source := $(shell echo $(CONFIG_INITRAMFS_SOURCE))
27 filechk_initramfs_list = $(CONFIG_SHELL) \
28 $(srctree)/scripts/gen_initramfs_list.sh $(gen_initramfs_args) $(quotefixed_initramfs_source)
30 $(obj)/initramfs_list: $(obj)/Makefile FORCE
31 $(call filechk,initramfs_list)
33 quiet_cmd_cpio = CPIO $@
34 cmd_cpio = ./$< $(obj)/initramfs_list > $@
37 # Check if the INITRAMFS_SOURCE is a cpio archive
38 ifneq (,$(findstring .cpio,$(quotefixed_initramfs_source)))
40 # INITRAMFS_SOURCE has a cpio archive - verify that it's a single file
41 ifneq (1,$(words $(quotefixed_initramfs_source)))
42 $(error Only a single file may be specified in CONFIG_INITRAMFS_SOURCE (="$(quotefixed_initramfs_source)") when a cpio archive is directly specified.)
43 endif
44 # Now use the cpio archive directly
45 initramfs_data_cpio = $(quotefixed_initramfs_source)
46 targets += $(quotefixed_initramfs_source)
48 else
50 # INITRAMFS_SOURCE is not a cpio archive - create one
51 $(obj)/initramfs_data.cpio: $(obj)/gen_init_cpio \
52 $(initramfs-y) $(obj)/initramfs_list FORCE
53 $(call if_changed,cpio)
55 targets += initramfs_data.cpio
56 initramfs_data_cpio = $(obj)/initramfs_data.cpio
58 endif
61 $(obj)/initramfs_data.cpio.gz: $(initramfs_data_cpio) FORCE
62 $(call if_changed,gzip)
64 targets += initramfs_data.cpio.gz