-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·79 lines (60 loc) · 1.79 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
#PLATFORM?=native
PLATFORM?=dingux
# Compiler to use for each platform.
CC_native:=gcc
CC_dingux:=mipsel-linux-gcc
# Toolchain base directory for each platform.
TOOLCHAIN_native:=
TOOLCHAIN_dingux:=
# Executable file extension for each platform.
EXEEXT_native:=
EXEEXT_dingux:=.dge
# Tile size for each platform.
# Use size 24 for 320x240 and size 48 for 640x480.
RES_native:=48
RES_dingux:=24
# Pick the definitions for the active platform.
CC:=$(CC_$(PLATFORM))
TOOLCHAIN:=$(TOOLCHAIN_$(PLATFORM))
EXEEXT:=$(EXEEXT_$(PLATFORM))
RES:=$(RES_$(PLATFORM))
CFLAGS:=-O2 -g -Wall -Wextra -Wundef -Wunused-macros
LDFLAGS:=
SDL_CONFIG:=sdl-config
CFLAGS+=$(shell $(SDL_CONFIG) --cflags)
LDFLAGS+=$(shell $(SDL_CONFIG) --libs)
LDFLAGS+=-lSDL_mixer
#LDFLAGS+=-lgcov --coverage
CFLAGS+=-DTILE_SIZE=$(RES)
#CFLAGS+=-fprofile-generate=/home/retrofw/profile
CFLAGS+=-fprofile-use -fprofile-dir=profile
OUTDIR:=output/$(PLATFORM)
SOURCES:=$(wildcard src/*.c)
OBJS:=$(patsubst src/%.c,$(OUTDIR)/obj/%.o,$(SOURCES))
BINARY:=$(OUTDIR)/dist/drill$(EXEEXT)
.PHONY: all dist run clean
all: $(BINARY)
clean:
rm -rf $(OUTDIR)
dist: $(BINARY)
mkdir -p $(OUTDIR)/dist/susumi
mkdir -p $(OUTDIR)/dist/system/bmp
mkdir -p $(OUTDIR)/dist/system/wav
cp dat/* $(OUTDIR)/dist
cp gfx/icon.png $(OUTDIR)/dist
cp gfx/blockbg.txt gfx/charabg.txt gfx/otherbg.txt $(OUTDIR)/dist
cp gfx/player.txt $(OUTDIR)/dist/susumi
cp gfx/*.bmp $(OUTDIR)/dist
cp gfx/susumi-$(RES)/*.bmp $(OUTDIR)/dist/susumi
cp gfx/system-$(RES)/*.bmp $(OUTDIR)/dist/system/bmp
cp snd/*.txt $(OUTDIR)/dist
cp snd/wav/*wav $(OUTDIR)/dist/system/wav
sh package $(OUTDIR)
run: dist
cd $(OUTDIR)/dist && ./drill$(EXEEXT)
$(OBJS): $(OUTDIR)/obj/%.o: src/%.c
mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
$(BINARY): $(OBJS)
mkdir -p $(@D)
$(CC) -o $@ $^ $(LDFLAGS)