forked from deeice/gmenu2x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.zipit
61 lines (47 loc) · 2.46 KB
/
Makefile.zipit
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
TARGET=zipit
STAGING_DIR=/media/zipit/zipit/openwrt-zipit-new/staging_dir/target-arm_xscale_musl-1.1.14_eabi
TOOLCHAIN_DIR=/media/zipit/zipit/openwrt-zipit-new/staging_dir/toolchain-arm_xscale_gcc-5.3.0_musl-1.1.14_eabi/
CC = arm-openwrt-linux-gcc
CXX = arm-openwrt-linux-g++
#LD = g++
LD = arm-openwrt-linux-gcc
STRIP = arm-openwrt-linux-strip
#CFLAGS = -I"/usr/include" `sdl-config --cflags` -DTARGET_PC -DTARGET=$(TARGET) -DLOG_LEVEL=4 -Wall -Wundef -Wno-deprecated -Wno-unknown-pragmas -Wno-format -pg -O0 -g3
#CFLAGS = -I"/usr/include" `sdl-config --cflags` -DZIPIT_Z2 -DTARGET_Z2 -DTARGET=$(TARGET) -DLOG_LEVEL=4 -Wall -Wundef -Wno-deprecated -Wno-unknown-pragmas -Wno-format -O3 -g -fno-exceptions #-fno-rtti
CFLAGS = -I"$(STAGING_DIR)/usr/include" `$(STAGING_DIR)/host/bin/sdl-config --cflags` -DZIPIT_Z2 -DTARGET_Z2 -DTARGET=$(TARGET) -DLOG_LEVEL=0 -Wall -Wundef -Wno-deprecated -Wno-unknown-pragmas -Wno-format -O0 -g -s -fno-exceptions #-fno-rtti
CXXFLAGS = $(CFLAGS)
LDFLAGS = -L"$(STAGING_DIR)/usr/lib" `$(STAGING_DIR)/host/bin/sdl-config --libs` -lfreetype -lSDL_image -lSDL_ttf -lSDL_gfx -ljpeg -lpng12 -lz #-lSDL_gfx
#-L"$(TOOLCHAIN_DIR)/lib"
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..."
$(LD) -o $(APPNAME)-debug $(LDFLAGS) $(OBJS) $(TOOLCHAIN_DIR)/lib/libstdc++.a
# $(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)-debug $(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 -m644 -D README.rst $(DISTDIR)/README.txt
# install -m644 -D COPYING $(DISTDIR)/COPYING
# install -m644 -D ChangeLog $(DISTDIR)/ChangeLog
cp -R assets/$(TARGET)/* $(DISTDIR)
-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 $@.$$$$