-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (81 loc) · 2.6 KB
/
Makefile
File metadata and controls
108 lines (81 loc) · 2.6 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
CC = m68k-elf-gcc
AS = m68k-elf-as
OBJC = m68k-elf-objcopy
LD = m68k-elf-ld
RM = rm -f
ASMZ80 = zasm
BINTOS = bintos
RESCOMP= rescomp
ECHO = printf
OPTION = -O1 -std=c99 -Wall -fdiagnostics-color=auto
INCS = -I$(GENDEV)/m68k-elf/include -I$(GENDEV)/m68k-elf/m68k-elf/include -Isrc -Ires -Iinc -Iinc/objects -Iinc/system
CCFLAGS = $(OPTION) -m68000 -c -fomit-frame-pointer -fno-builtin -Wno-overflow -pedantic
Z80FLAGS = -vb2 -Isrc/system/
ASFLAGS = -m68000 --register-prefix-optional
LIBS = -L$(GENDEV)/m68k-elf/lib -L$(GENDEV)/m68k-elf/lib/gcc/m68k-elf/* -L$(GENDEV)/m68k-elf/m68k-elf/lib -lmd -lnosys -lgcc
LINKFLAGS = -T $(GENDEV)/ldscripts/sgdk.ld -nostdlib
ARCHIVES = $(GENDEV)/m68k-elf/lib/libmd.a $(GENDEV)/m68k-elf/lib/gcc/m68k-elf/*/libgcc.a
RESOURCES=
BOOT_RESOURCES=
BOOTSS=$(wildcard src/system/boot/*.s)
BOOT_RESOURCES+=$(BOOTSS:.s=.o)
RESS=$(wildcard res/*.res)
RESOURCES+=$(RESS:.res=.o)
CS=$(wildcard src/*.c) $(wildcard src/*/*.c)
SS=$(wildcard src/*.s) $(wildcard src/*/*.s)
S80S=$(wildcard src/*.s80) $(wildcard src/*/*.s80)
SS+=$(wildcard *.s)
S80S+=$(wildcard *.s80)
RESOURCES+=$(CS:.c=.o)
RESOURCES+=$(SS:.s=.o)
RESOURCES+=$(S80S:.s80=.o)
OBJS = $(RESOURCES)
.PHONY: all clean
all: lyle.bin
gens: lyle.bin
@exec gens $< 2> /dev/null
regen: lyle.bin
@exec wine ./util/regen/Regen.exe ../../lyle.bin
kmod: lyle.bin
@exec wine ./util/kmod/gens.exe lyle.bin
umdk: lyle.bin
@exec util/umdkv2-bin/loader -w $<:0 -x 2
fusion: lyle.bin
@exec util/Fusion $< 2> /dev/null
test: lyle.bin
@exec util/megaloader/megaloader md $< /dev/ttyUSB0 2> /dev/null
test32: lyle.bin
@exec util/megaloader/mega32 md $< /dev/ttyUSB0 2> /dev/null
src/system/boot/sega.o: src/system/boot/rom_head.bin
@$(AS) $(ASFLAGS) src/system/boot/sega.s -o $@
%.bin: %.elf
@$(OBJC) -O binary $< temp.bin
@bash -c '$(ECHO) "\e[32m"'
@dd if=temp.bin of=$@ bs=8k conv=sync
@rm temp.bin
@bash -c '$(ECHO) "\e[0m"'
%.elf: $(OBJS) $(BOOT_RESOURCES)
@$(CC) -n -o $@ $(LINKFLAGS) $(BOOT_RESOURCES) $(ARCHIVES) $(OBJS) $(LIBS)
%.o80: %.s80
@$(ASMZ80) $(Z80FLAGS) -o $@ $<
%.c: %.o80
@$(BINTOS) $<
%.o: %.c
@bash -c '$(ECHO) "\t\e[96m[ CC ]\e[0m $<\n"'
@$(CC) $(CCFLAGS) $(INCS) -c $< -o $@
%.o: %.s
@bash -c '$(ECHO) "\t\e[94m[ AS ]\e[0m $<\n"'
@$(AS) $(ASFLAGS) $< -o $@
%.s: %.esf
@$(BINTOS) -align 32768 $<
%.s: %.eif
@$(BINTOS) -align 256 $<
%.s: %.res
@ $(RESCOMP) $< $@ > /dev/null
src/system/boot/rom_head.bin: src/system/boot/rom_head.o
@$(LD) $(LINKFLAGS) --oformat binary -o $@ $<
clean:
@$(RM) $(RESOURCES)
@$(RM) *.o *.bin *.elf *.map
@$(RM) src/system/boot/*.o src/system/boot/*.bin
@$(RM) $(RESS:.res=.h) $(RESS:.res=.s)