7 target ?= targets/$(arch)/$(conf)
8 srctree ?= $(target)/world
9 worktree ?= $(target)/tree
14 gentree = script/gentree
15 genufs = script/genufs
16 geniso = script/geniso
17 genuzip = script/genuzip
18 gencard = script/gencard
21 makefs != which makefs
22 makefs_opts ?= -t ffs -o version=2,optimization=space -b 8 -f 8
23 tunefs != which tunefs
24 mkuzip != which mkuzip
25 mkuzip_opts ?= -s 65536
26 mkisofs != which mkisofs
27 mkisofs_opts?= -quiet -D -R -no-pad -p CyberLeo
29 # Default device for burn target
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
38 all: $(worktree)/card.img
40 image: $(worktree)/card.img
42 firmware: $(worktree)/card.img
44 # Check that we're running as root
49 burn: $(worktree)/card.img
51 script/burn $(.ALLSRC) $(dev)
53 # Push to build target
55 script/push cyberleo@sc1425:mosi/
58 $(worktree)/card.img: $(worktree)/boot.img $(worktree)/root.img
60 ${gencard} -b $(worktree)/boot.img -r $(worktree)/root.img -c $(worktree)/conf -s ${cardsize} -o $(worktree)/card.img
61 @printf " \033[1;32m*\033[0m Complete\n"
63 $(worktree)/boot.img: $(worktree)/boot
65 #${genufs} -p $(boot_pad) -l boot -o $(worktree)/boot.img $(worktree)/boot
66 ${makefs} ${makefs_opts} $(worktree)/boot.img $(worktree)/boot
67 ${tunefs} -L boot $(worktree)/boot.img
69 $(worktree)/root.img: $(worktree)/root.iso
72 ${genuzip} $(.ALLSRC) $(.TARGET)
74 $(worktree)/root.iso: $(worktree)/root
77 ${geniso} -n root $(.ALLSRC) $(.TARGET)
79 $(worktree): $(worktree)/root
81 $(worktree)/boot: $(srctree)/root
83 $(gentree) -a $(arch) -c $(conf)
85 $(worktree)/root: $(srctree)/root
87 $(gentree) -a $(arch) -c $(conf)
89 # Scrub everything clean
92 sh -c 'if ! rm -Rf $(worktree); then chflags -R noschg $(worktree); rm -Rf $(worktree); fi'