-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile.amini
78 lines (60 loc) · 2.89 KB
/
Makefile.amini
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
TARGET=rs97
CHAINPREFIX := /opt/rs97-toolchain
CROSS_COMPILE := $(CHAINPREFIX)/usr/bin/mipsel-linux-
BUILDTIME=$(shell date +'\"%Y-%m-%d %H:%M\"')
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
SYSROOT := $(shell $(CC) --print-sysroot)
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs --static)
CFLAGS = -ggdb -DTARGET_RS97 -DTARGET=$(TARGET) -DTARGET_ARCADEMINI -D__BUILDTIME__="$(BUILDTIME)" -DLOG_LEVEL=3 -g3 $(SDL_CFLAGS) -I$(CHAINPREFIX)/usr/include/ -I$(SYSROOT)/usr/include/ -I$(SYSROOT)/usr/include/SDL/ -mhard-float -mips32 -mno-mips16
# -fno-rtti
CFLAGS += -std=c++11 -fdata-sections -ffunction-sections -fno-exceptions -fno-math-errno -fno-threadsafe-statics -Os
CXXFLAGS = $(CFLAGS)
# LDFLAGS = $(SDL_LIBS) -lfreetype -lSDL_image -lSDL_ttf -lSDL_gfx -lSDL -lpthread
LDFLAGS = $(SDL_LIBS) -lfreetype -lSDL_image -lSDL_ttf -lSDL -lpthread
LDFLAGS +=-Wl,--as-needed -Wl,--gc-sections -s
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: dir shared
dir:
@if [ ! -d $(OBJDIR)/src ]; then mkdir -p $(OBJDIR)/src; fi
debug: $(OBJS)
@echo "Linking gmenu2x-debug..."
$(CXX) -o $(APPNAME)-debug $(LDFLAGS) $(OBJS)
shared: debug
$(STRIP) $(APPNAME)-debug -o $(APPNAME)
clean:
rm -rf $(OBJDIR) $(DISTDIR) *.gcda *.gcno $(APPNAME)
dist: dir shared
install -m755 -D $(APPNAME) $(DISTDIR)/gmenu2x
install -m644 assets/$(TARGET)/input.conf $(DISTDIR)
# install -m755 -d $(DISTDIR)/sections/applications $(DISTDIR)/sections/emulators $(DISTDIR)/sections/games $(DISTDIR)/sections/settings
install -m755 -d $(DISTDIR)/sections
install -m644 -D README.md $(DISTDIR)/README.txt
install -m644 -D COPYING $(DISTDIR)/COPYING
install -m644 -D ChangeLog.md $(DISTDIR)/ChangeLog
install -m644 -D about.txt $(DISTDIR)/about.txt
cp -RH assets/skins assets/translations $(DISTDIR)
# cp -RH assets/$(TARGET)/BlackJeans.png $(DISTDIR)/skins/Default/wallpapers
# cp -RH assets/$(TARGET)/skin.conf $(DISTDIR)/skins/Default
cp -RH assets/$(TARGET)/font.ttf $(DISTDIR)/skins/Default
# cp -RH assets/$(TARGET)/gmenu2x.conf $(DISTDIR)
#cp -RH assets/$(TARGET)/icons/* $(DISTDIR)/skins/Default/icons/
# cp -RH assets/$(TARGET)/emulators/* $(DISTDIR)/sections/emulators/
# cp -RH assets/$(TARGET)/games/* $(DISTDIR)/sections/games/
# cp -RH assets/$(TARGET)/applications/* $(DISTDIR)/sections/applications/
cd $(DISTDIR)/.. && zip -FSr GMenuNX.zip gmenu2x
-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 $@.$$$$