-
Notifications
You must be signed in to change notification settings - Fork 2
/
ass_diskrules
79 lines (59 loc) · 1.98 KB
/
ass_diskrules
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
PATH := $(DEVKIT68K)/bin:$(PATH)
CROSS := m68k-elf-
CC := $(CROSS)gcc
AS := $(CROSS)gcc
LD := $(CROSS)gcc
OBJCOPY := $(CROSS)objcopy
IMG2ASS := python ../img2ass.py
HDMA2ASS := python ../hdma2ass.py
TILED2ASS := python ../tiled2ass.py
ASSFIX := python ../assfix.py
GRIT := grit.exe
export OFILES := $(SFILES:.s=.o) $(CFILES:.c=.o)
GFXall = $(GRAPHICS) $(GFXAPI) $(HDMA)
GFXtoclean := $(GFXall:.png=.c) $(GFXall:.png=.s) $(GFXall:.png=.o) $(TILED:.json=.s)
GRITFLAGS := -ftc -fh! -gu8
# --------------------------------------------------------------------
# OPTIONS
# --------------------------------------------------------------------
MAPFILE := $(TARGET).map
ARCH := -m68030
SPECS := -B ../devkit68K/m68k-elf/lib -specs=asspull-disk.specs
INCLUDE := # -I toolinclude
LIBPATHS :=
CFLAGS := $(INCLUDE) -Wall -Wextra -Os -fno-strict-aliasing -fomit-frame-pointer -fno-builtin $(ARCH)
ASFLAGS := -x assembler-with-cpp -c $(ARCH) -Wall
LDFLAGS := $(ARCH) $(SPECS) $(LIBPATHS) $(LIBS)
LDFLAGS += -Wl,-Map $(MAPFILE) -nostartfiles
# ---------------------------------------------------------------------
# RULES
# ---------------------------------------------------------------------
../_disk2_/$(TARGET).app : $(TARGET).elf
mkdir -p ../_disk2_
$(OBJCOPY) -O binary $< $@
# $(CROSS)objdump -d $(TARGET).elf > $(TARGET).txt
$(TARGET).elf : $(OFILES) $(AFILES) Makefile $(DEPENDFILE)
@echo > $(MAPFILE)
$(LD) -g -o $@ $(OFILES) $(AFILES) $(LDFLAGS)
.PHONY: all clean
all: clean $(TARGET).elf
clean:
rm -f $(OFILES) $(MAPFILE) $(TARGET).elf $(GFXtoclean) $(othercleans)
# ../_disk2_/$(TARGET).app
# --- ROM compilation ---
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
# --- Assembling ---
%.o : %.s
$(AS) $(ASFLAGS) -c $< -o $@
# --- Graphics ---
%.c : %.png %.grit
$(GRIT) $< $(GRITFLAGS) -ff
%.c : %.png
$(GRIT) $< $(GRITFLAGS) -ff dir.grit
$(GFXAPI:.png=.c) : %.c : %.png
$(IMG2ASS) $< $@
$(HDMA:.png=.s) : %.s : %.png
$(HDMA2ASS) $< $@
$(TILED:.json=.s) : %.s : %.json
$(TILED2ASS) $< $@