-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (44 loc) · 1.03 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
#################
# Configuration #
#################
# Assembleur options
ASSEMBLER=wla-gb
LINKER=wlalink
AFLAGS=
LFLAGS=-d -v -s
#Emulator
EMULATOR=sameboy#vbam#visualboyadvance-m
EFLAGS=#-f 17
# Folders
SRC=src
BIN=bin
INCLUDE=src ##TODO : separate include from SRC (read wla doc)
INSTALL="/media/B009-9376/1 Game Boy/5 Team Rocket"
# Files
TARGET=rocket
SOURCE_FILES = \
main.s
##############
# Directives #
##############
OBJECT_FILES = $(SOURCE_FILES:%.s=$(BIN)/%.o)
TARGET_FILE = $(BIN)/$(TARGET).gb
LINK_FILE = $(BIN)/linkfile
all: clean directories $(TARGET_FILE)
run: all
$(EMULATOR) $(EFLAGS)$(TARGET_FILE)
install: all
cp $(TARGET_FILE) $(INSTALL)
clean:
rm -rf $(BIN)
directories:
@mkdir -p $(BIN)
.PHONY: build clean directories
$(TARGET_FILE): $(OBJECT_FILES) $(LINK_FILE)
echo "Building $(OBJECT_FILES)"
$(LINKER) $(LFLAGS) -r $(LINK_FILE) $(TARGET_FILE)
$(BIN)/%.o: $(SRC)/%.s
$(ASSEMBLER) $(AFLAGS) -I $(INCLUDE) -o $@ $<
$(LINK_FILE):
echo "[objects]" > $(LINK_FILE)
printf "%s\n" $(OBJECT_FILES) >> $(LINK_FILE)