-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile.pc
56 lines (41 loc) · 1.76 KB
/
Makefile.pc
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
TARGET=pc
BUILDTIME=$(shell date +'\"%Y-%m-%d %H:%M\"')
CC = gcc
CXX = g++
STRIP = strip
CFLAGS = -I"/usr/include" `sdl-config --cflags` -DTARGET_PC -DTARGET=$(TARGET) -D__BUILDTIME__="$(BUILDTIME)" -DLOG_LEVEL=4 -Wall -Wundef -Wno-deprecated -Wno-unknown-pragmas -Wno-format -pg -O0 -g -ggdb
CXXFLAGS = $(CFLAGS)
#LDFLAGS = -L"/usr/lib" `sdl-config --libs` -lfreetype -lSDL_image -lSDL_ttf -lSDL_gfx -ljpeg -lpng12 -lz
LDFLAGS = -L"/usr/lib" `sdl-config --libs` -lfreetype -lSDL_image -lSDL_ttf -ljpeg -lpng12 -lz
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)-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.md $(DISTDIR)/README.txt
install -m644 -D COPYING $(DISTDIR)/COPYING
install -m644 -D ChangeLog $(DISTDIR)/ChangeLog
cp -R assets/skins assets/translations $(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 $@.$$$$