forked from Uzebox/uzebox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
172 lines (149 loc) · 4.29 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#
# Uzebox
#
# Build System by Filipe Rinaldi, 9 January 2010
# This build system will build the tools, demos and in the future a SDCard image.
# Type 'make help' to see the options
#
.DEFAULT_GOAL = all
MAKEFLAGS += --no-print-directory
######################################
# Tools
######################################
TOOLS += uzem
TOOLS += packrom
TOOLS += gconvert
TOOLS += bin2hex
TOOLS += mconvert
TOOLS += dconvert
# Builds out-of-the-box on Linux, OS X, and Windows
# but requires C++11 support, so you may need to
# upgrade to the latest version of MinGW on Windows
# if you are running a pre-2013 version.
TOOLS += midiconv
######################################
# Tools used to build demos
######################################
TOOLS_DEP += packrom
TOOLS_DEP += gconvert
TOOLS_DEP += mconvert
TOOLS_DEP += dconvert
######################################
# Demos
######################################
DEMOS += Arkanoid
DEMOS += Atomix
DEMOS += BitmapDemo
DEMOS += BootDemo
DEMOS += Bootloader
DEMOS += Bootloader5
DEMOS += chess4uzebox
DEMOS += ControllerTester
DEMOS += DrMario
DEMOS += GameOfLife
DEMOS += Maze
DEMOS += Megatris
DEMOS += MegaSokoban
DEMOS += Mode5Demo
DEMOS += Mode9Demo
DEMOS += Mode13ExtendedDemo
DEMOS += MusicDemo
DEMOS += LodeRunner
DEMOS += SDCardDemo
DEMOS += SPIRamMusicDemo
DEMOS += SpriteDemo
DEMOS += SuperMarioDemo
DEMOS += tutorial
DEMOS += unittest
DEMOS += Uzeamp
DEMOS += VectorDemo
DEMOS += VideoDemo
DEMOS += Whack-a-Mole
DEMOS += Zombienator
DEMOS += sdspiram
######################################
# Disabled
######################################
#DEMOS += Unittest Fix Makefile
######################################
# Tools
######################################
RM := rm -rf
CP := cp
MKDIR := mkdir
RMDIR := rmdir
######################################
# Directories
######################################
TOOLS_DIR := tools
DEMOS_DIR = demos
BIN_DIR := bin
ROMS_DIR := roms
######################################
# Handling options and flags
######################################
ifeq (clean,$(MAKECMDGOALS))
CLEAN := clean
endif
DEST_FLAG = DEST_DIR=$(shell pwd)/$(BIN_DIR)/
DEMO_FLAG = UZEBIN_DIR=$(shell pwd)/$(BIN_DIR)/
ALL_TARGETS_TOOLS = $(patsubst %,$(TOOLS_DIR)/%,$(TOOLS))
ALL_TARGETS_DEMOS = $(patsubst %,$(DEMOS_DIR)/%/default,$(DEMOS))
ALL_TARGETS = $(ALL_TARGETS_TOOLS) $(ALL_TARGETS_DEMOS)
ifeq ($(CLEAN),)
ALL_TARGETS_TOOLS_DEP = $(patsubst %,$(TOOLS_DIR)/%,$(TOOLS_DEP))
endif
UNAME := $(shell sh -c 'uname -s 2>/dev/null || echo not')
## Windows ###########################
ifneq (,$(findstring MINGW,$(UNAME)))
OS_EXTENSION = .exe
endif
######################################
# Rules
######################################
all: $(ALL_TARGETS)
.PHONY: demos
demos: $(ALL_TARGETS_DEMOS)
.PHONY: tools
tools: $(ALL_TARGETS_TOOLS)
.PHONY: $(ALL_TARGETS_TOOLS)
$(ALL_TARGETS_TOOLS):
$(shell [ -d $(BIN_DIR) ] || $(MKDIR) $(BIN_DIR))
$(MAKE) -C $@ $(CLEAN) $(DEST_FLAG)
.PHONY: $(ALL_TARGETS_DEMOS)
$(ALL_TARGETS_DEMOS): $(ALL_TARGETS_TOOLS_DEP)
$(shell [ -d $(ROMS_DIR) ] || $(MKDIR) $(ROMS_DIR))
@echo ===================================
@echo Building demo: $@
@echo ===================================
$(MAKE) -C $@ $(CLEAN) $(DEMO_FLAG)
ifeq ($(CLEAN),)
$(CP) $@/$(patsubst $(DEMOS_DIR)/%/default,%,$@).hex $(ROMS_DIR)
(test -e $@/$(patsubst $(DEMOS_DIR)/%/default,%,$@).uze && \
$(CP) $@/$(patsubst $(DEMOS_DIR)/%/default,%,$@).uze $(ROMS_DIR)) || echo
endif
clean: $(ALL_TARGETS)
$(RM) $(BIN_DIR)/*
$(RM) $(ROMS_DIR)/*
$(RMDIR) $(BIN_DIR)
$(RMDIR) $(ROMS_DIR)
.PHONY: help
help:
@echo
@echo ===================================
@echo Uzebox Build System - Help
@echo ===================================
@echo The targets available are:
@echo --------------------------
@echo \'make\' or \'make all\' - Build all tools and demos
@echo \'make tools\' - Build only the tools and copy them to \'bin\' directory
@echo \'make demos\' - Build only the demos and copy the iHex and UZE files to \'roms\' directory
@echo \'make clean\' - clean all the generated files
@echo \'make help\' - This help :-\)
@echo Flags:
@echo ------
@echo If the tools or demos can accept flags you can pass from the command line. E.g: \'make tools ARCH=i686\'
@echo Tips:
@echo -----
@echo If you have a multiprocessor system, use \'-j N\', e.g.: \'make release -j 3\'
@echo