Mercurial > hg > forks > yadex
annotate GNUmakefile @ 80:2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 26 Sep 2011 17:39:49 +0300 |
parents | b0f47747e625 |
children | 51d5549a1bdc |
rev | line source |
---|---|
0 | 1 # |
2 # Makefile for Yadex | |
3 # Copyright © André Majorel 1998-2003. | |
4 # AYM 1998-06-10 | |
5 # | |
6 | |
7 # ATTENTION : GNU MAKE IS REQUIRED ! This makefile uses pattern | |
8 # rules, addprefix, addsuffix, etc. It's not named "GNUmakefile" | |
9 # for nothing. | |
10 | |
11 ######################################################################## | |
12 # | |
13 # Definitions that only hackers | |
14 # might want to change | |
15 # | |
16 ######################################################################## | |
17 | |
18 # The name of the directory where objects and | |
19 # binaries are put. I include the output of | |
20 # "uname -a" to make it easier for me to build | |
21 # Yadex for different platforms from the same | |
22 # source tree. | |
23 SYSTEM := $(shell echo `uname -n`_`uname -a | cksum` | tr -dc '[:alnum:]._-') | |
24 OBJDIR = obj/0 | |
25 DOBJDIR = dobj/0 | |
26 OBJPHYSDIR = obj/$(SYSTEM) | |
27 DOBJPHYSDIR = dobj/$(SYSTEM) | |
28 OBJDIR_ATCLIB = $(OBJDIR)/atclib | |
29 DOBJDIR_ATCLIB = $(DOBJDIR)/atclib | |
30 OBJPHYSDIR_ATCLIB = $(OBJPHYSDIR)/atclib | |
31 DOBJPHYSDIR_ATCLIB = $(DOBJPHYSDIR)/atclib | |
32 | |
33 # Create all directories and make symlinks to | |
34 # config.cc and config.h. Doing it at the start | |
35 # makes things much simpler later on. | |
36 DUMMY := $(shell \ | |
37 mkdir -p $(OBJPHYSDIR) $(OBJPHYSDIR_ATCLIB); \ | |
38 mkdir -p $(DOBJPHYSDIR) $(DOBJPHYSDIR_ATCLIB); \ | |
39 [ ! -h $(OBJDIR) ] || rm $(OBJDIR); \ | |
40 [ ! -h $(DOBJDIR) ] || rm $(DOBJDIR); \ | |
41 ln -s $(SYSTEM) $(OBJDIR); \ | |
42 ln -s $(SYSTEM) $(DOBJDIR); \ | |
43 ) | |
44 | |
45 include $(OBJDIR)/Makefile.config | |
46 | |
47 ######################################################################## | |
48 # | |
49 # Definitions that end users | |
50 # might want to change | |
51 # | |
52 ######################################################################## | |
53 | |
54 # Which OS ? | |
55 OS := $(shell uname -s | tr A-Z a-z) | |
56 | |
57 # Where your X11 libraries and headers reside. | |
58 # Current rule: | |
59 # - AIX has them in /usr/lpp/X11/{lib,include}, | |
60 # - Solaris has them in /usr/openwin/{lib,include}, | |
61 # - all other unices in /usr/X11R6/{lib,include}. | |
62 ifeq ($(findstring $(OS), aix), $(OS)) | |
63 X11LIBDIR = /usr/lpp/X11/lib | |
64 X11INCLUDEDIR = /usr/lpp/X11/include | |
65 else | |
66 ifeq ($(findstring $(OS), solaris sunos), $(OS)) | |
67 X11LIBDIR = /usr/openwin/lib | |
68 X11INCLUDEDIR = /usr/openwin/include | |
69 else | |
70 X11LIBDIR = /usr/X11R6/lib | |
71 X11INCLUDEDIR = /usr/X11R6/include | |
72 endif | |
73 endif | |
74 | |
75 # $(CC) and $(CXX) are the C and C++ compiler respectively. They're | |
76 # normally autodetected by ./configure and passed to make through | |
77 # obj/0/Makefile.config. | |
78 #CC = | |
79 #CXX = | |
80 | |
81 # Options used when compiling Atclib. | |
46
b0f47747e625
Always add debug compiler flag (-g).
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
82 CFLAGS = -g -O2 -W -Wall |
0 | 83 |
84 # Options used when compiling and linking Yadex. | |
85 # ld is invoked through the C++ compiler so | |
86 # LDFLAGS should not contain options that mean | |
87 # something to the C++ compiler. | |
46
b0f47747e625
Always add debug compiler flag (-g).
Matti Hamalainen <ccr@tnsp.org>
parents:
37
diff
changeset
|
88 CXXFLAGS = -g -O3 -W -Wall |
0 | 89 #CXXFLAGS += -DWHITE_BACKGROUND |
90 #LDFLAGS = | |
91 | |
92 # Options used to compile and link the debugging | |
93 # targets. Not used by normal end-user targets. | |
94 # Unlike CFLAGS, CXXFLAGS and LDFLAGS, assume | |
95 # GCC/EGCS. | |
17 | 96 DCFLAGS = -g -O3 |
0 | 97 DCFLAGS += -Wall # GCC warnings |
98 DCFLAGS += -pedantic # GCC warnings | |
99 DCFLAGS += -Wno-parentheses # GCC warnings | |
100 DCFLAGS += -Wpointer-arith # GCC warnings | |
101 DCFLAGS += -Wcast-qual # GCC warnings | |
102 DCFLAGS += -Wcast-align # GCC warnings | |
103 DCFLAGS += -Wwrite-strings # GCC warnings | |
104 DCFLAGS += -Wmissing-declarations # GCC warnings | |
105 DCFLAGS += -Wmissing-prototypes # GCC warnings | |
106 DCFLAGS += -Winline # GCC warnings | |
107 DCFLAGS += -pg # Profiling | |
108 | |
17 | 109 DCXXFLAGS = -g -O3 |
0 | 110 DCXXFLAGS += -Wall # GCC warnings |
111 DCXXFLAGS += -pedantic # GCC warnings | |
112 DCXXFLAGS += -Wno-parentheses # GCC warnings | |
113 DCXXFLAGS += -Wpointer-arith # GCC warnings | |
114 DCXXFLAGS += -Wcast-qual # GCC warnings | |
115 DCXXFLAGS += -Wcast-align # GCC warnings | |
116 DCXXFLAGS += -Wwrite-strings # GCC warnings | |
117 DCXXFLAGS += -Wmissing-declarations # GCC warnings | |
118 DCXXFLAGS += -Wmissing-prototypes # GCC warnings | |
119 #DCXXFLAGS += -Winline # GCC warnings | |
120 DCXXFLAGS += -pg # Profiling | |
121 | |
122 DLDFLAGS = | |
123 DLDFLAGS += -pg # Profiling | |
124 #DLDFLAGS += -lefence # Electric Fence | |
125 | |
126 | |
127 ######################################################################## | |
128 # | |
129 # Definitions that only hackers | |
130 # might want to change | |
131 # | |
132 ######################################################################## | |
133 | |
134 MAKEFILE = GNUmakefile | |
135 VERSION := $(shell cat VERSION) | |
136 VERPREV := $(shell test -f VERPREV && cat VERPREV) | |
137 | |
138 # All the modules of Yadex without path or extension. | |
139 MODULES_YADEX = \ | |
140 acolours aym bench bitvec \ | |
141 cfgfile checks colour1 colour2 \ | |
142 colour3 colour4 config credits \ | |
143 dependcy dialog disppic drawmap \ | |
144 edisplay editgrid editlev editloop \ | |
145 editobj editsave endian editzoom \ | |
146 entry entry2 events flats \ | |
147 game gcolour1 gcolour2 gcolour3 \ | |
20
07c68836db71
Remove DOS mouse code and most of the BGI crap.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
148 geom gfx gfx3 \ |
0 | 149 gotoobj help1 help2 highlt \ |
150 img imgscale imgspect infobar \ | |
151 input l_align l_centre l_flags \ | |
152 l_misc l_prop l_unlink l_vertices \ | |
153 levels lists locate lumpdir \ | |
154 macro memory menubar menu \ | |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
155 mkpalette names \ |
0 | 156 objects objinfo oldmenus palview \ |
157 patchdir pic2img prefer s_centre \ | |
158 s_door s_lift s_linedefs s_merge \ | |
159 s_misc s_prop s_slice s_split \ | |
160 s_swapf s_vertices sanity scrnshot \ | |
161 selbox selectn selpath selrect \ | |
24
b2dc19044bf3
Import simple 3D preview, an old patch by Andrew Apted. Pressing 'R' key
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
162 serialnum spritdir sticker r_render r_images \ |
0 | 163 t_centre t_flags t_prop t_spin \ |
80
2f1ecc1c5f72
Huge cleanup -- move some global variables into a struct.
Matti Hamalainen <ccr@tnsp.org>
parents:
46
diff
changeset
|
164 textures things v_centre \ |
0 | 165 v_merge v_polyg vectext verbmsg \ |
166 version wadfile wadlist wadnamec \ | |
167 wadres wads wads2 warn \ | |
168 windim x_centre x_exchng x_hover \ | |
169 x_mirror x_rotate x11 xref \ | |
170 yadex ytime | |
171 | |
172 # All the modules of Atclib without path or extension. | |
173 MODULES_ATCLIB = \ | |
174 al_adigits al_aerrno al_astrerror al_fana \ | |
175 al_fnature al_lateol al_lcount al_lcreate \ | |
176 al_ldelete al_ldiscard al_lgetpos al_linsert \ | |
177 al_linsertl al_llength al_lpeek al_lpeekl \ | |
178 al_lpoke al_lpokel al_lptr al_lread \ | |
179 al_lreadl al_lrewind al_lseek al_lsetpos \ | |
180 al_lstep al_ltell al_lwrite al_lwritel \ | |
181 al_sapc al_saps al_scps al_scpslower \ | |
182 al_sdup al_sisnum al_strolc | |
183 | |
184 # The source files of Yadex and Atclib | |
185 SRC_YADEX = $(addprefix src/, $(addsuffix .cc, $(MODULES_YADEX))) | |
186 SRC_ATCLIB = $(addprefix atclib/, $(addsuffix .c, $(MODULES_ATCLIB))) | |
187 | |
188 # The headers of Yadex and Atclib | |
189 HEADERS_YADEX := $(wildcard src/*.h) | |
190 HEADERS_ATCLIB = atclib/atclib.h | |
191 | |
192 # All the source files, including the headers. | |
193 SRC = $(filter-out src/config.cc, $(SRC_YADEX)) \ | |
194 $(filter-out src/config.h, $(HEADERS_YADEX)) \ | |
195 $(SRC_ATCLIB) $(HEADERS_ATCLIB) | |
196 | |
197 # The files on which youngest is run. | |
198 SRC_NON_GEN = $(filter-out src/credits.cc src/prefix.cc src/version.cc, $(SRC)) | |
199 | |
200 # The object files | |
201 OBJ_CONFIG =# $(OBJDIR)/config.o | |
202 DOBJ_CONFIG =# $(DOBJDIR)/config.o | |
203 OBJ_YADEX = $(addprefix $(OBJDIR)/, $(addsuffix .o, $(MODULES_YADEX))) | |
204 DOBJ_YADEX = $(addprefix $(DOBJDIR)/, $(addsuffix .o, $(MODULES_YADEX))) | |
205 OBJ_ATCLIB = $(addprefix $(OBJDIR_ATCLIB)/, $(addsuffix .o,$(MODULES_ATCLIB))) | |
206 DOBJ_ATCLIB = $(addprefix $(DOBJDIR_ATCLIB)/, $(addsuffix .o,$(MODULES_ATCLIB))) | |
207 | |
208 # The game definition files. | |
209 YGD = $(addprefix ygd/, \ | |
210 doom.ygd doom02.ygd doom04.ygd doom05.ygd \ | |
211 doom2.ygd doompr.ygd heretic.ygd hexen.ygd \ | |
212 strife.ygd strife10.ygd) | |
213 | |
214 # Files that are used with scripts/process to | |
215 # generate files that are included in the | |
216 # distribution archive. | |
217 DOC1_SRC = \ | |
218 docsrc/README \ | |
219 docsrc/README.doc | |
220 | |
221 # Files that are used with scripts/process to | |
222 # generate files that go in the doc/ directory | |
223 # and are NOT included in the archive. | |
224 DOC2_SRC_HTML = \ | |
225 docsrc/advanced.html \ | |
226 docsrc/contact.html \ | |
227 docsrc/credits.html \ | |
228 docsrc/deu_diffs.html \ | |
229 docsrc/editing_docs.html \ | |
230 docsrc/faq.html \ | |
231 docsrc/feedback.html \ | |
232 docsrc/getting_started.html \ | |
233 docsrc/hackers_guide.html \ | |
234 docsrc/help.html \ | |
235 docsrc/index.html \ | |
236 docsrc/keeping_up.html \ | |
237 docsrc/legal.html \ | |
238 docsrc/packagers_guide.html \ | |
239 docsrc/palette.html \ | |
24
b2dc19044bf3
Import simple 3D preview, an old patch by Andrew Apted. Pressing 'R' key
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
240 docsrc/preview.html \ |
0 | 241 docsrc/reporting.html \ |
242 docsrc/tips.html \ | |
243 docsrc/trivia.html \ | |
244 docsrc/trouble.html \ | |
245 docsrc/users_guide.html \ | |
246 docsrc/wad_specs.html \ | |
247 docsrc/ygd.html | |
248 | |
249 DOC2_SRC_MISC = \ | |
250 docsrc/yadex.6 \ | |
251 # docsrc/yadex.lsm\ | |
252 | |
253 # Files that must be put in the distribution | |
254 # archive. Most (but not all) are generated from | |
255 # $(DOC1_SRC_*) into the base directory. | |
256 DOC1 = FAQ README doc/README | |
257 | |
258 # Files that go in the doc/ directory and must | |
259 # NOT be put in the distribution archive. Most | |
260 # are either generated from $(DOC2_SRC_*) or | |
261 # symlinked for docsrc/*.png. | |
262 DOC2 = $(addprefix doc/, $(PIX) $(notdir $(DOC2_SRC_HTML) $(DOC2_SRC_MISC))) | |
263 | |
264 # Misc. other files that must be put in the | |
265 # distribution archive. | |
266 MISC_FILES = \ | |
267 boost/boost/config.hpp \ | |
268 boost/boost/config/compiler/borland.hpp \ | |
269 boost/boost/config/compiler/comeau.hpp \ | |
270 boost/boost/config/compiler/common_edg.hpp \ | |
271 boost/boost/config/compiler/compaq_cxx.hpp \ | |
272 boost/boost/config/compiler/gcc.hpp \ | |
273 boost/boost/config/compiler/greenhills.hpp \ | |
274 boost/boost/config/compiler/hp_acc.hpp \ | |
275 boost/boost/config/compiler/intel.hpp \ | |
276 boost/boost/config/compiler/kai.hpp \ | |
277 boost/boost/config/compiler/metrowerks.hpp \ | |
278 boost/boost/config/compiler/mpw.hpp \ | |
279 boost/boost/config/compiler/sgi_mipspro.hpp \ | |
280 boost/boost/config/compiler/sunpro_cc.hpp \ | |
281 boost/boost/config/compiler/vacpp.hpp \ | |
282 boost/boost/config/compiler/visualc.hpp \ | |
283 boost/boost/config/platform/aix.hpp \ | |
284 boost/boost/config/platform/beos.hpp \ | |
285 boost/boost/config/platform/bsd.hpp \ | |
286 boost/boost/config/platform/cygwin.hpp \ | |
287 boost/boost/config/platform/hpux.hpp \ | |
288 boost/boost/config/platform/irix.hpp \ | |
289 boost/boost/config/platform/linux.hpp \ | |
290 boost/boost/config/platform/macos.hpp \ | |
291 boost/boost/config/platform/solaris.hpp \ | |
292 boost/boost/config/platform/win32.hpp \ | |
293 boost/boost/config/posix_features.hpp \ | |
294 boost/boost/config/select_compiler_config.hpp \ | |
295 boost/boost/config/select_platform_config.hpp \ | |
296 boost/boost/config/select_stdlib_config.hpp \ | |
297 boost/boost/config/stdlib/dinkumware.hpp \ | |
298 boost/boost/config/stdlib/libstdcpp3.hpp \ | |
299 boost/boost/config/stdlib/modena.hpp \ | |
300 boost/boost/config/stdlib/msl.hpp \ | |
301 boost/boost/config/stdlib/roguewave.hpp \ | |
302 boost/boost/config/stdlib/sgi.hpp \ | |
303 boost/boost/config/stdlib/stlport.hpp \ | |
304 boost/boost/config/stdlib/vacpp.hpp \ | |
305 boost/boost/config/suffix.hpp \ | |
306 boost/boost/config/user.hpp \ | |
307 boost/boost/smart_ptr.hpp \ | |
308 boost/boost/static_assert.hpp \ | |
309 boost/boost/utility.hpp \ | |
310 boost/boost/utility/base_from_member.hpp \ | |
311 boost/boost/utility_fwd.hpp \ | |
312 cache/copyright.man \ | |
313 cache/copyright.txt \ | |
314 cache/pixlist \ | |
315 cache/srcdate \ | |
316 cache/uptodate \ | |
317 configure \ | |
318 docsrc/copyright \ | |
319 CHANGES \ | |
320 COPYING \ | |
321 COPYING.LIB \ | |
322 GNUmakefile \ | |
323 Makefile \ | |
324 TODO \ | |
325 VERSION \ | |
326 yadex.cfg \ | |
327 yadex.dep | |
328 | |
329 # The images used in the HTML doc. FIXME: "<img" | |
330 # and "src=" have to be on the same line. These | |
331 # are symlinked into doc/ when $(DOC2) is made. | |
332 PIX = $(shell cat cache/pixlist) | |
333 | |
334 # The script files. | |
335 SCRIPTS = $(addprefix scripts/, \ | |
336 copyright \ | |
337 ftime.1 \ | |
338 ftime.c \ | |
339 install.c \ | |
340 mkinstalldirs \ | |
341 notexist.c \ | |
342 process \ | |
343 youngest) | |
344 | |
345 # The patches | |
346 PATCHES = $(addprefix patches/, \ | |
347 README \ | |
348 1.5.0_gcc27.diff) | |
349 | |
350 # All files that must be put in the distribution archive. | |
351 ARC_FILES = $(sort $(DOC1) $(DOC1_SRC) $(DOC2_SRC_HTML) $(DOC2_SRC_MISC)\ | |
352 $(MISC_FILES) $(addprefix docsrc/, $(PIX)) $(SCRIPTS) $(SRC) $(YGD)\ | |
353 $(PATCHES)) | |
354 | |
355 # The "root" directory of the archives. The | |
356 # basename of the archives is also based on this. | |
357 ARCHIVE := yadex-$(VERSION) | |
358 ARCPREV := yadex-$(VERPREV) | |
359 ARCDIFF := yadex-$(VERSION).diff | |
360 | |
361 # Cosmetic | |
362 CFLAGS := $(strip $(CFLAGS)) | |
363 DCFLAGS := $(strip $(DCFLAGS)) | |
364 CXXFLAGS := $(strip $(CXXFLAGS)) | |
365 DCXXFLAGS := $(strip $(DCXXFLAGS)) | |
366 LDFLAGS := $(strip $(LDFLAGS)) | |
367 DLDFLAGS := $(strip $(DLDFLAGS)) | |
368 | |
369 | |
370 ######################################################################## | |
371 # | |
372 # Targets for | |
373 # end users. | |
374 # | |
375 ######################################################################## | |
376 | |
377 .PHONY: all | |
378 all: doc yadex.dep yadex $(YGD) | |
379 | |
380 .PHONY: yadex | |
381 yadex: $(OBJDIR)/yadex | |
382 | |
383 $(OBJDIR)/yadex: $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(MAKEFILE) | |
384 @echo "** Linking Yadex" | |
385 $(CXX) $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) -o $@ \ | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
386 -L$(X11LIBDIR) -lX11 -lm -lc $(LDFLAGS) $(EXTRA_LDFLAGS) |
0 | 387 |
388 .PHONY: test | |
389 test: | |
390 $(OBJDIR)/yadex $(A) | |
391 | |
392 .PHONY: install | |
393 install: $(OBJDIR)/install | |
394 @scripts/mkinstalldirs $(BINDIR) | |
395 @scripts/mkinstalldirs $(ETCDIR) | |
396 @scripts/mkinstalldirs $(MANDIR) | |
397 @scripts/mkinstalldirs $(MANDIR)/man6 | |
398 @scripts/mkinstalldirs $(SHAREDIR) | |
399 $(OBJDIR)/install -m 755 $(OBJDIR)/yadex $(BINDIR)/yadex-$(VERSION) | |
400 rm -f $(BINDIR)/yadex | |
401 ln -s yadex-$(VERSION) $(BINDIR)/yadex | |
402 $(OBJDIR)/install -m 644 doc/yadex.6 $(MANDIR)/man6/yadex-$(VERSION).6 | |
403 rm -f $(MANDIR)/man6/yadex.6 | |
404 ln -s yadex-$(VERSION).6 $(MANDIR)/man6/yadex.6 | |
405 $(OBJDIR)/install -m 644 -d $(SHAREDIR) $(YGD) | |
36 | 406 @if [ ! -e $(ETCDIR)/yadex.cfg ]; then $(OBJDIR)/install -m 644 -d $(ETCDIR) yadex.cfg;fi |
0 | 407 @echo "---------------------------------------------------------------" |
408 @echo " Yadex is now installed." | |
409 @echo | |
410 @echo " Before you run it, enter the paths to your iwads in" | |
411 @echo " $(ETCDIR)/yadex.cfg or ~/.yadex/yadex.cfg." | |
412 @echo " When you're done, type \"yadex\" to start." | |
413 @echo " If you're confused, take a look at doc/index.html." | |
414 @echo | |
415 @echo " Happy editing !" | |
416 @echo "---------------------------------------------------------------" | |
417 | |
418 .PHONY: clean | |
419 clean: | |
420 rm -f $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(OBJDIR)/yadex | |
421 rm -f $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(DOBJDIR)/yadex | |
422 rm -f $(OBJDIR)/ftime | |
423 rm -f $(OBJDIR)/install | |
424 rm -f $(OBJDIR)/notexist | |
425 rm -f $(OBJDIR) | |
426 rm -f $(DOBJDIR) | |
427 rm -rf doc | |
428 | |
429 .PHONY: dclean | |
430 dclean: | |
431 rm -rf $(DOBJPHYSDIR) | |
432 rm -f $(DOBJDIR) | |
433 | |
434 .PHONY: doc | |
435 doc: cache/pixlist docdirs $(DOC1) doc2 | |
436 | |
437 # Have to put it separately because evaluation | |
438 # of $(DOC2) requires cache/pixlist to exist. | |
439 .PHONY: doc2 | |
440 doc2: $(DOC2) | |
441 | |
442 .PHONY: help | |
443 help: | |
444 @echo User targets: | |
445 @echo "make [all] Build everything" | |
446 @echo "make yadex Build Yadex" | |
447 @echo "make test [A=args] Test Yadex" | |
448 @echo "make install Install everything" | |
449 @echo "make showconf Show current configuration" | |
450 @echo | |
451 @echo Hacker targets: | |
452 @echo "make dall Build debug version of everything" | |
453 @echo "make dyadex Build debug version of Yadex" | |
454 @echo "make dtest [A=args] Test debug version of Yadex" | |
455 @echo "make dg Run debug version of Yadex through gdb" | |
456 @echo "make dd Run debug version of Yadex through ddd" | |
457 @echo "make doc Update doc" | |
458 @echo "make man View man page with man" | |
459 @echo "make dvi View man page with xdvi" | |
460 @echo "make ps View man page with gv" | |
461 @echo "make dist Create distribution archive" | |
462 @echo "make save Create backup archive" | |
463 | |
464 | |
465 ######################################################################## | |
466 # | |
467 # Targets meant for | |
468 # hackers only. | |
469 # | |
470 ######################################################################## | |
471 | |
472 # d: Compile and run | |
473 .PHONY: d | |
474 d: dyadex dtest | |
475 | |
476 .PHONY: save | |
477 save: | |
478 tar -cjvf yadex-$$(date '+%Y%m%d').tar.bz2 \ | |
479 --exclude "*.wad" \ | |
480 --exclude "*.zip" \ | |
481 --exclude "core" \ | |
482 --exclude "dos/*" \ | |
483 --exclude "obj" \ | |
484 --exclude "dobj" \ | |
485 --exclude "old/*" \ | |
486 --exclude "*~" \ | |
487 --exclude "*.bak" \ | |
488 --exclude "web/arc" \ | |
489 --exclude yadex-$$(date '+%Y%m%d').tar.bz2 \ | |
490 . | |
491 | |
492 .PHONY: dall | |
493 dall: yadex.dep dyadex $(YGD) | |
494 | |
495 .PHONY: dyadex | |
496 dyadex: $(DOBJDIR)/yadex | |
497 | |
498 $(DOBJDIR)/yadex: $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(MAKEFILE) | |
499 @echo "** Linking Yadex" | |
500 $(CXX) $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) -o $@ \ | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
501 -L$(X11LIBDIR) -lX11 -lm -lc $(DLDFLAGS) $(EXTRA_LDFLAGS) |
0 | 502 |
503 .PHONY: dtest | |
504 dtest: | |
505 $(DOBJDIR)/yadex $(A) | |
506 gprof $(DOBJDIR)/yadex >gprof.out | |
507 | |
508 .PHONY: dg | |
509 dg: | |
510 gdb $(DOBJDIR)/yadex | |
511 | |
512 .PHONY: dd | |
513 dd: | |
514 ddd $(DOBJDIR)/yadex | |
515 | |
516 .PHONY: asm | |
517 asm: $(addprefix $(OBJDIR)/, $(addsuffix .S, $(MODULES_YADEX))) | |
518 | |
519 # Generate the distribution archives. Requires GNU tar, | |
520 # GNU cp, gzip and optionally bzip2 (if distbz2 is | |
521 # uncommented). | |
522 .PHONY: dist | |
523 dist: changes distimage distgz distdiff #distbz2 | |
524 @echo "** Removing distribution image tree $(ARCHIVE)" | |
525 rm -r $(ARCHIVE) | |
526 | |
527 .PHONY: distimage | |
528 distimage: all $(ARC_FILES) | |
529 @echo "** Creating distribution image tree $(ARCHIVE)" | |
530 rm -rf $(ARCHIVE) | |
531 scripts/mkinstalldirs $(ARCHIVE) | |
532 @tar -cf - $(ARC_FILES) | (cd $(ARCHIVE); tar -xf -) | |
533 | |
534 .PHONY: distgz | |
535 distgz: distimage | |
536 @echo "** Creating tar.gz distribution" | |
537 tar -czf $(ARCHIVE).tar.gz $(ARCHIVE) | |
538 | |
539 .PHONY: distbz2 | |
540 distbz2: distimage | |
541 @echo "** Creating .tar.bz2 distribution" | |
542 tar -cIf $(ARCHIVE).tar.bz2 $(ARCHIVE) | |
543 | |
544 .PHONY: distdiff | |
545 TMP0 = $$HOME/tmp | |
546 TMPPREV = $(TMP0)/$(ARCPREV) | |
547 TMPCURR = $(TMP0)/$(ARCHIVE) | |
548 distdiff: | |
549 @echo "** Building the diff distribution" | |
550 @echo "Creating the diff" | |
551 rm -rf $(TMPPREV) $(TMPCURR) $(TMPDIFF) | |
552 mkdir -p $(TMP0) | |
553 tar -xzf $(ARCHIVE).tar.gz -C $(TMP0) | |
554 tar -xzf ../yadex-arc/pub/$(ARCPREV).tar.gz -C $(TMP0) | |
555 scripts/process docsrc/README.diff >$(TMP0)/$(ARCDIFF) | |
556 echo >>$(TMP0)/$(ARCDIFF) | |
557 cd $(TMP0) && (diff -uaNr $(ARCPREV) $(ARCHIVE) >>$(ARCDIFF) || true) | |
558 @# KLUDGE - On my system, just "! grep" makes make choke | |
559 true; ! grep "^Binary files .* and .* differ" $(TMP0)/$(ARCDIFF) | |
560 gzip -f $(TMP0)/$(ARCDIFF) | |
561 @echo "Verifying the diff" | |
562 cd $(TMPPREV) && gzip -d <../$(ARCDIFF).gz | patch -p1 | |
563 @# FIXME remove -N after 1.6 is done, it's there because | |
564 @# uptodate has been moved between 1.5 and 1.6 and since | |
565 @# it's empty it remains in $(ARCPREV). | |
566 cd $(TMP0) && diff -rP $(ARCHIVE) $(ARCPREV) | |
567 mv $(TMP0)/$(ARCDIFF).gz . | |
568 @echo "Cleaning up" | |
569 cd $(TMP0) && rm -rf $(ARCPREV) | |
570 cd $(TMP0) && rm -rf $(ARCHIVE) | |
571 | |
572 .PHONY: showconf | |
573 showconf: | |
574 @echo "ARCHIVE \"$(ARCHIVE)\"" | |
575 @echo "BINDIR \"$(BINDIR)\"" | |
576 @echo "CC \"$(CC)\"" | |
577 @echo "CFLAGS \"$(CFLAGS)\"" | |
578 @echo "CXX \"$(CXX)\"" | |
579 @echo "CXXFLAGS \"$(CXXFLAGS)\"" | |
580 @echo "DCFLAGS \"$(DCFLAGS)\"" | |
581 @echo "DCXXFLAGS \"$(DCXXFLAGS)\"" | |
582 @echo "DLDFLAGS \"$(DLDFLAGS)\"" | |
583 @echo "ETCDIR \"$(ETCDIR)\"" | |
584 @echo "ETCDIRNV \"$(ETCDIRNV)\"" | |
585 @echo "HAVE_GETTIMEOFDAY \"$(HAVE_GETTIMEOFDAY)\"" | |
586 @echo "HAVE_NANOSLEEP \"$(HAVE_NANOSLEEP)\"" | |
587 @echo "HAVE_SNPRINTF \"$(HAVE_SNPRINTF)\"" | |
588 @echo "HAVE_USLEEP \"$(HAVE_USLEEP)\"" | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
589 @echo "HAVE_READLINE \"$(HAVE_READLINE)\"" |
0 | 590 @echo "LDFLAGS \"$(LDFLAGS)\"" |
591 @echo "MANDIR \"$(MANDIR)\"" | |
592 @echo "OS \"$(OS)\"" | |
593 @echo "PREFIX \"$(PREFIX)\"" | |
594 @echo "SHAREDIR \"$(SHAREDIR)\"" | |
595 @echo "SHAREDIRNV \"$(SHAREDIRNV)\"" | |
596 @echo "SHELL \"$(SHELL)\"" | |
597 @echo "SYSTEM \"$(SYSTEM)\"" | |
598 @echo "VERSION \"$(VERSION)\"" | |
599 @echo "X11INCLUDEDIR \"$(X11INCLUDEDIR)\"" | |
600 @echo "X11LIBDIR \"$(X11LIBDIR)\"" | |
601 @echo "CXX --version \"`$(CXX) --version`\"" | |
602 @echo "CC --version \"`$(CC) --version`\"" | |
603 @echo "shell \"$$SHELL\"" | |
604 @echo "uname \"`uname`\"" | |
605 | |
606 | |
607 ######################################################################## | |
608 # | |
609 # Internal targets, not meant | |
610 # to be invoked directly | |
611 # | |
612 ######################################################################## | |
613 | |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
614 # If Makefile.config or config.h don't exist, give a hint... |
0 | 615 $(OBJDIR)/Makefile.config: |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
616 $(OBJDIR)/config.h: |
0 | 617 @echo "Sorry guv'nor, but... did you run ./configure ?" >&2 |
618 @false | |
619 | |
620 $(OBJDIR)/files_etc.man: $(OBJDIR)/config.etc $(MAKEFILE) | |
621 sed 's/%v/$(VERSION)/g; s,.*,.B &/yadex.cfg,' $< >$@ | |
622 | |
623 $(OBJDIR)/files_share.man: $(OBJDIR)/config.share $(MAKEFILE) | |
624 sed 's/%v/$(VERSION)/g; s,.*,.BI &/ game .ygd,' $< >$@ | |
625 | |
626 # Dependencies of the modules of Yadex | |
627 # -Y is here to prevent the inclusion of dependencies on | |
628 # /usr/include/*.h etc. As a side-effect, it generates many | |
629 # warnings, hence "2>/dev/null". | |
630 # | |
631 # The purpose of the awk script is to transform this input : | |
632 # | |
633 # src/foo.o: src/whatever.h | |
634 # | |
635 # into this output : | |
636 # | |
637 # obj/0/foo.o: src/whatever.h | |
638 # dobj/0/foo.o: src/whatever.h | |
639 # | |
640 # Note: the modules of Atclib are not scanned as they all | |
641 # depend on $(HEADERS_ATCLIB) and nothing else. | |
642 | |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 yadex.dep: $(SRC_NON_GEN) src/config.h |
0 | 644 @echo "Generating $@" |
645 @makedepend -f- -Y -Iatclib $(SRC_NON_GEN) 2>/dev/null \ | |
646 | awk 'sub (/^src/, "") == 1 { \ | |
647 print "'$(OBJDIR)'" $$0; \ | |
648 print "'$(DOBJDIR)'" $$0; \ | |
649 next; \ | |
650 }' >$@ | |
651 | |
652 cache/copyright.man: $(MAKEFILE) scripts/copyright docsrc/copyright | |
653 scripts/copyright -m docsrc/copyright >$@ | |
654 | |
655 cache/copyright.txt: $(MAKEFILE) scripts/copyright docsrc/copyright | |
656 scripts/copyright -t docsrc/copyright | sed 's/^./ &/' >$@ | |
657 | |
658 # The YYYY-MM-DD date indicated in the parentheses after the | |
659 # version number is the mtime of the most recent source file | |
660 # (where "being a source file" is defined as "being listed in | |
661 # $(SRC_NON_GEN)"). That string is the output of a perl script, | |
662 # scripts/youngest. Since perl is not necessarily installed on | |
663 # all machines, we cache that string in the file cache/srcdate | |
664 # and include that file in the distribution archive. If we | |
665 # didn't do that, people who don't have perl would be unable to | |
666 # build Yadex. | |
667 # | |
668 # Conceptually, cache/srcdate depends on $(SRC_NON_GEN) and | |
669 # doc/*.html depend on cache/srcdate. However, we can't write the | |
670 # makefile that way because if we did, that would cause two | |
671 # problems. Firstly every time a source file is changed, | |
672 # scripts/youngest would be ran, most of the time for nothing | |
673 # since its output is always the same, unless it's never been | |
674 # run today. Secondly, cache/srcdate being just generated, it's | |
675 # more recent than the content of the doc/ directory. The result | |
676 # would be that the entire doc/ directory would be rebuilt every | |
677 # time a single source file is changed, which is guaranteed to | |
678 # have an unnerving effect on the hacker at the keyboard. | |
679 # | |
680 # Part of the solution is to systematically force the mtime of | |
681 # cache/srcdate to 00:00, today. Thus, cache/srcdate always looks | |
682 # older than the content of the doc/ directory, unless it's not | |
683 # been refreshed yet today. | |
684 # | |
685 # But that's not enough because then cache/srcdate also looks | |
686 # always older than the source files it depends on, and thus | |
687 # make attempts to regenerate it every time make is invoked at | |
688 # all, which would render the very existence of cache/srcdate | |
689 # useless. That's why we have another file, cache/uptodate, that | |
690 # we touch to keep track of the time when we last generated | |
691 # cache/srcdate. | |
692 # | |
693 # If there was a such thing as _date-only_ dependencies, I could | |
694 # get away with just this : | |
695 # | |
696 # cache/srcdate: scripts/youngest | |
697 # cache/srcdate <date_dependency_operator> $(SRC_NON_GEN) | |
698 # if perl -v >/dev/null 2>&1; then\ | |
699 # scripts/youngest >$@;\ | |
700 # else\ | |
701 # blah... | |
702 # doc/*.html <date_dependency_operator> cache/srcdate | |
703 # blah... | |
704 # | |
705 # That would save two calls to "touch", one intermediary | |
706 # dependency (cache/uptodate) and a lot of obfuscation. | |
707 cache/srcdate: cache/uptodate | |
708 | |
709 cache/uptodate: scripts/youngest $(SRC_NON_GEN) | |
710 @mkdir -p cache | |
711 @if perl -v >/dev/null 2>&1; then \ | |
712 echo Generating cache/srcdate; \ | |
713 scripts/youngest $(SRC_NON_GEN) >cache/srcdate; \ | |
714 touch -t `date '+%m%d'`0000 cache/srcdate; \ | |
715 elif [ -r cache/srcdate ]; then \ | |
716 echo Perl not available. Keeping old cache/srcdate; \ | |
717 else \ | |
718 echo Perl not available. Creating bogus cache/srcdate; \ | |
719 date '+%Y-%m-%d' >cache/srcdate; \ | |
720 fi | |
721 @touch $@; | |
722 | |
723 # To compile the modules of Yadex | |
724 # (normal and debugging versions) | |
725 include yadex.dep | |
726 | |
727 # It's simpler to copy config.cc into src/ than to have a | |
728 # compilation rule for just one file. | |
729 src/config.cc: $(OBJDIR)/config.cc | |
730 cp -p $< $@ | |
731 | |
732 src/config.h: $(OBJDIR)/config.h | |
733 cp -p $< $@ | |
734 | |
735 $(OBJDIR)/%.o: src/%.cc | |
736 $(CXX) -c -Iatclib -Iboost -I$(X11INCLUDEDIR) $(CXXFLAGS) $< -o $@ | |
737 | |
738 $(DOBJDIR)/%.o: src/%.cc | |
739 $(CXX) -c -Iatclib -Iboost -I$(X11INCLUDEDIR) $(DCXXFLAGS) $< -o $@ | |
740 | |
741 # To compile the modules of Atclib | |
742 # (normal and debugging versions) | |
743 $(OBJDIR_ATCLIB)/%.o: atclib/%.c $(HEADERS_ATCLIB) | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
744 $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ |
0 | 745 |
746 $(DOBJDIR_ATCLIB)/%.o: atclib/%.c $(HEADERS_ATCLIB) | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
747 $(CC) -c $(DCFLAGS) $(EXTRA_CFLAGS) $< -o $@ |
0 | 748 |
749 # To see the generated assembly code | |
750 # for the modules of Yadex | |
751 $(OBJDIR)/%.S: src/%.cc $(MAKEFILE) | |
37
5f366c1ed459
Add support for GNU readline library for easier editing of the commands.
Matti Hamalainen <ccr@tnsp.org>
parents:
36
diff
changeset
|
752 $(CXX) $(CXXFLAGS) $(EXTRA_CXXFLAGS) -S -fverbose-asm -Iatclib -Iboost -I$(X11INCLUDEDIR)\ |
0 | 753 $< -o $@ |
754 | |
755 # A source file containing the credits | |
756 src/credits.cc: $(MAKEFILE) docsrc/copyright scripts/copyright | |
757 @echo Generating $@ | |
758 @echo '// DO NOT EDIT -- generated from docsrc/copyright' >$@ | |
759 scripts/copyright -c docsrc/copyright >>$@ | |
760 | |
761 # A source file containing just the date of the | |
762 # most recent source file and the version number | |
763 # (found in ./VERSION) | |
764 src/version.cc: $(SRC_NON_GEN) VERSION cache/srcdate $(MAKEFILE) | |
765 @echo Generating $@ | |
766 @printf '// DO NOT EDIT -- generated from VERSION\n\n' >$@ | |
767 @printf "extern const char *const yadex_source_date = \"%s\";\n" \ | |
768 `cat cache/srcdate` >>$@ | |
769 @printf "extern const char *const yadex_version = \"%s\";\n" \ | |
770 "$(VERSION)" >>$@ | |
771 | |
772 | |
773 # -------- Doc-related stuff -------- | |
774 | |
775 docdirs: | |
776 @if [ ! -d doc ]; then mkdir doc; fi | |
777 | |
778 cache/pixlist: $(DOC2_SRC_HTML) | |
779 @echo Generating $@ | |
780 @mkdir -p cache | |
781 @if perl -v >/dev/null 2>/dev/null; then \ | |
782 perl -ne '@l = m/<img\s[^>]*src="?([^\s">]+)/io; \ | |
783 print "@l\n" if @l;' $(DOC2_SRC_HTML) | sort | uniq >$@; \ | |
784 elif [ -f $@ ]; then \ | |
785 echo "Sorry, you need Perl to refresh $@. Keeping old $@."; \ | |
786 else \ | |
787 echo "Sorry, you need Perl to create $@. Creating empty $@."; \ | |
788 touch $@; \ | |
789 fi | |
790 | |
791 events.html: ev evhtml | |
792 evhtml -- -n $< >$@ | |
793 | |
794 events.txt: events.html | |
795 lynx -dump $< >$@ | |
796 | |
797 changes/changes.html: changes/*.log log2html RELEASE | |
798 ./log2html -- -r `cat RELEASE` -- $$(ls -r changes/*.log) >$@ | |
799 | |
800 # changes - update the changelog | |
801 .PHONY: changes | |
802 changes: changes/changes.html | |
803 w3m -dump -cols 72 $< >CHANGES | |
804 | |
805 # cns - view the changelog with Netscape | |
806 .PHONY: cns | |
807 cns: | |
808 netscape -remote "openURL(file:$$(pwd)/changes/changes.html,new-window)" | |
809 | |
810 # clynx - view the changelog with Lynx | |
811 .PHONY: clynx | |
812 clynx: | |
813 lynx changes/changes.html | |
814 | |
815 # cless - view the changelog with less | |
816 .PHONY: cless | |
817 cless: | |
818 less CHANGES | |
819 | |
820 # man - view the man page with man | |
821 .PHONY: man | |
822 man: doc/yadex.6 | |
823 man -l $^ | |
824 | |
825 # dvi - view the man page with xdvi | |
826 .PHONY: dvi | |
827 dvi: doc/yadex.dvi | |
828 xdvi $^ | |
829 | |
830 # ps - view the man page with gv | |
831 .PHONY: ps | |
832 ps: doc/yadex.ps | |
833 gv $^ | |
834 | |
835 # Use docsrc/faq.html and not directly | |
836 # doc/faq.html because we don't want FAQ to be | |
837 # remade at first build time. | |
838 FAQ: docsrc/faq.html | |
839 scripts/process $< >cache/faq.html | |
840 links -width 72 -dump cache/faq.html >$@ | |
841 rm cache/faq.html | |
842 | |
843 doc/yadex.dvi: doc/yadex.6 | |
844 groff -Tdvi -man $^ >$@ | |
845 | |
846 doc/yadex.ps: doc/yadex.6 | |
847 groff -Tps -man $^ >$@ | |
848 | |
849 | |
850 # Generate the doc by filtering them through scripts/process | |
851 PROCESS = \ | |
852 VERSION \ | |
853 cache/copyright.man \ | |
854 cache/copyright.txt \ | |
855 cache/srcdate \ | |
856 scripts/process \ | |
857 $(OBJDIR)/ftime \ | |
858 $(OBJDIR)/files_etc.man \ | |
859 $(OBJDIR)/files_share.man \ | |
860 $(OBJDIR)/notexist | |
861 | |
862 doc/yadex.6: docsrc/yadex.6 $(PROCESS) | |
863 @echo Generating $@ | |
864 @scripts/process $< >$@ | |
865 | |
866 doc/README: docsrc/README.doc $(PROCESS) | |
867 @echo Generating $@ | |
868 @scripts/process $< >$@ | |
869 | |
870 %: docsrc/% $(PROCESS) | |
871 @echo Generating $@ | |
872 @scripts/process $< >$@ | |
873 | |
874 doc/%.html: docsrc/%.html $(PROCESS) | |
875 @echo Generating $@ | |
876 @scripts/process $< >$@ | |
877 | |
878 # The images are just symlinked from docsrc/ to doc/ | |
879 doc/%.png: docsrc/%.png | |
880 @rm -f $@ | |
881 @ln -s ../$< $@ | |
882 | |
883 $(OBJDIR)/ftime: scripts/ftime.c | |
884 $(CC) $< -o $@ | |
885 | |
886 $(OBJDIR)/install: scripts/install.c | |
887 $(CC) $< -o $@ | |
888 | |
889 $(OBJDIR)/notexist: scripts/notexist.c | |
890 $(CC) $< -o $@ | |
891 | |
892 |