-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile.wiz
61 lines (48 loc) · 2.31 KB
/
Makefile.wiz
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
# Export a OPENWIZ environment variable pointing to the openwiz toolchain
CHAINPREFIX=$(OPENWIZ)
CROSS_COMPILE=$(CHAINPREFIX)/bin/arm-openwiz-linux-gnu-
TARGET=wiz
CC= $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
CFLAGS = -I"$(CHAINPREFIX)/include" `$(CHAINPREFIX)/bin/sdl-config --cflags` -DLOG_LEVEL=4 -DTARGET_WIZ -DTARGET=$(TARGET) -O3 -g -msoft-float -fomit-frame-pointer -ffast-math -funroll-loops -fno-exceptions -Wall -Wno-unknown-pragmas -Wno-format
CXXFLAGS = $(CFLAGS)
LDFLAGS = -L$(CHAINPREFIX)/lib -lSDL_image -lSDL_ttf -lfreetype -lSDL_gfx -ljpeg -lpng12 -lSDL -lz -ldl
OBJDIR = objs/$(TARGET)
DISTDIR = dist/$(TARGET)/gmenu2x
APPNAME = $(OBJDIR)/gmenu2x
SOURCES := $(wildcard src/*.cpp)
OBJS := $(patsubst src/%.cpp, $(OBJDIR)/src/%.o, $(SOURCES))
# File types rules
$(OBJDIR)/src/%.o: src/%.cpp src/%.h
$(CXX) $(CFLAGS) -o $@ -c $<
all: build
dir:
@if [ ! -d $(OBJDIR)/src ]; then mkdir -p $(OBJDIR)/src; fi
build: dir $(OBJS)
@echo "Linking gmenu2x-debug..."
$(CXX) -o $(APPNAME)-debug `$(CHAINPREFIX)/bin/sdl-config --libs` $(LDFLAGS) $(OBJS)
$(STRIP) $(APPNAME)-debug -o $(APPNAME)
clean:
rm -rf $(OBJDIR) $(DISTDIR) *.gcda *.gcno $(APPNAME)
dist: build
install -m755 -D $(APPNAME) $(DISTDIR)/gmenu2x
install -m755 -d $(DISTDIR)/sections/applications $(DISTDIR)/sections/emulators $(DISTDIR)/sections/games $(DISTDIR)/sections/settings
install -m644 -D README.md $(DISTDIR)/README.txt
install -m644 -D COPYING $(DISTDIR)/COPYING
install -m644 -D ChangeLog $(DISTDIR)/ChangeLog
cp -RH assets/skins assets/translations assets/$(TARGET)/* $(DISTDIR)
cp -H "$(CHAINPREFIX)/lib/libfreetype.so.6" $(DISTDIR)
cp -H "$(CHAINPREFIX)/lib/libSDL_ttf-2.0.so.0" $(DISTDIR)
cp -H "$(CHAINPREFIX)/lib/libSDL_gfx.so.13" $(DISTDIR)
cp -H "$(CHAINPREFIX)/lib/libjpeg.so.8" $(DISTDIR)
cp -H "$(CHAINPREFIX)/arm-openwiz-linux-gnu/sys-root/lib/libstdc++.so.6" $(DISTDIR)
cp -H "$(CHAINPREFIX)/arm-openwiz-linux-gnu/sys-root/lib/libgcc_s.so.1" $(DISTDIR)
mv $(DISTDIR)/autorun.gpu $(DISTDIR)/..
7z x -y -o$(DISTDIR) assets/$(TARGET)/ginge.7z
-include $(patsubst src/%.cpp, $(OBJDIR)/src/%.d, $(SOURCES))
$(OBJDIR)/src/%.d: src/%.cpp
@if [ ! -d $(OBJDIR)/src ]; then mkdir -p $(OBJDIR)/src; fi
$(CXX) -M $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$