]> CyberLeo.Net >> Repos - CDN/Mosi.git/blob - Makefile
script/gentree: move overlay application before package installation
[CDN/Mosi.git] / Makefile
1 # mkisofs meanings
2 # -v Verbose
3 # -quiet quiet?
4 # -o output to root.iso
5 # -D No deep directory relocation (and no RR_MOVED)
6 # -no-pad Don't pad to 150 sectors
7 # -p preparer
8 # -V volume label
9
10 # Settables
11 srctree     ?= src
12 worktree    ?= tree
13 boot_pad    ?= 1280
14 image_sect  ?= 1000944
15
16 # Generation scripts
17 gentree      = script/gentree
18 genufs       = script/genufs
19 geniso       = script/geniso
20 genuzip      = script/genuzip
21 gencard      = script/gencard
22
23 # Image utilities
24 mkuzip      != which mkuzip
25 mkuzip_opts ?= -s 65536
26 mkisofs     != which mkisofs
27 mkisofs_opts?= -quiet -D -R -no-pad -p CyberLeo
28
29 # Default device for burn target
30 dev         ?= null
31
32 # Check current user
33 curruser    != id -u
34 checkroot    = @if [ $(curruser) -gt 0 ]; then printf "\033[1;31mI need root\033[0m\n"; exit 1; fi
35 checkdeps    = @if [ ! -x "$(mkisofs)" -o ! -x "$(mkuzip)" ]; then printf "\033[1;31mCheck depends! mkisofs: $(mkisofs) mkuzip: $(mkuzip)\033[0m\n"; exit 1; fi
36
37 # Default target
38 all: $(worktree)/card.img
39
40 image: $(worktree)/card.img
41
42 firmware: $(worktree)/card.img
43
44 # Check that we're running as root
45 checkroot:
46         $(checkroot)
47
48 # Burn to device
49 burn: $(worktree)/card.img
50         $(checkroot)
51         script/burn $(.ALLSRC) $(dev)
52
53 # Push to build target
54 push:
55         script/push
56
57 # Generate components
58 $(worktree)/card.img: $(worktree)/boot.img $(worktree)/root.img
59         $(checkroot)
60         ${gencard} -b $(worktree)/boot.img -r $(worktree)/root.img -c $(worktree)/conf -o $(worktree)/card.img
61         @printf " \033[1;32m*\033[0m Complete\n"
62
63 $(worktree)/boot.img: $(worktree)/boot
64         $(checkroot)
65         ${genufs} -p $(boot_pad) -l boot -o $(worktree)/boot.img $(worktree)/boot
66
67 $(worktree)/root.img: $(worktree)/root.iso
68         $(checkroot)
69         $(checkdeps)
70         ${genuzip} $(.ALLSRC) $(.TARGET)
71
72 $(worktree)/root.iso: $(worktree)/root
73         $(checkroot)
74         $(checkdeps)
75         ${geniso} -n root $(.ALLSRC) $(.TARGET)
76
77 $(worktree): $(worktree)/root
78
79 $(worktree)/boot: $(srctree)/root
80         $(checkroot)
81         $(gentree) -b $(srctree) -t $(worktree) -r $(.ALLSRC)
82
83 $(worktree)/root: $(srctree)/root
84         $(checkroot)
85         $(gentree) -b $(srctree) -t $(worktree) -r $(.ALLSRC)
86
87 # Scrub everything clean
88 clean:
89         $(checkroot)
90         rm -Rf $(worktree)