-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
84 lines (65 loc) · 1.94 KB
/
Makefile
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
78
79
80
81
82
83
84
DEBUG=0
FULLMENUTRANSPARANCY = 0
SRC_DIR = src
SRC_SUBDIR = games
OBJ_DIR = obj
DAT_DIR = retrotimefs
EXE=retrotime
SRC=$(wildcard $(SRC_DIR)/*.cpp $(foreach fd, $(SRC_SUBDIR), $(SRC_DIR)/$(fd)/*.cpp))
OBJS=$(SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
CXX ?= g++
SDL2CONFIG ?= sdl2-config
DEFINES ?=
DESTDIR ?=
PREFIX ?= /usr
OPT_LEVEL ?= -O2
CPPFLAGS ?= -Wall -Wextra -std=c++11 `$(SDL2CONFIG) --cflags`
LDFLAGS ?= -g
LDLIBS ?= `$(SDL2CONFIG) --libs` -lSDL2_image -lSDL2_ttf -lSDL2_mixer -lSDL2 -lSDL2_gfx -lstdc++
DEFINESADD =
ifneq ($(FULLMENUTRANSPARANCY), 0)
DEFINESADD += -DFULLMENUTRANSPARANCY
endif
FINALDEFINES = $(DEFINES) $(DEFINESADD)
ifeq ($(DEBUG), 1)
ifeq ($(OS),Windows_NT)
LDLIBS += -mconsole
endif
CPPFLAGS += -g
OPT_LEVEL =
endif
#MINGW does not have X11 and does not require it
#dont know about cygwin
ifneq ($(OS),Windows_NT)
ifeq ($(NOX11),)
LDLIBS += -lX11
endif
endif
GAMEDIR = $(DESTDIR)$(PREFIX)/games/retrotime
DESKTOPDIR = $(DESTDIR)$(PREFIX)/share/applications
ICONDIR = $(DESTDIR)$(PREFIX)/share/icons/
.PHONY: all clean
all: $(EXE)
$(EXE): $(OBJS)
$(CXX) $(OPT_LEVEL) $(LDFLAGS) $(TARGET_ARCH) $(FINALDEFINES) $^ $(LDLIBS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
$(CXX) $(OPT_LEVEL) $(CPPFLAGS) $(CXXFLAGS) $(FINALDEFINES) -c $< -o $@
$(OBJ_DIR): $(SRC_SUBDIR)
mkdir -p $@
$(SRC_SUBDIR):
mkdir -p $(OBJ_DIR)/$@
clean:
$(RM) -rv *~ $(OBJ_DIR) $(EXE)
install: all
install -d $(GAMEDIR)
install -d $(DESKTOPDIR)
install -d $(ICONDIR)
install -m 0755 $(EXE) $(GAMEDIR)
sed -i '6c\Exec=$(GAMEDIR)/$(EXE)' $(DAT_DIR)/data/io.github.joyrider3774.retrotime.desktop
install -m 0644 $(DAT_DIR)/data/io.github.joyrider3774.retrotime.desktop $(DESKTOPDIR)
install -m 0644 $(DAT_DIR)/data/io.github.joyrider3774.retrotime.svg $(ICONDIR)
\cp -rf $(DAT_DIR) $(GAMEDIR)
uninstall:
$(RM) -rf $(GAMEDIR)
$(RM) -f $(DESKTOPDIR)/io.github.joyrider3774.retrotime.desktop
$(RM) -f $(ICONDIR)/io.github.joyrider3774.retrotime.svg