forked from alekmaul/spout
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
76 lines (65 loc) · 1.81 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
# Define compilation type
OSTYPE?=msys
#OSTYPE=oda320
#OSTYPE=odgcw0
PRGNAME = spout-od
# define regarding OS, which compiler to use
ifeq "$(OSTYPE)" "msys"
EXESUFFIX = .exe
TOOLCHAIN = /c/MinGW32
CC = gcc
LD = gcc
else
ifeq "$(OSTYPE)" "oda320"
TOOLCHAIN = /opt/opendingux-toolchain/usr
EXESUFFIX = .dge
else
TOOLCHAIN = /opt/gcw0-toolchain/usr
endif
EXESUFFIX ?= .elf
CC = $(TOOLCHAIN)/bin/mipsel-linux-gcc
LD = $(TOOLCHAIN)/bin/mipsel-linux-gcc
endif
# add SDL dependencies
SDL_LIB = $(TOOLCHAIN)/lib
SDL_INCLUDE = $(TOOLCHAIN)/include
# change compilation / linking flag options
ifeq "$(OSTYPE)" "msys"
CFLAGS = -I$(SDL_INCLUDE) -O2
LDFLAGS = -L$(SDL_LIB) -L. -lmingw32 -lSDLmain -lSDL -mwindows
else
F_OPTS = -falign-functions -falign-loops -falign-labels -falign-jumps \
-ffast-math -fsingle-precision-constant -funsafe-math-optimizations \
-fomit-frame-pointer -fno-builtin -fno-common \
-fstrict-aliasing -fexpensive-optimizations \
-finline -finline-functions -fpeel-loops
ifeq "$(OSTYPE)" "oda320"
CC_OPTS = -O2 -mips32 -msoft-float -G0 $(F_OPTS)
else
CC_OPTS = -O2 -mips32 -mhard-float -G0 $(F_OPTS)
endif
CFLAGS = -I$(SDL_INCLUDE) -DOPENDINGUX $(CC_OPTS)
LDFLAGS = -L$(SDL_LIB) $(CC_OPTS) -lSDL
endif
# Files to be compiled
OBJS = spout.o piece.o
# Rules to make executable
$(PRGNAME)$(EXESUFFIX): $(OBJS)
ifeq "$(OSTYPE)" "msys"
$(LD) $(CFLAGS) -o $(PRGNAME)$(EXESUFFIX) $^ $(LDFLAGS)
else
$(LD) -s $(LDFLAGS) -o $(PRGNAME)$(EXESUFFIX) $^
endif
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
spout.o: piece.h font.h sintable.h
piece.c: piece.h
opk:
rm -rf opk_dir
cp -r opk_data opk_dir
cp $(PRGNAME)$(EXESUFFIX) opk_dir
mksquashfs opk_dir spout.opk -all-root -noappend -no-exports -no-xattrs
opkclean:
rm -rf opk_dir spout.opk
clean:
rm -f $(PRGNAME)$(EXESUFFIX) *.o