forked from maccasoft/propeller-graphics-card
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (81 loc) · 2.16 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
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
TOOLCHAIN_HOME ?= /opt/parallax/bin/
TOOLCHAIN = $(TOOLCHAIN_HOME)propeller-elf-
CC = $(TOOLCHAIN)gcc
CXX = $(TOOLCHAIN)g++
LD = $(TOOLCHAIN)ld
AS = $(TOOLCHAIN)as
AR = $(TOOLCHAIN)ar
OBJCOPY = $(TOOLCHAIN)objcopy
LOADER = $(TOOLCHAIN_HOME)propeller-load
SPINC = $(TOOLCHAIN_HOME)openspin
NAME = firmware
MODEL = lmm
DEPDIR = .deps
PORT ?= /dev/ttyUSB0
DEFS = -DCOGS=6 -DMAX_SPRITES=32
CFLAGS = -Os -Wall -m32bit-doubles -fdata-sections -ffunction-sections $(DEFS)
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti -std=c++0x
ASFLAGS = -x assembler-with-cpp $(DEFS)
LDFLAGS = -fno-exceptions -fno-rtti
SPINFLAGS = -q -u
OBJS = \
main.o \
bus_interface.o \
video_mode_320x240.o \
ntsc_scanline_driver_320x224.o \
pal_scanline_driver_320x240.o \
vga_scanline_driver_320x240.o \
scanline_renderer_320x240.o \
video_mode_256x192.o \
ntsc_scanline_driver_256x192.o \
pal_scanline_driver_256x192.o \
vga_scanline_driver_256x192.o \
scanline_renderer_256x192.o \
video_mode_256x224.o \
ntsc_scanline_driver_256x224.o \
pal_scanline_driver_256x224.o \
vga_scanline_driver_256x224.o \
scanline_renderer_256x224.o \
bitmap_bus_interface_320x240.o \
bitmap_scanline_renderer_320x240.o \
bitmap_bus_interface_256x192.o \
bitmap_scanline_renderer_256x192.o \
bitmap_bus_interface_256x224.o \
bitmap_scanline_renderer_256x224.o
LIBS :=
all: $(NAME).elf
-include $(DEPDIR)/*.Po
$(NAME).elf: $(OBJS) Makefile
$(CXX) -m$(MODEL) $(LDFLAGS) -Wl,-Map=$@.map -o $@ $(OBJS) $(LIBS)
$(LOADER) -s $@
#
# default rules
#
%.o: %.cpp
@mkdir -p $(DEPDIR)/$(@D)
$(CXX) -m$(MODEL) $(CXXFLAGS) -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ -c $<
@mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
%.o: %.c
@mkdir -p $(DEPDIR)/$(@D)
$(CC) -m$(MODEL) $(CFLAGS) -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ -c $<
@mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
%.o: %.s
@mkdir -p $(DEPDIR)/$(@D)
$(CC) $(ASFLAGS) -MD -MP -MF $(DEPDIR)/$*.Tpo -o $@ -c $<
@mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
#
# cleanup
#
clean:
rm -f *.o *.d *.elf *.map *.a *.cog *.ecog *.binary
rm -rf $(DEPDIR)
#
# upload and run
#
run:
$(LOADER) -p $(PORT) -r $(NAME).elf
#
# upload, write to eeprom and run
#
burn:
$(LOADER) -p $(PORT) -e -r $(NAME).elf