-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
95 lines (81 loc) · 2.64 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
ifeq ($(PLATFORM), gcw0)
CC := /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
STRIP := /opt/gcw0-toolchain/usr/bin/mipsel-linux-strip
SYSROOT := $(shell $(CC) --print-sysroot)
CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
CFLAGS += -DNO_FRAMELIMIT -DSCREEN_SCALE=1 -DHOME_DIR
LDFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs) -lm
RELEASEDIR := release
endif
ifeq ($(PLATFORM), a320)
CC := /opt/opendingux-toolchain/usr/bin/mipsel-linux-gcc
STRIP := /opt/opendingux-toolchain/usr/bin/mipsel-linux-strip
SYSROOT := $(shell $(CC) --print-sysroot)
CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
CFLAGS += -DSCREEN_SCALE=1 -DHOME_DIR
LDFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs) -lm
TARGET := fever.dge
endif
ifeq ($(PLATFORM), rs90)
CC := /opt/rs90-toolchain/usr/bin/mipsel-linux-gcc
STRIP := /opt/rs90-toolchain/usr/bin/mipsel-linux-strip
SYSROOT := $(shell $(CC) --print-sysroot)
CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
CFLAGS += -DNO_FRAMELIMIT -DSCREEN_SCALE=1 -DSCREEN_SMALL=1 -DHOME_DIR
LDFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs) -lm
RELEASEDIR := release
endif
ifeq ($(PLATFORM), mingw32)
CC := i486-mingw32-gcc
STRIP := i486-mingw32-strip
SYSROOT := $(shell $(CC) --print-sysroot)
CFLAGS := -I/usr/i486-mingw32/include -I/usr/i486-mingw32/include/SDL
LDFLAGS := -lmingw32 -lSDLmain -lSDL -lm -mwindows
TARGET := fever.exe
endif
CC ?= gcc
STRIP ?= strip
CFLAGS ?= $(shell sdl-config --cflags) -DHOME_DIR
LDFLAGS ?= $(shell sdl-config --libs) -lm
TARGET ?= fever.elf
SRCDIR := src
OBJDIR := obj
SRC := $(wildcard $(SRCDIR)/*.c)
OBJ := $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
ifdef DEBUG
CFLAGS += -Wall -Wextra -Werror -ggdb -pedantic -std=gnu89 -DDEBUG
else
CFLAGS += -O2
endif
.PHONY: all opk clean
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
ifndef DEBUG
$(STRIP) $@
endif
$(OBJ): $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
$(CC) -c $(CFLAGS) $< -o $@
$(OBJDIR):
mkdir -p $@
opk: $(TARGET)
ifeq ($(PLATFORM), gcw0)
mkdir -p $(RELEASEDIR)
cp $(TARGET) $(RELEASEDIR)
cp -R data $(RELEASEDIR)
cp platform/gcw0/* $(RELEASEDIR)
cp LICENSE.txt $(RELEASEDIR)
cp README.md $(RELEASEDIR)
mksquashfs $(RELEASEDIR) homingFever.opk -all-root -noappend -no-exports -no-xattrs
endif
ifeq ($(PLATFORM), rs90)
mkdir -p $(RELEASEDIR)
cp $(TARGET) $(RELEASEDIR)
cp -R data $(RELEASEDIR)
cp platform/rs90/* $(RELEASEDIR)
cp LICENSE.txt $(RELEASEDIR)
cp README.md $(RELEASEDIR)
mksquashfs $(RELEASEDIR) homingFever.opk -all-root -noappend -no-exports -no-xattrs
endif
clean:
rm -Rf $(TARGET) $(OBJDIR) $(RELEASEDIR)