forked from raduprv/Eternal-Lands
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.linux
218 lines (185 loc) · 8.67 KB
/
Makefile.linux
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.PHONY: clean release docs
-include make.conf
TTF_CFLAGS = $(shell pkg-config SDL2_ttf --cflags)
USE_SSL_CFLAGS = $(shell pkg-config openssl --cflags)
JSON_FILES_CFLAGS = -I nlohmann_json/single_include/
ADDRSANITISER_CFLAGS=-fsanitize=address
PNG_SCREENSHOT_LIBS = $(shell pkg-config libpng --libs)
TTF_LIBS = $(shell pkg-config SDL2_ttf --libs)
USE_SSL_LIBS = $(shell pkg-config openssl --libs)
ADDRSANITISER_LIBS=-fsanitize=address
PAWN_LIBS = -ldl
PAWN_DEPS_DIR = .deps/pawn
OPTIONS = -DLINUX -DELC $(foreach FEATURE, $(FEATURES), -D$(FEATURE)) -D_7ZIP_ST $(GIT_VERSION) \
$(shell pkg-config sdl2 --cflags) \
$(shell pkg-config SDL2_net --cflags) \
$(shell pkg-config SDL2_image --cflags) \
$(shell pkg-config libxml-2.0 --cflags) \
$(shell pkg-config cal3d --cflags) \
$(shell pkg-config gl --cflags) \
$(shell pkg-config glu --cflags) \
$(shell pkg-config openal --cflags) \
$(shell pkg-config vorbis --cflags) \
$(shell pkg-config vorbisfile --cflags) \
$(shell pkg-config zlib --cflags) \
$(foreach FEATURE, $(FEATURES), $($(FEATURE)_CFLAGS))
CFLAGS=$(PLATFORM) $(CWARN) -O1 -ggdb -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES)
CXXFLAGS=$(PLATFORM) $(CXXWARN) -O1 -ggdb -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES)
LDFLAGS=$(shell pkg-config sdl2 --libs) \
$(shell pkg-config libxml-2.0 --libs) \
$(shell pkg-config SDL2_net --libs) \
$(shell pkg-config SDL2_image --libs) \
$(shell pkg-config cal3d --libs) \
$(shell pkg-config gl --libs) \
$(shell pkg-config glu --libs) \
$(shell pkg-config openal --libs) \
$(shell pkg-config vorbis --libs) \
$(shell pkg-config vorbisfile --libs) \
$(shell pkg-config zlib --libs) \
$(foreach FEATURE, $(FEATURES), $($(FEATURE)_LIBS)) \
$(shell pkg-config x11 --libs) -lm -lstdc++
_CFLAGS=$(PLATFORM) -O2 -fomit-frame-pointer -ffast-math -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES)
_LDFLAGS=$(XDIR) -lGL -lpthread -lstdc++
_CXXFLAGS=$(PLATFORM) -O3 -fomit-frame-pointer -ffast-math -pipe $(OPTIONS) -fno-strict-aliasing $(EXTRA_INCLUDES)
# This works on Ubuntu 8.04 (LTS) at least
# Install these packages in addition to those required for a standard build
# libasound2-dev libaudio-dev libartsc0-dev libesd0-dev libpulse-dev libaa1-dev libgpmg1-dev libdirectfb-dev
LIBD=/usr/lib
STATICLIBS=$(LIBD)/libSDL_net.a $(LIBD)/libSDL.a $(LIBD)/libSDL_image.a $(LIBD)/libopenal.a $(LIBD)/libvorbisfile.a $(LIBD)/libvorbis.a $(LIBD)/libogg.a $(LIBD)/libxml2.a $(LIBD)/libcal3d.a $(LIBD)/libpng.a $(LIBD)/libasound.a $(LIBD)/libaudio.a $(LIBD)/libartsc.a $(LIBD)/libesd.a $(LIBD)/libpulse-simple.a $(LIBD)/libpulse.a $(LIBD)/libaa.a $(LIBD)/libgpm.a $(LIBD)/libcurses.a $(LIBD)/libslang.a $(LIBD)/libdirectfb.a $(LIBD)/libdirect.a $(LIBD)/libfusion.a $(LIBD)/librt.a $(LIBD)/libtiff.a $(LIBD)/libjpeg.a $(LIBD)/libGLU.a $(LIBD)/libz.a
# the objects we need
ENCYCLOPEDIA_COBJ = books/fontdef.o books/parser.o books/symbol.o books/typesetter.o sort.o symbol_table.o
MEMORY_DEBUG_COBJ = elmemory.o
PAWN_COBJ = pawn/amx.o pawn/amxaux.o pawn/amxcons.o pawn/amxel.o \
pawn/amxfloat.o pawn/amxstring.o pawn/elpawn.o
CUSTOM_UPDATE_COBJ = custom_update.o new_update.o
FSAA_COBJ = fsaa/fsaa_glx.o fsaa/fsaa.o
PACKET_COMPRESSION_COBJ = ext_protocol_shared.o
COBJS=2d_objects.o 3d_objects.o \
actor_scripts.o actors.o alphamap.o asc.o astrology.o \
bbox_tree.o buddy.o buffs.o bags.o \
cache.o cal.o calc.o chat.o cluster.o colors.o console.o consolewin.o \
counters.o cursors.o dds.o ddsimage.o dialogues.o draw_scene.o eye_candy_debugwin.o \
el_memory.o elconfig.o elwindows.o encyclopedia.o errors.o events.o \
filter.o framebuffer.o frustum.o gamewin.o gl_init.o \
hud.o hud_misc_window.o hud_quickbar_window.o hud_statsbar_window.o hud_quickspells_window.o \
help.o highlight.o ignore.o image_loading.o init.o interface.o items.o io/fileutil.o \
io/e3d_io.o io/elc_io.o io/map_io.o io/elpathwrapper.o io/xmlcallbacks.o \
io/half.o io/normal.o io/elfilewrapper.o io/unzip.o io/ioapi.o io/zip.o io/ziputil.o \
keys.o knowledge.o langselwin.o lights.o list.o load_gl_extensions.o loginwin.o loading_win.o \
main.o manufacture.o map.o mapwin.o \
md5.o mines.o minimap.o misc.o missiles.o multiplayer.o \
new_actors.o new_character.o notepad.o \
openingwin.o image.o \
shader/noise.o shader/shader.o text_aliases.o \
particles.o paste.o pathfinder.o pm_log.o \
queue.o reflection.o rules.o sky.o \
skeletons.o skills.o serverpopup.o servers.o session.o shadows.o sound.o \
spells.o stats.o storage.o special_effects.o \
tabs.o text.o textures.o tile_map.o timers.o translate.o trade.o \
update.o url.o weather.o widgets.o makeargv.o popup.o hash.o emotes.o \
xz/7zCrc.o xz/7zCrcOpt.o xz/Alloc.o xz/Bra86.o xz/Bra.o xz/BraIA64.o \
xz/CpuArch.o xz/Delta.o xz/LzFind.o xz/Lzma2Dec.o xz/Lzma2Enc.o \
xz/LzmaDec.o xz/LzmaEnc.o xz/Sha256.o xz/Xz.o xz/XzCrc64.o xz/XzDec.o \
xz/XzEnc.o \
$(foreach FEATURE, $(FEATURES), $($(FEATURE)_COBJ))
JSON_FILES_CXXOBJ = json_io.o
USE_SSL_CXXOBJ = connection.o ipaddress.o socket.o
CXXOBJS=achievements.o actor_init.o books.o cal3d_wrapper.o command_queue.o \
context_menu.o cppwindows.o elloggingwrapper.o engine/logging.o exceptions/extendedexception.o \
font.o hud_indicators.o hud_timer.o icon_window.o io/cal3d_io_wrapper.o item_info.o item_lists.o \
named_colours.o password_manager.o optimizer.o quest_log.o select.o \
sendvideoinfo.o textpopup.o trade_log.o user_menus.o xml/xmlhelper.o eye_candy_wrapper.o \
engine/hardwarebuffer.o xor_cipher.o \
eye_candy/eye_candy.o eye_candy/math_cache.o eye_candy/effect_lamp.o \
eye_candy/effect_candle.o \
eye_candy/effect_campfire.o eye_candy/effect_fountain.o \
eye_candy/effect_teleporter.o eye_candy/effect_firefly.o \
eye_candy/effect_sword.o eye_candy/effect_summon.o \
eye_candy/effect_selfmagic.o eye_candy/effect_targetmagic.o \
eye_candy/effect_ongoing.o eye_candy/effect_impact.o \
eye_candy/effect_smoke.o eye_candy/effect_bag.o eye_candy/effect_cloud.o \
eye_candy/effect_harvesting.o eye_candy/effect_wind.o \
eye_candy/effect_breath.o eye_candy/effect_glow.o \
eye_candy/effect_mines.o eye_candy/effect_missile.o \
eye_candy/orbital_mover.o eye_candy/kepler_orbit.o \
eye_candy/effect_staff.o \
$(foreach FEATURE, $(FEATURES), $($(FEATURE)_CXXOBJ))
OBJS=$(COBJS) $(CXXOBJS)
HEADER_DIRS = . books eye_candy io pawn fsaa engine xz
DEP_FILES=$(foreach OBJ, $(COBJS), .deps/$(OBJ).P) $(foreach OBJ, $(CXXOBJS), .deps/$(OBJ).P)
#(shell echo $OBJ |sed s/\.o/\.P/))
EXE=el.linux.bin
ifndef CC
CC=gcc
endif
ifndef CXX
CXX=g++
endif
ifndef LINK
LINK=gcc
endif
all: $(EXE)
# the compile targets
$(EXE): $(OBJS)
@echo " LINK $(EXE)"
@$(LINK) $(CFLAGS) -o $(EXE) $(OBJS) $(LDFLAGS)
#recompile on Makefile or conf change
#.depend $(OBJS): Makefile.linux make.conf
DEPS_DIRS = .deps .deps/io .deps/shader .deps/eye_candy .deps/exceptions .deps/xz .deps/xml \
.deps/fsaa .deps/engine \
$(foreach FEATURE, $(FEATURES), $($(FEATURE)_DEPS_DIR))
DEPS_MAGIC := $(shell mkdir $(DEPS_DIRS) > /dev/null 2>&1 || :)
$(COBJS): %.o: %.c Makefile.linux make.conf
@echo " CC $@"
@if $(CC) $(CFLAGS) -MT '$@' -MD -MP -MF '.deps/[email protected]' -c $< -o $@; then \
mv ".deps/[email protected]" ".deps/[email protected]"; \
else rm -f ".deps/[email protected]"; exit 1; \
fi
$(CXXOBJS): %.o: %.cpp Makefile.linux make.conf
@echo " CXX $@"
@if $(CXX) $(CXXFLAGS) -MT '$@' -MD -MP -MF '.deps/[email protected]' -c $< -o $@; then \
mv ".deps/[email protected]" ".deps/[email protected]"; \
else rm -f ".deps/[email protected]"; exit 1; \
fi
release:
@$(MAKE) -f Makefile.linux 'CFLAGS=$(_CFLAGS)' 'CXXFLAGS=$(_CXXFLAGS)'
static:
@$(MAKE) -f Makefile.linux 'CFLAGS=$(_CFLAGS)' 'CXXFLAGS=$(_CXXFLAGS)' 'LDFLAGS=$(_LDFLAGS)' 'OBJS=$(OBJS) $(STATICLIBS)'
clean:
rm -f $(OBJS) $(EXE)
docs:
cd docs && doxygen Doxyfile
# define GIT_VERSION if we have a version file
VTMP := $(shell [ -r git_version ] && cat git_version)
ifdef VTMP
GIT_VERSION = -DGIT_VERSION=\"$(VTMP)\"
endif
# generate the git_version file
VERSION = $(shell git describe --abbrev=4 --dirty --always)
gen_git_version:
@echo -n "$(VERSION)" > git_version
@echo "New version file: $(VERSION)"
@rm -f console.o $(EXE)
.depend: $(foreach HEADER_DIR, $(HEADER_DIRS), $(wildcard $(HEADER_DIR)/*.h))
$(CC) $(CFLAGS) -MM $(patsubst %.o, %.c, $(COBJS)) >.depend
$(CXX) $(CXXFLAGS) -MM $(patsubst %.o, %.cpp, $(CXXOBJS)) >>.depend
make.conf: make.defaults
@if (test -f $@ -a '$(UPDATE_CONF)' != 'yes'); \
then \
echo '**'; \
echo '* WARNING: $< is newer than $@!'; \
echo '* Proceeding in 10 seconds, hit Ctrl-C to abort...'; \
echo '*'; \
sleep 10; \
else \
cp $< $@; \
fi
pawn_scripts/features.inc: make.conf
echo "#if defined _features_included" > $@; \
echo "\t#endinput" >> $@; \
echo "#endif" >> $@; \
echo "#define _features_included" >> $@; \
for feature in $(FEATURES); do \
echo "#define $$feature" >> $@; \
done
-include $(DEP_FILES)