-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
77 lines (64 loc) · 2.78 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
CXXFLAGS ?= -O3 -ffast-math -Wall
CXXFLAGS += -std=c++17 -march=x86-64 -fsigned-char
# install prefix, configurable by the user
PREFIX ?= /usr/local
# the DESTDIR variable is also used as an install prefix, but is meant to only be used by package builders for system images
#set appropriate library includes
CLIENT_INCLUDES= -Igame -Ienet/include `sdl2-config --cflags`
CLIENT_LIBS= -lprimis -Lenet -lenet -L. `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lz -lGL -lGLEW
#list of source code files to be compiled
CLIENT_OBJS= \
game/ai.o \
game/client.o \
game/cserver.o \
game/crypto.o \
game/edit.o \
game/entities.o \
game/game.o \
game/gameclient.o \
game/main.o \
game/minimap.o \
game/render.o \
game/scoreboard.o \
game/server.o \
game/serverbrowser.o \
game/sound.o \
game/waypoint.o \
game/waypointai.o \
game/weapon.o
default: client
install: client emplace
#cleanup build files and executable
clean:
-$(RM) -r $(CLIENT_OBJS) native_client
#remove all of the assets required to build, just leaves what is needed to run program
remove-build-files:
-$(RM) -r game/ vcpp/ bin64/ enet/ libprimis-headers/ .git/ .semaphore/ imprimis.bat .gitmodules Makefile
$(CLIENT_OBJS): CXXFLAGS += $(CLIENT_INCLUDES)
client: libenet $(CLIENT_OBJS)
$(CXX) $(CXXFLAGS) -o native_client $(CLIENT_OBJS) $(CLIENT_LIBS)
enet/libenet.a:
$(MAKE) -C enet
libenet: enet/libenet.a
emplace: uninstall # clean out installation locations to prevent pollution
# initialize installation directories (for minimal packager filesystems)
mkdir --parents $(DESTDIR)$(PREFIX)/bin/
mkdir --parents $(DESTDIR)$(PREFIX)/lib/
mkdir --parents $(DESTDIR)$(PREFIX)/share/applications/
mkdir --parents $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
mkdir --parents $(DESTDIR)$(PREFIX)/share/metainfo/
cp -R ./ $(DESTDIR)$(PREFIX)/lib/imprimis
# edit install dir, not source
cd $(DESTDIR)$(PREFIX)/lib/imprimis; \
rm -rf game/ vcpp/ bin64/ enet/ libprimis-headers/ .git/ .semaphore/ imprimis.bat .gitmodules Makefile; \
sed -i "s|=\.$$|=$(PREFIX)/lib/imprimis|" imprimis_unix; \
mv ./imprimis_unix $(DESTDIR)$(PREFIX)/bin/imprimis; \
mv ./media/interface/icon.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/org.imprimis.Imprimis.svg; \
mv ./org.imprimis.Imprimis.desktop $(DESTDIR)$(PREFIX)/share/applications/org.imprimis.Imprimis.desktop; \
mv ./org.imprimis.Imprimis.metainfo.xml $(DESTDIR)$(PREFIX)/share/metainfo/org.imprimis.Imprimis.metainfo.xml;
uninstall:
rm -rf $(DESTDIR)$(PREFIX)/lib/imprimis/ \
$(DESTDIR)$(PREFIX)/bin/imprimis \
$(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/org.imprimis.Imprimis.svg \
$(DESTDIR)$(PREFIX)/share/applications/org.imprimis.Imprimis.desktop \
$(DESTDIR)$(PREFIX)/share/metainfo/org.imprimis.Imprimis.metainfo.xml