-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
164 lines (149 loc) · 5.53 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# David Joffe
# Copyright 1998-2024 David Joffe
# Created 1998/12
# Makefile for Dave Gnukem
#
# 2016-10: Get this working on Mac OS X [dj]
# 2017-07-29: Remove obsolete standalone-editor-related stuff, and add new thing_monsters.o
# 2022-11-25: Cleanup and fix targets for new debian dir (dist, install and uninstall)
#
BIN = davegnukem
# 'version string history' here:
# "v1.0 - 3 Apr 2018" [version 1]
# "v1.0.1 - 25 Apr 2020"
# "v1.0.2 - 19 Nov 2022" [<- last version on SDL1 - about to update to SDL2]
# "v1.0.3 - 19 Nov 2022" [New version number for SDL2 version with Matteo Bini SDL2 commit merged in] (1.0.3-dev, working towards official new 1.0.3 stable)
# "v1.0.3 - 29 Nov 2022" First official stable version with Matteo Bini's updates to SDL2, and new improved Debian packaging files by Matteo Bini
V_NUM = 1.0.3
V_DATE = 29 Nov 2022
VERSION = v$(V_NUM) - $(V_DATE)
# paths
PREFIX = /usr/local
BIN_DIR = $(PREFIX)/games
DATA_DIR = $(PREFIX)/share/games/$(BIN)/# the trailing slash is required for paths in the source
LIBS = `sdl2-config --libs` -lSDL2_mixer
LDFLAGS_DAVEGNUKEM = $(LIBS) $(LDFLAGS)
CPPFLAGS_DAVEGNUKEM = -DDATA_DIR=\"$(DATA_DIR)\" -DVERSION=\"'$(VERSION)'\" $(CPPFLAGS)
OBJ = src/block.o \
src/bullet.o \
src/console.o \
src/credits.o \
src/datadir.o \
src/djfile.o \
src/djfonts.o \
src/djimageload.o \
src/djimage.o \
src/djlang.o \
src/djlog.o \
src/djsprite.o \
src/djstring.o \
src/djtypes.o \
src/djutf8.o \
src/ed_common.o \
src/ed_DrawBoxContents.o \
src/ed_lvled.o \
src/ed_macros.o \
src/ed.o \
src/ed_spred.o \
src/effect_viewportshadow.o \
src/gameending.o \
src/game.o \
src/graph.o \
src/hero.o \
src/hiscores.o \
src/instructions.o \
src/inventory.o \
src/keys.o \
src/level.o \
src/loadedlevel.o \
src/localization/djgettext.o \
src/mainmenu.o \
src/main.o \
src/menu.o \
src/mission.o \
src/mixins.o \
src/m_misc.o \
src/sdl/djgraph.o \
src/sdl/djinput.o \
src/sdl/djsound.o \
src/sdl/djtime.o \
src/settings.o \
src/sys_error.o \
src/sys_log.o \
src/thing_monsters.o \
src/thing.o \
src/win32/dpiscaling.o \
src/win32/winmain.o \
# debug
#CXXFLAGS_DAVEGNUKEM = -ggdb -DDEBUG -std=c++14 -Wall `sdl2-config --cflags` $(CPPFLAGS_DAVEGNUKEM) $(CXXFLAGS)
CXXFLAGS_DAVEGNUKEM = -Os -std=c++14 -Wall `sdl2-config --cflags` $(CPPFLAGS_DAVEGNUKEM) $(CXXFLAGS)
all: options davegnukem
options:
@echo davegnukem build options:
@echo "CXXFLAGS = $(CXXFLAGS_DAVEGNUKEM)"
@echo "LDFLAGS = $(LDFLAGS_DAVEGNUKEM)"
@echo "CXX = $(CXX)"
%.o: %.cpp
$(CXX) $(CXXFLAGS_DAVEGNUKEM) -c $< -o $@
davegnukem: $(OBJ)
$(CXX) -o $(BIN) $(OBJ) $(LDFLAGS_DAVEGNUKEM)
clean:
rm -f $(BIN) $(BIN)-$(V_NUM).tar.gz
find src -name '*.o' | xargs rm -f
dist: clean
mkdir $(BIN)-$(V_NUM)
ls | sed '/data/d; /$(BIN)-$(V_NUM)/d' | xargs -I {} cp -R {} $(BIN)-$(V_NUM)
tar cf $(BIN)-$(V_NUM).tar $(BIN)-$(V_NUM)
gzip $(BIN)-$(V_NUM).tar
rm -fr $(BIN)-$(V_NUM)
install:
# appstream file
mkdir -p $(DESTDIR)$(PREFIX)/share/metainfo
cp -f debian/appstream/com.djoffe.$(BIN).metainfo.xml $(DESTDIR)$(PREFIX)/share/metainfo
chmod 644 $(DESTDIR)$(PREFIX)/share/metainfo/com.djoffe.$(BIN).metainfo.xml
# binary
mkdir -p $(DESTDIR)$(BIN_DIR)
cp -f $(BIN) $(DESTDIR)$(BIN_DIR)
chmod 755 $(DESTDIR)$(BIN_DIR)/$(BIN)
# data
mkdir -p $(DESTDIR)$(DATA_DIR)
cp -fR data/* $(DESTDIR)$(DATA_DIR)
rm -f $(DESTDIR)$(DATA_DIR)README.md
find $(DESTDIR)$(DATA_DIR) -type d | xargs chmod 755
find $(DESTDIR)$(DATA_DIR) -type f | xargs chmod 644
# data doc
mkdir -p $(DESTDIR)$(PREFIX)/share/doc/$(BIN)-data
cp -f data/README.md $(DESTDIR)$(PREFIX)/share/doc/$(BIN)-data
chmod 644 $(DESTDIR)$(PREFIX)/share/doc/$(BIN)-data/README.md
# desktop file
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
cp -f debian/desktop/$(BIN).desktop $(DESTDIR)$(PREFIX)/share/applications
chmod 644 $(DESTDIR)$(PREFIX)/share/applications/$(BIN).desktop
# doc
mkdir -p $(DESTDIR)$(PREFIX)/share/doc/$(BIN)
cp -f HISTORY.txt README.md $(DESTDIR)$(PREFIX)/share/doc/$(BIN)
chmod 644 $(DESTDIR)$(PREFIX)/share/doc/$(BIN)/HISTORY.txt \
$(DESTDIR)$(PREFIX)/share/doc/$(BIN)/README.md
# icons
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps
cp -f debian/icons/hicolor/32x32/apps/$(BIN).png $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps
chmod 644 $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/$(BIN).png
mkdir -p $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps
cp -f debian/icons/hicolor/128x128/apps/$(BIN).png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps
chmod 644 $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/$(BIN).png
# manual page
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man6
sed 's/VERSION/$(VERSION)/' < debian/$(BIN).6 > $(DESTDIR)$(PREFIX)/share/man/man6/$(BIN).6
chmod 644 $(DESTDIR)$(PREFIX)/share/man/man6/$(BIN).6
uninstall:
rm -f $(DESTDIR)$(PREFIX)/share/metainfo/com.djoffe.$(BIN).metainfo.xml
rm -f $(DESTDIR)$(BIN_DIR)/$(BIN)
rm -fr $(DESTDIR)$(DATA_DIR)
rm -fr $(DESTDIR)$(PREFIX)/share/doc/$(BIN)-data
rm -f $(DESTDIR)$(PREFIX)/share/applications/$(BIN).desktop
rm -fr $(DESTDIR)$(PREFIX)/share/doc/$(BIN)
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/32x32/apps/$(BIN).png
rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/$(BIN).png
rm -f $(DESTDIR)$(PREFIX)/share/man/man6/$(BIN).6
.PHONY: all options clean dist install uninstall