-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
CC = m68k-atari-mint-gcc
CFLAGS = -nostdlib -s
LDFLAGS = -Wl,--oformat=binary
# Root sector:
# code starts at offset 0,
# (DOS) partition table starts at offset 0x1BC = 444,
# bytes 442-443 are used to set the correct checksum.
ROOT_MAX=442
# Boot sector:
# code starts at offset 0x3E = 62,
# bytes 508-509 are used to set the correct checksum,
# bytes 510-511 are reserved for 0xAA55 magic number.
BOOT_MAX=446
default: root.bin bootsect.bin sizecheck
clean:
-rm -f root.bin bootsect.bin emutos.sys sdcard-acsi.img sdcard-ide.img
# Check that maximum binary size is not exceeded
sizecheck:
@if [ `cat root.bin | wc -c` -gt $(ROOT_MAX) ]; then \
echo "Root sector binary must be max. $(ROOT_MAX) bytes!"; \
exit 1; \
fi
@if [ `cat bootsect.bin | wc -c` -gt $(BOOT_MAX) ]; then \
echo "Boot sector binary must be max. $(BOOT_MAX) bytes!"; \
exit 1; \
fi
.PHONY: default clean sizecheck sdcard-images
%.bin: %.S
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
ifndef UNIQUE
UNIQUE=us
endif
emutos.sys:
-rm -rf emutos-temp/
git clone --depth=1 https://github.com/emutos/emutos.git emutos-temp
make -j2 -C emutos-temp prg UNIQUE=$(UNIQUE)
mv emutos-temp/emutos$(UNIQUE).prg emutos.sys
upx -qq emutos.sys
sdcard-images: sdcard-acsi.img sdcard-ide.img
sdcard-acsi.img: emutos.sys sdcard-template.bin default
cp -f sdcard-template.bin $@
./install.py $@ emutos.sys
sdcard-ide.img: emutos.sys sdcard-template.bin default
cp -f sdcard-template.bin $@
./install.py -ideswap $@ emutos.sys