Mercurial > hg > forks > yadex
annotate GNUmakefile @ 111:51d5549a1bdc
Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 06 Oct 2014 15:23:36 +0300 |
parents | 2f1ecc1c5f72 |
children |
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. | |
111
51d5549a1bdc
Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
88 CXXFLAGS = -g -O3 -W -Wall -std=c++11 |
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 cache/copyright.man \ | |
268 cache/copyright.txt \ | |
269 cache/pixlist \ | |
270 cache/srcdate \ | |
271 cache/uptodate \ | |
272 configure \ | |
273 docsrc/copyright \ | |
274 CHANGES \ | |
275 COPYING \ | |
276 COPYING.LIB \ | |
277 GNUmakefile \ | |
278 Makefile \ | |
279 TODO \ | |
280 VERSION \ | |
281 yadex.cfg \ | |
282 yadex.dep | |
283 | |
284 # The images used in the HTML doc. FIXME: "<img" | |
285 # and "src=" have to be on the same line. These | |
286 # are symlinked into doc/ when $(DOC2) is made. | |
287 PIX = $(shell cat cache/pixlist) | |
288 | |
289 # The script files. | |
290 SCRIPTS = $(addprefix scripts/, \ | |
291 copyright \ | |
292 ftime.1 \ | |
293 ftime.c \ | |
294 install.c \ | |
295 mkinstalldirs \ | |
296 notexist.c \ | |
297 process \ | |
298 youngest) | |
299 | |
300 # The patches | |
301 PATCHES = $(addprefix patches/, \ | |
302 README \ | |
303 1.5.0_gcc27.diff) | |
304 | |
305 # All files that must be put in the distribution archive. | |
306 ARC_FILES = $(sort $(DOC1) $(DOC1_SRC) $(DOC2_SRC_HTML) $(DOC2_SRC_MISC)\ | |
307 $(MISC_FILES) $(addprefix docsrc/, $(PIX)) $(SCRIPTS) $(SRC) $(YGD)\ | |
308 $(PATCHES)) | |
309 | |
310 # The "root" directory of the archives. The | |
311 # basename of the archives is also based on this. | |
312 ARCHIVE := yadex-$(VERSION) | |
313 ARCPREV := yadex-$(VERPREV) | |
314 ARCDIFF := yadex-$(VERSION).diff | |
315 | |
316 # Cosmetic | |
317 CFLAGS := $(strip $(CFLAGS)) | |
318 DCFLAGS := $(strip $(DCFLAGS)) | |
319 CXXFLAGS := $(strip $(CXXFLAGS)) | |
320 DCXXFLAGS := $(strip $(DCXXFLAGS)) | |
321 LDFLAGS := $(strip $(LDFLAGS)) | |
322 DLDFLAGS := $(strip $(DLDFLAGS)) | |
323 | |
324 | |
325 ######################################################################## | |
326 # | |
327 # Targets for | |
328 # end users. | |
329 # | |
330 ######################################################################## | |
331 | |
332 .PHONY: all | |
333 all: doc yadex.dep yadex $(YGD) | |
334 | |
335 .PHONY: yadex | |
336 yadex: $(OBJDIR)/yadex | |
337 | |
338 $(OBJDIR)/yadex: $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(MAKEFILE) | |
339 @echo "** Linking Yadex" | |
340 $(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
|
341 -L$(X11LIBDIR) -lX11 -lm -lc $(LDFLAGS) $(EXTRA_LDFLAGS) |
0 | 342 |
343 .PHONY: test | |
344 test: | |
345 $(OBJDIR)/yadex $(A) | |
346 | |
347 .PHONY: install | |
348 install: $(OBJDIR)/install | |
349 @scripts/mkinstalldirs $(BINDIR) | |
350 @scripts/mkinstalldirs $(ETCDIR) | |
351 @scripts/mkinstalldirs $(MANDIR) | |
352 @scripts/mkinstalldirs $(MANDIR)/man6 | |
353 @scripts/mkinstalldirs $(SHAREDIR) | |
354 $(OBJDIR)/install -m 755 $(OBJDIR)/yadex $(BINDIR)/yadex-$(VERSION) | |
355 rm -f $(BINDIR)/yadex | |
356 ln -s yadex-$(VERSION) $(BINDIR)/yadex | |
357 $(OBJDIR)/install -m 644 doc/yadex.6 $(MANDIR)/man6/yadex-$(VERSION).6 | |
358 rm -f $(MANDIR)/man6/yadex.6 | |
359 ln -s yadex-$(VERSION).6 $(MANDIR)/man6/yadex.6 | |
360 $(OBJDIR)/install -m 644 -d $(SHAREDIR) $(YGD) | |
36 | 361 @if [ ! -e $(ETCDIR)/yadex.cfg ]; then $(OBJDIR)/install -m 644 -d $(ETCDIR) yadex.cfg;fi |
0 | 362 @echo "---------------------------------------------------------------" |
363 @echo " Yadex is now installed." | |
364 @echo | |
365 @echo " Before you run it, enter the paths to your iwads in" | |
366 @echo " $(ETCDIR)/yadex.cfg or ~/.yadex/yadex.cfg." | |
367 @echo " When you're done, type \"yadex\" to start." | |
368 @echo " If you're confused, take a look at doc/index.html." | |
369 @echo | |
370 @echo " Happy editing !" | |
371 @echo "---------------------------------------------------------------" | |
372 | |
373 .PHONY: clean | |
374 clean: | |
375 rm -f $(OBJ_CONFIG) $(OBJ_YADEX) $(OBJ_ATCLIB) $(OBJDIR)/yadex | |
376 rm -f $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(DOBJDIR)/yadex | |
377 rm -f $(OBJDIR)/ftime | |
378 rm -f $(OBJDIR)/install | |
379 rm -f $(OBJDIR)/notexist | |
380 rm -f $(OBJDIR) | |
381 rm -f $(DOBJDIR) | |
382 rm -rf doc | |
383 | |
384 .PHONY: dclean | |
385 dclean: | |
386 rm -rf $(DOBJPHYSDIR) | |
387 rm -f $(DOBJDIR) | |
388 | |
389 .PHONY: doc | |
390 doc: cache/pixlist docdirs $(DOC1) doc2 | |
391 | |
392 # Have to put it separately because evaluation | |
393 # of $(DOC2) requires cache/pixlist to exist. | |
394 .PHONY: doc2 | |
395 doc2: $(DOC2) | |
396 | |
397 .PHONY: help | |
398 help: | |
399 @echo User targets: | |
400 @echo "make [all] Build everything" | |
401 @echo "make yadex Build Yadex" | |
402 @echo "make test [A=args] Test Yadex" | |
403 @echo "make install Install everything" | |
404 @echo "make showconf Show current configuration" | |
405 @echo | |
406 @echo Hacker targets: | |
407 @echo "make dall Build debug version of everything" | |
408 @echo "make dyadex Build debug version of Yadex" | |
409 @echo "make dtest [A=args] Test debug version of Yadex" | |
410 @echo "make dg Run debug version of Yadex through gdb" | |
411 @echo "make dd Run debug version of Yadex through ddd" | |
412 @echo "make doc Update doc" | |
413 @echo "make man View man page with man" | |
414 @echo "make dvi View man page with xdvi" | |
415 @echo "make ps View man page with gv" | |
416 @echo "make dist Create distribution archive" | |
417 @echo "make save Create backup archive" | |
418 | |
419 | |
420 ######################################################################## | |
421 # | |
422 # Targets meant for | |
423 # hackers only. | |
424 # | |
425 ######################################################################## | |
426 | |
427 # d: Compile and run | |
428 .PHONY: d | |
429 d: dyadex dtest | |
430 | |
431 .PHONY: save | |
432 save: | |
433 tar -cjvf yadex-$$(date '+%Y%m%d').tar.bz2 \ | |
434 --exclude "*.wad" \ | |
435 --exclude "*.zip" \ | |
436 --exclude "core" \ | |
437 --exclude "dos/*" \ | |
438 --exclude "obj" \ | |
439 --exclude "dobj" \ | |
440 --exclude "old/*" \ | |
441 --exclude "*~" \ | |
442 --exclude "*.bak" \ | |
443 --exclude "web/arc" \ | |
444 --exclude yadex-$$(date '+%Y%m%d').tar.bz2 \ | |
445 . | |
446 | |
447 .PHONY: dall | |
448 dall: yadex.dep dyadex $(YGD) | |
449 | |
450 .PHONY: dyadex | |
451 dyadex: $(DOBJDIR)/yadex | |
452 | |
453 $(DOBJDIR)/yadex: $(DOBJ_CONFIG) $(DOBJ_YADEX) $(DOBJ_ATCLIB) $(MAKEFILE) | |
454 @echo "** Linking Yadex" | |
455 $(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
|
456 -L$(X11LIBDIR) -lX11 -lm -lc $(DLDFLAGS) $(EXTRA_LDFLAGS) |
0 | 457 |
458 .PHONY: dtest | |
459 dtest: | |
460 $(DOBJDIR)/yadex $(A) | |
461 gprof $(DOBJDIR)/yadex >gprof.out | |
462 | |
463 .PHONY: dg | |
464 dg: | |
465 gdb $(DOBJDIR)/yadex | |
466 | |
467 .PHONY: dd | |
468 dd: | |
469 ddd $(DOBJDIR)/yadex | |
470 | |
471 .PHONY: asm | |
472 asm: $(addprefix $(OBJDIR)/, $(addsuffix .S, $(MODULES_YADEX))) | |
473 | |
474 # Generate the distribution archives. Requires GNU tar, | |
475 # GNU cp, gzip and optionally bzip2 (if distbz2 is | |
476 # uncommented). | |
477 .PHONY: dist | |
478 dist: changes distimage distgz distdiff #distbz2 | |
479 @echo "** Removing distribution image tree $(ARCHIVE)" | |
480 rm -r $(ARCHIVE) | |
481 | |
482 .PHONY: distimage | |
483 distimage: all $(ARC_FILES) | |
484 @echo "** Creating distribution image tree $(ARCHIVE)" | |
485 rm -rf $(ARCHIVE) | |
486 scripts/mkinstalldirs $(ARCHIVE) | |
487 @tar -cf - $(ARC_FILES) | (cd $(ARCHIVE); tar -xf -) | |
488 | |
489 .PHONY: distgz | |
490 distgz: distimage | |
491 @echo "** Creating tar.gz distribution" | |
492 tar -czf $(ARCHIVE).tar.gz $(ARCHIVE) | |
493 | |
494 .PHONY: distbz2 | |
495 distbz2: distimage | |
496 @echo "** Creating .tar.bz2 distribution" | |
497 tar -cIf $(ARCHIVE).tar.bz2 $(ARCHIVE) | |
498 | |
499 .PHONY: distdiff | |
500 TMP0 = $$HOME/tmp | |
501 TMPPREV = $(TMP0)/$(ARCPREV) | |
502 TMPCURR = $(TMP0)/$(ARCHIVE) | |
503 distdiff: | |
504 @echo "** Building the diff distribution" | |
505 @echo "Creating the diff" | |
506 rm -rf $(TMPPREV) $(TMPCURR) $(TMPDIFF) | |
507 mkdir -p $(TMP0) | |
508 tar -xzf $(ARCHIVE).tar.gz -C $(TMP0) | |
509 tar -xzf ../yadex-arc/pub/$(ARCPREV).tar.gz -C $(TMP0) | |
510 scripts/process docsrc/README.diff >$(TMP0)/$(ARCDIFF) | |
511 echo >>$(TMP0)/$(ARCDIFF) | |
512 cd $(TMP0) && (diff -uaNr $(ARCPREV) $(ARCHIVE) >>$(ARCDIFF) || true) | |
513 @# KLUDGE - On my system, just "! grep" makes make choke | |
514 true; ! grep "^Binary files .* and .* differ" $(TMP0)/$(ARCDIFF) | |
515 gzip -f $(TMP0)/$(ARCDIFF) | |
516 @echo "Verifying the diff" | |
517 cd $(TMPPREV) && gzip -d <../$(ARCDIFF).gz | patch -p1 | |
518 @# FIXME remove -N after 1.6 is done, it's there because | |
519 @# uptodate has been moved between 1.5 and 1.6 and since | |
520 @# it's empty it remains in $(ARCPREV). | |
521 cd $(TMP0) && diff -rP $(ARCHIVE) $(ARCPREV) | |
522 mv $(TMP0)/$(ARCDIFF).gz . | |
523 @echo "Cleaning up" | |
524 cd $(TMP0) && rm -rf $(ARCPREV) | |
525 cd $(TMP0) && rm -rf $(ARCHIVE) | |
526 | |
527 .PHONY: showconf | |
528 showconf: | |
529 @echo "ARCHIVE \"$(ARCHIVE)\"" | |
530 @echo "BINDIR \"$(BINDIR)\"" | |
531 @echo "CC \"$(CC)\"" | |
532 @echo "CFLAGS \"$(CFLAGS)\"" | |
533 @echo "CXX \"$(CXX)\"" | |
534 @echo "CXXFLAGS \"$(CXXFLAGS)\"" | |
535 @echo "DCFLAGS \"$(DCFLAGS)\"" | |
536 @echo "DCXXFLAGS \"$(DCXXFLAGS)\"" | |
537 @echo "DLDFLAGS \"$(DLDFLAGS)\"" | |
538 @echo "ETCDIR \"$(ETCDIR)\"" | |
539 @echo "ETCDIRNV \"$(ETCDIRNV)\"" | |
540 @echo "HAVE_GETTIMEOFDAY \"$(HAVE_GETTIMEOFDAY)\"" | |
541 @echo "HAVE_NANOSLEEP \"$(HAVE_NANOSLEEP)\"" | |
542 @echo "HAVE_SNPRINTF \"$(HAVE_SNPRINTF)\"" | |
543 @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
|
544 @echo "HAVE_READLINE \"$(HAVE_READLINE)\"" |
0 | 545 @echo "LDFLAGS \"$(LDFLAGS)\"" |
546 @echo "MANDIR \"$(MANDIR)\"" | |
547 @echo "OS \"$(OS)\"" | |
548 @echo "PREFIX \"$(PREFIX)\"" | |
549 @echo "SHAREDIR \"$(SHAREDIR)\"" | |
550 @echo "SHAREDIRNV \"$(SHAREDIRNV)\"" | |
551 @echo "SHELL \"$(SHELL)\"" | |
552 @echo "SYSTEM \"$(SYSTEM)\"" | |
553 @echo "VERSION \"$(VERSION)\"" | |
554 @echo "X11INCLUDEDIR \"$(X11INCLUDEDIR)\"" | |
555 @echo "X11LIBDIR \"$(X11LIBDIR)\"" | |
556 @echo "CXX --version \"`$(CXX) --version`\"" | |
557 @echo "CC --version \"`$(CC) --version`\"" | |
558 @echo "shell \"$$SHELL\"" | |
559 @echo "uname \"`uname`\"" | |
560 | |
561 | |
562 ######################################################################## | |
563 # | |
564 # Internal targets, not meant | |
565 # to be invoked directly | |
566 # | |
567 ######################################################################## | |
568 | |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
569 # If Makefile.config or config.h don't exist, give a hint... |
0 | 570 $(OBJDIR)/Makefile.config: |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
571 $(OBJDIR)/config.h: |
0 | 572 @echo "Sorry guv'nor, but... did you run ./configure ?" >&2 |
573 @false | |
574 | |
575 $(OBJDIR)/files_etc.man: $(OBJDIR)/config.etc $(MAKEFILE) | |
576 sed 's/%v/$(VERSION)/g; s,.*,.B &/yadex.cfg,' $< >$@ | |
577 | |
578 $(OBJDIR)/files_share.man: $(OBJDIR)/config.share $(MAKEFILE) | |
579 sed 's/%v/$(VERSION)/g; s,.*,.BI &/ game .ygd,' $< >$@ | |
580 | |
581 # Dependencies of the modules of Yadex | |
582 # -Y is here to prevent the inclusion of dependencies on | |
583 # /usr/include/*.h etc. As a side-effect, it generates many | |
584 # warnings, hence "2>/dev/null". | |
585 # | |
586 # The purpose of the awk script is to transform this input : | |
587 # | |
588 # src/foo.o: src/whatever.h | |
589 # | |
590 # into this output : | |
591 # | |
592 # obj/0/foo.o: src/whatever.h | |
593 # dobj/0/foo.o: src/whatever.h | |
594 # | |
595 # Note: the modules of Atclib are not scanned as they all | |
596 # depend on $(HEADERS_ATCLIB) and nothing else. | |
597 | |
2
70951bfb02b1
Fix a dependency problem. Old patch from André Majorel.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
598 yadex.dep: $(SRC_NON_GEN) src/config.h |
0 | 599 @echo "Generating $@" |
600 @makedepend -f- -Y -Iatclib $(SRC_NON_GEN) 2>/dev/null \ | |
601 | awk 'sub (/^src/, "") == 1 { \ | |
602 print "'$(OBJDIR)'" $$0; \ | |
603 print "'$(DOBJDIR)'" $$0; \ | |
604 next; \ | |
605 }' >$@ | |
606 | |
607 cache/copyright.man: $(MAKEFILE) scripts/copyright docsrc/copyright | |
608 scripts/copyright -m docsrc/copyright >$@ | |
609 | |
610 cache/copyright.txt: $(MAKEFILE) scripts/copyright docsrc/copyright | |
611 scripts/copyright -t docsrc/copyright | sed 's/^./ &/' >$@ | |
612 | |
613 # The YYYY-MM-DD date indicated in the parentheses after the | |
614 # version number is the mtime of the most recent source file | |
615 # (where "being a source file" is defined as "being listed in | |
616 # $(SRC_NON_GEN)"). That string is the output of a perl script, | |
617 # scripts/youngest. Since perl is not necessarily installed on | |
618 # all machines, we cache that string in the file cache/srcdate | |
619 # and include that file in the distribution archive. If we | |
620 # didn't do that, people who don't have perl would be unable to | |
621 # build Yadex. | |
622 # | |
623 # Conceptually, cache/srcdate depends on $(SRC_NON_GEN) and | |
624 # doc/*.html depend on cache/srcdate. However, we can't write the | |
625 # makefile that way because if we did, that would cause two | |
626 # problems. Firstly every time a source file is changed, | |
627 # scripts/youngest would be ran, most of the time for nothing | |
628 # since its output is always the same, unless it's never been | |
629 # run today. Secondly, cache/srcdate being just generated, it's | |
630 # more recent than the content of the doc/ directory. The result | |
631 # would be that the entire doc/ directory would be rebuilt every | |
632 # time a single source file is changed, which is guaranteed to | |
633 # have an unnerving effect on the hacker at the keyboard. | |
634 # | |
635 # Part of the solution is to systematically force the mtime of | |
636 # cache/srcdate to 00:00, today. Thus, cache/srcdate always looks | |
637 # older than the content of the doc/ directory, unless it's not | |
638 # been refreshed yet today. | |
639 # | |
640 # But that's not enough because then cache/srcdate also looks | |
641 # always older than the source files it depends on, and thus | |
642 # make attempts to regenerate it every time make is invoked at | |
643 # all, which would render the very existence of cache/srcdate | |
644 # useless. That's why we have another file, cache/uptodate, that | |
645 # we touch to keep track of the time when we last generated | |
646 # cache/srcdate. | |
647 # | |
648 # If there was a such thing as _date-only_ dependencies, I could | |
649 # get away with just this : | |
650 # | |
651 # cache/srcdate: scripts/youngest | |
652 # cache/srcdate <date_dependency_operator> $(SRC_NON_GEN) | |
653 # if perl -v >/dev/null 2>&1; then\ | |
654 # scripts/youngest >$@;\ | |
655 # else\ | |
656 # blah... | |
657 # doc/*.html <date_dependency_operator> cache/srcdate | |
658 # blah... | |
659 # | |
660 # That would save two calls to "touch", one intermediary | |
661 # dependency (cache/uptodate) and a lot of obfuscation. | |
662 cache/srcdate: cache/uptodate | |
663 | |
664 cache/uptodate: scripts/youngest $(SRC_NON_GEN) | |
665 @mkdir -p cache | |
666 @if perl -v >/dev/null 2>&1; then \ | |
667 echo Generating cache/srcdate; \ | |
668 scripts/youngest $(SRC_NON_GEN) >cache/srcdate; \ | |
669 touch -t `date '+%m%d'`0000 cache/srcdate; \ | |
670 elif [ -r cache/srcdate ]; then \ | |
671 echo Perl not available. Keeping old cache/srcdate; \ | |
672 else \ | |
673 echo Perl not available. Creating bogus cache/srcdate; \ | |
674 date '+%Y-%m-%d' >cache/srcdate; \ | |
675 fi | |
676 @touch $@; | |
677 | |
678 # To compile the modules of Yadex | |
679 # (normal and debugging versions) | |
680 include yadex.dep | |
681 | |
682 # It's simpler to copy config.cc into src/ than to have a | |
683 # compilation rule for just one file. | |
684 src/config.cc: $(OBJDIR)/config.cc | |
685 cp -p $< $@ | |
686 | |
687 src/config.h: $(OBJDIR)/config.h | |
688 cp -p $< $@ | |
689 | |
690 $(OBJDIR)/%.o: src/%.cc | |
111
51d5549a1bdc
Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
691 $(CXX) -c -Iatclib -I$(X11INCLUDEDIR) $(CXXFLAGS) $< -o $@ |
0 | 692 |
693 $(DOBJDIR)/%.o: src/%.cc | |
111
51d5549a1bdc
Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
694 $(CXX) -c -Iatclib -I$(X11INCLUDEDIR) $(DCXXFLAGS) $< -o $@ |
0 | 695 |
696 # To compile the modules of Atclib | |
697 # (normal and debugging versions) | |
698 $(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
|
699 $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ |
0 | 700 |
701 $(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
|
702 $(CC) -c $(DCFLAGS) $(EXTRA_CFLAGS) $< -o $@ |
0 | 703 |
704 # To see the generated assembly code | |
705 # for the modules of Yadex | |
706 $(OBJDIR)/%.S: src/%.cc $(MAKEFILE) | |
111
51d5549a1bdc
Remove the ancient copy and use of Boost lib subset, use standard C++11 smart_ptr instead.
Matti Hamalainen <ccr@tnsp.org>
parents:
80
diff
changeset
|
707 $(CXX) $(CXXFLAGS) $(EXTRA_CXXFLAGS) -S -fverbose-asm -Iatclib -I$(X11INCLUDEDIR)\ |
0 | 708 $< -o $@ |
709 | |
710 # A source file containing the credits | |
711 src/credits.cc: $(MAKEFILE) docsrc/copyright scripts/copyright | |
712 @echo Generating $@ | |
713 @echo '// DO NOT EDIT -- generated from docsrc/copyright' >$@ | |
714 scripts/copyright -c docsrc/copyright >>$@ | |
715 | |
716 # A source file containing just the date of the | |
717 # most recent source file and the version number | |
718 # (found in ./VERSION) | |
719 src/version.cc: $(SRC_NON_GEN) VERSION cache/srcdate $(MAKEFILE) | |
720 @echo Generating $@ | |
721 @printf '// DO NOT EDIT -- generated from VERSION\n\n' >$@ | |
722 @printf "extern const char *const yadex_source_date = \"%s\";\n" \ | |
723 `cat cache/srcdate` >>$@ | |
724 @printf "extern const char *const yadex_version = \"%s\";\n" \ | |
725 "$(VERSION)" >>$@ | |
726 | |
727 | |
728 # -------- Doc-related stuff -------- | |
729 | |
730 docdirs: | |
731 @if [ ! -d doc ]; then mkdir doc; fi | |
732 | |
733 cache/pixlist: $(DOC2_SRC_HTML) | |
734 @echo Generating $@ | |
735 @mkdir -p cache | |
736 @if perl -v >/dev/null 2>/dev/null; then \ | |
737 perl -ne '@l = m/<img\s[^>]*src="?([^\s">]+)/io; \ | |
738 print "@l\n" if @l;' $(DOC2_SRC_HTML) | sort | uniq >$@; \ | |
739 elif [ -f $@ ]; then \ | |
740 echo "Sorry, you need Perl to refresh $@. Keeping old $@."; \ | |
741 else \ | |
742 echo "Sorry, you need Perl to create $@. Creating empty $@."; \ | |
743 touch $@; \ | |
744 fi | |
745 | |
746 events.html: ev evhtml | |
747 evhtml -- -n $< >$@ | |
748 | |
749 events.txt: events.html | |
750 lynx -dump $< >$@ | |
751 | |
752 changes/changes.html: changes/*.log log2html RELEASE | |
753 ./log2html -- -r `cat RELEASE` -- $$(ls -r changes/*.log) >$@ | |
754 | |
755 # changes - update the changelog | |
756 .PHONY: changes | |
757 changes: changes/changes.html | |
758 w3m -dump -cols 72 $< >CHANGES | |
759 | |
760 # cns - view the changelog with Netscape | |
761 .PHONY: cns | |
762 cns: | |
763 netscape -remote "openURL(file:$$(pwd)/changes/changes.html,new-window)" | |
764 | |
765 # clynx - view the changelog with Lynx | |
766 .PHONY: clynx | |
767 clynx: | |
768 lynx changes/changes.html | |
769 | |
770 # cless - view the changelog with less | |
771 .PHONY: cless | |
772 cless: | |
773 less CHANGES | |
774 | |
775 # man - view the man page with man | |
776 .PHONY: man | |
777 man: doc/yadex.6 | |
778 man -l $^ | |
779 | |
780 # dvi - view the man page with xdvi | |
781 .PHONY: dvi | |
782 dvi: doc/yadex.dvi | |
783 xdvi $^ | |
784 | |
785 # ps - view the man page with gv | |
786 .PHONY: ps | |
787 ps: doc/yadex.ps | |
788 gv $^ | |
789 | |
790 # Use docsrc/faq.html and not directly | |
791 # doc/faq.html because we don't want FAQ to be | |
792 # remade at first build time. | |
793 FAQ: docsrc/faq.html | |
794 scripts/process $< >cache/faq.html | |
795 links -width 72 -dump cache/faq.html >$@ | |
796 rm cache/faq.html | |
797 | |
798 doc/yadex.dvi: doc/yadex.6 | |
799 groff -Tdvi -man $^ >$@ | |
800 | |
801 doc/yadex.ps: doc/yadex.6 | |
802 groff -Tps -man $^ >$@ | |
803 | |
804 | |
805 # Generate the doc by filtering them through scripts/process | |
806 PROCESS = \ | |
807 VERSION \ | |
808 cache/copyright.man \ | |
809 cache/copyright.txt \ | |
810 cache/srcdate \ | |
811 scripts/process \ | |
812 $(OBJDIR)/ftime \ | |
813 $(OBJDIR)/files_etc.man \ | |
814 $(OBJDIR)/files_share.man \ | |
815 $(OBJDIR)/notexist | |
816 | |
817 doc/yadex.6: docsrc/yadex.6 $(PROCESS) | |
818 @echo Generating $@ | |
819 @scripts/process $< >$@ | |
820 | |
821 doc/README: docsrc/README.doc $(PROCESS) | |
822 @echo Generating $@ | |
823 @scripts/process $< >$@ | |
824 | |
825 %: docsrc/% $(PROCESS) | |
826 @echo Generating $@ | |
827 @scripts/process $< >$@ | |
828 | |
829 doc/%.html: docsrc/%.html $(PROCESS) | |
830 @echo Generating $@ | |
831 @scripts/process $< >$@ | |
832 | |
833 # The images are just symlinked from docsrc/ to doc/ | |
834 doc/%.png: docsrc/%.png | |
835 @rm -f $@ | |
836 @ln -s ../$< $@ | |
837 | |
838 $(OBJDIR)/ftime: scripts/ftime.c | |
839 $(CC) $< -o $@ | |
840 | |
841 $(OBJDIR)/install: scripts/install.c | |
842 $(CC) $< -o $@ | |
843 | |
844 $(OBJDIR)/notexist: scripts/notexist.c | |
845 $(CC) $< -o $@ | |
846 | |
847 |