forked from gameblabla/divi-dead
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.gcw0
57 lines (47 loc) · 1.72 KB
/
Makefile.gcw0
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
PRGNAME = dividead.elf
CC = /opt/gcw0-toolchain/usr/bin/mipsel-linux-gcc
CXX = /opt/gcw0-toolchain/usr/bin/mipsel-linux-g++
PORT = OPENDINGUX_JZ4770
VIDEO_FORMAT = MPEG
HUGE_PAGES = 0
GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
INCLUDES = -I. -Isrc -Isrc/smpeg -IRES
DEFINES = -DOPENDINGUX_JZ4770
DEFINES += -DDISABLE_MIDI -DALSA_SOUND
CFLAGS = -O2 -fdata-sections -ffunction-sections -flto -fno-common -Wall $(INCLUDES) $(DEFINES)
CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++98
ifeq ($(HUGE_PAGES), 0)
LDFLAGS =
endif
LDFLAGS += -lc -lgcc -ldl -lm -lSDL -lasound -lSDL_image -lpng -lSDL_mixer -lmikmod -logg -lvorbisidec -lmad -lSDL_ttf -lfreetype -lm -lbz2 -lstdc++ -lz -Wl,--as-needed -Wl,--gc-sections -flto -s
ifeq ($(HUGE_PAGES), 1)
LDFLAGS += -Wl,-zcommon-page-size=2097152 -Wl,-zmax-page-size=2097152 -lhugetlbfs
endif
# Files to be compiled
SRCDIR = ./src ./RES
ifeq ($(VIDEO_FORMAT), ROQ)
DEFINES += -DENABLE_VIDEO_ROQ
SRCDIR += ./src/roq
LDFLAGS += -lportaudio
else
DEFINES += -DENABLE_VIDEO_SMPEG
SRCDIR += ./src/smpeg ./src/smpeg/video ./src/smpeg/audio
endif
VPATH = $(SRCDIR)
SRC_C = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.c))
SRC_CPP = $(foreach dir, $(SRCDIR), $(wildcard $(dir)/*.cpp))
OBJ_C = $(notdir $(patsubst %.c, %.o, $(SRC_C)))
OBJ_CPP = $(notdir $(patsubst %.cpp, %.o, $(SRC_CPP)))
OBJS = $(OBJ_C) $(OBJ_CPP)
# Rules to make executable
$(PRGNAME): $(OBJS)
$(CC) $(CFLAGS) -std=gnu99 -o $(PRGNAME) $^ $(LDFLAGS)
ifeq ($(HUGE_PAGES), 1)
hugeedit --text --data $(PRGNAME)
endif
$(OBJ_CPP) : %.o : %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f $(PRGNAME) *.o
clean_all:
rm -f $(PRGNAME) *.o RES/*.c RES/*.CHARS RES/SPLASH.JPG RES/END/*.lz