-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
68 lines (51 loc) · 1.69 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
58
59
60
61
62
63
64
65
66
67
68
ifdef $(GENDEV)
ROOTDIR = $(GENDEV)
else
ROOTDIR = /opt/toolchains/sega
endif
LDSCRIPTSDIR = $(ROOTDIR)/ldscripts
BOOTBLOCKDIR = $(ROOTDIR)/bootblocks
#BOOTBLOCK = $(BOOTBLOCKDIR)/US_BOOT.BIN
BOOTBLOCK = $(BOOTBLOCKDIR)/EU_BOOT.BIN
#BOOTBLOCK = $(BOOTBLOCKDIR)/JP_BOOT.BIN
LIBPATH = -L$(ROOTDIR)/m68k-elf/lib -L$(ROOTDIR)/m68k-elf/lib/gcc/m68k-elf/4.6.2 -L$(ROOTDIR)/m68k-elf/m68k-elf/lib
INCPATH = -I. -I../include -I$(ROOTDIR)/m68k-elf/include -I$(ROOTDIR)/m68k-elf/m68k-elf/include
CCFLAGS = -m68000 -Wall -O1 -c -fomit-frame-pointer
HWFLAGS = -m68000 -Wall -O1 -c -fomit-frame-pointer
LDFLAGS = -T $(LDSCRIPTSDIR)/cd.ld -Wl,-Map=output.map -nostdlib
ASFLAGS = -m68000 --register-prefix-optional
PREFIX = $(ROOTDIR)/m68k-elf/bin/m68k-elf-
CC = $(PREFIX)gcc
AS = $(PREFIX)as
LD = $(PREFIX)ld
OBJC = $(PREFIX)objcopy
ASMZ80 = $(ROOTDIR)/bin/zasm
FLAGSZ80 = -vb2
DD = dd
RM = rm -rf
TARGET = CDModPlayer
LIBS = $(LIBPATH) -lpcm -lc -lgcc -lnosys
OBJS = crt0.o main.o module.o cdfh.o hw_md.o
FILES =
all: $(TARGET).bin
$(TARGET).bin: $(TARGET).elf
$(OBJC) -O binary $< temp.bin
$(DD) if=temp.bin of=$@ bs=2048 conv=sync
$(TARGET).elf: $(OBJS) $(FILES)
$(CC) $(LDFLAGS) $(OBJS) $(LIBS) $(FILES) -o $(TARGET).elf
%.o80: %.s80
$(ASMZ80) $(FLAGSZ80) -o $@ $<
module.o: module.c
$(CC) $(HWFLAGS) -DPROC_PATTERNS $(INCPATH) $< -o $@
%.o: %.c
$(CC) $(CCFLAGS) $(INCPATH) $< -o $@
%.o: %.s
$(AS) $(ASFLAGS) $(INCPATH) $< -o $@
cd: $(TARGET).bin
mkdir -p cd
mkdir -p cd/MODs
cp $(TARGET).bin cd/APP.BIN
cp -r MODs/* cd/MODs/
genisoimage -sysid "SEGA SEGACD" -volid "CDMODPLAYER" -generic-boot $(BOOTBLOCK) -full-iso9660-filenames -o $(TARGET).iso cd
clean:
$(RM) *.o *.o80 *.bin *.elf *.map *.log *.iso cd