Use a _install directory for each boot package. Don't just use a whole
[people/mcb30/mkbootfs.git] / Makefile
1 BOOTPACK = ./tools/bootpack
2
3 CFLAGS = -W -Wall -Wextra -O3
4
5 BOOTPACKS :=
6
7 all : tools bootpacks
8
9 # Build tools for bootfs manipulation
10
11 $(BOOTPACK) : $(BOOTPACK).c
12         $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -lz $< -o $@
13
14 clean ::
15         rm -f $(BOOTPACK)
16
17 tools :: $(BOOTPACK)
18
19 # Skeleton boot pack
20
21 SKEL_DEVS :=
22 SKEL_DEVS += /dev/null
23 SKEL_DEVS += /dev/console
24 SKEL_DEVS += /dev/tty
25 SKEL_DEVS += /dev/tty1
26 SKEL_DEVS += /dev/tty2
27 SKEL_DEVS += /dev/tty3
28 SKEL_DEVS += /dev/tty4
29 SKEL_DEVS += /dev/tty5
30 SKEL_DEVS += /dev/tty6
31 SKEL_DEVS += /dev/mem
32 SKEL_DEVS += /dev/urandom
33
34 skeleton.bp : $(BOOTPACK)
35         mkdir -p skeleton
36         rm -rf skeleton/_install
37         mkdir -p skeleton/_install/{bin,dev,etc,lib/modules,mnt,proc,sbin,sys}
38         mkdir -p skeleton/_install/{usr/{bin,sbin,share}}
39         mkdir -p skeleton/_install/{var/{lock,log,run}}
40         $(BOOTPACK) -o $@ skeleton/_install=/ $(SKEL_DEVS)
41
42 BOOTPACKS += skeleton.bp
43
44 # Busybox boot pack
45
46 busybox/busybox : busybox/.config
47         $(MAKE) -C busybox oldconfig
48         uclibc $(MAKE) -C busybox
49
50 busybox.bp : busybox/busybox $(BOOTPACK)
51         $(MAKE) -C busybox install
52         $(BOOTPACK) -o $@ busybox/_install=/
53
54 BOOTPACKS += busybox.bp
55
56 clean ::
57         $(MAKE) -C busybox clean
58
59 # Policy boot pack
60
61 POL_FILES :=
62 POL_FILES += policy/etc/passwd
63 POL_FILES += policy/etc/group
64 POL_FILES += policy/etc/protocols
65 POL_FILES += policy/etc/inittab
66 POL_FILES += policy/etc/init.d/rcS
67 POL_FILES += policy/usr/share/udhcpc/default.script
68 POL_FILES += policy/bin/welcome.sh
69
70 policy.bp : $(POL_FILES) $(BOOTPACK)
71         rm -rf policy/_install
72         mkdir -p policy/_install/{etc/init.d,bin,usr/share/udhcpc}
73         for file in $(POL_FILES) ; do \
74                 cp -p $$file \
75                   `echo $$file | sed 's/^policy\//policy\/_install\//'` ; \
76         done
77         $(BOOTPACK) -o $@ policy/_install=/
78
79 BOOTPACKS += policy.bp
80
81 # Boot pack common instructions
82
83 bootpacks : $(BOOTPACKS)
84
85 clean ::
86         rm -f $(BOOTPACKS)