forked from Nebuleon/hocoslamfy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
86 lines (68 loc) · 2.37 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
TARGET ?= hocoslamfy
ifeq ($(TARGET), hocoslamfy-od)
CC := mipsel-linux-gcc
STRIP := mipsel-linux-strip
OBJS = platform/opendingux.o
DEFS := -DOPK
DEVICE := gcw0
else
ifeq ($(TARGET), hocoslamfy-rs90)
CC := /opt/rs90-toolchain/bin/mipsel-rs90-linux-musl-gcc
STRIP := /opt/rs90-toolchain/bin/mipsel-rs90-linux-musl-strip
OBJS = platform/opendingux.o
DEFS := -DOPK -DSCREEN_WIDTH=240 -DSCREEN_HEIGHT=160 -DSCREEN_BPP=16
DEVICE := rs90
else
ifeq ($(TARGET), hocoslamfy)
CC := gcc
STRIP := strip
OBJS = platform/general.o
DEFS :=
else
$(error Unknown target: $(TARGET))
endif
endif
endif
SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CONFIG ?= $(SYSROOT)/usr/bin/sdl-config
SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
OBJS += main.o init.o title.o game.o score.o audio.o bg.o text.o unifont.o
HEADERS += main.h init.h platform.h title.h game.h score.h audio.h bg.h text.h unifont.h
INCLUDE := -I.
DEFS +=
CFLAGS = $(SDL_CFLAGS) -Wall -Wno-unused-variable \
-O2 -fomit-frame-pointer $(DEFS) $(INCLUDE)
LDFLAGS := $(SDL_LIBS) -lm -lSDL_image -lSDL_mixer
ifneq (, $(findstring MINGW, $(shell uname -s)))
CFLAGS+=-DDONT_USE_PWD
endif
WAVS := $(wildcard sound/*.wav)
OGGS := $(WAVS:sound/%.wav=data/%.ogg)
DATA_TO_CLEAN := $(OGGS)
.PHONY: all opk
all: $(TARGET) $(OGGS)
include Makefile.rules
$(OGGS): data/%.ogg: sound/%.wav
$(SUM) " OGG $@"
$(CMD)oggenc --resample 44100 -q2 $< -o $@
opk: $(TARGET).opk
$(TARGET).opk: $(TARGET) $(OGGS)
$(SUM) " OPK $@"
$(CMD)rm -rf .opk_data
$(CMD)mkdir -p .opk_data
$(CMD)cp data/default.$(DEVICE).desktop .opk_data/
$(CMD)cp data/*.png .opk_data/
$(CMD)cp $(OGGS) .opk_data/
$(CMD)cp data/*.txt .opk_data/
$(CMD)cp COPYRIGHT .opk_data/COPYRIGHT
$(CMD)cp $< .opk_data/$(TARGET)
$(CMD)$(STRIP) .opk_data/$(TARGET)
$(CMD)mksquashfs .opk_data $@ -all-root -noappend -no-exports -no-xattrs -no-progress >/dev/null
# The two below declarations ensure that editing a .c file recompiles only that
# file, but editing a .h file recompiles everything.
# Courtesy of Maarten ter Huurne.
# Each object file depends on its corresponding source file.
$(C_OBJS): %.o: %.c
# Object files all depend on all the headers.
$(OBJS): $(HEADERS)