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