-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.gcw0
78 lines (61 loc) · 2.56 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
CHAINPREFIX=/opt/gcw0-toolchain
TARGET=gcw0
DEBUG=0
ifeq ($(DEBUG),0)
CROSS_COMPILE=$(CHAINPREFIX)/usr/bin/mipsel-linux-
endif
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
STRIP = $(CROSS_COMPILE)strip
SYSROOT := $(CHAINPREFIX)/usr/mipsel-buildroot-linux-uclibc/sysroot
SDL_CFLAGS := $(shell $(SYSROOT)/usr/bin/sdl-config --cflags)
SDL_LIBS := $(shell $(SYSROOT)/usr/bin/sdl-config --libs)
CFLAGS = -ggdb -DTARGET_GCW0 -DTARGET=$(TARGET) -DLOG_LEVEL=3 -g3 $(SDL_CFLAGS) -I$(CHAINPREFIX)/usr/include/ -I$(SYSROOT)/usr/include/ -I$(SYSROOT)/usr/include/SDL/
CXXFLAGS = $(CFLAGS)
LDFLAGS = $(SDL_LIBS) -lfreetype -lSDL_image -lSDL_ttf -lSDL_gfx -lSDL -lpthread
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)
# $(LDFLAGS)
shared: debug
$(STRIP) $(APPNAME)-debug -o $(APPNAME)
clean:
rm -rf $(OBJDIR) $(DISTDIR) *.gcda *.gcno $(APPNAME)
dist: dir shared
install -m755 -D $(APPNAME) $(DISTDIR)/gmenu2x
ifeq ($(DEBUG),0)
install -m644 assets/$(TARGET)/input.conf $(DISTDIR)
else
install -m644 assets/pc/input.conf $(DISTDIR)
endif
# 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 $(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 -r ../GMenuNext.zip .
-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 $@.$$$$