source: trunk/Makefile

Last change on this file was 19446, checked in by westram, 12 months ago
  • introduce onlyC_flags
    • flags used for C compilation only.
    • similar to cxxflags (references added).
    • pass down onlyC_flags into AxML, CLUSTAL, CLUSTALW, FASTDNAML, FASTTREE, GL, MrBAYES, PHYLIP, PHYML*, RAxML, SINA(unused), SOURCE_TOOLS, SUPPORT, TOOLS, TREEGEN + TREEPUZZLE.
    • set flags to -Werror-implicit-function-declaration
      • error is only effective in a small part of these modules.
      • TODO need to activate warnings → will activate the error as well.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 87.6 KB
Line 
1# =============================================================== #
2#                                                                 #
3#   File      : Makefile                                          #
4#                                                                 #
5#   Institute of Microbiology (Technical University Munich)       #
6#   http://www.arb-home.de/                                       #
7#                                                                 #
8# =============================================================== #
9
10# -----------------------------------------------------
11# The ARB Makefile is aware of the following defines:
12#
13# CC                    C compiler (should be defined by OS)
14# CXX                   C++ compiler (should be defined by OS)
15#
16# DEVELOPER=name        special compilation (values: ANY,RELEASE,your name)
17# OPENGL=0/1            whether OPENGL is available
18#
19# -----------------------------------------------------
20# Paths for several libraries may be set from config.makefile by using:
21#
22#     export XLIBS=$(shell pkg-config --libs xpm xerces-c)
23#     export XINCLUDES=$(shell pkg-config --cflags x11)
24#     export XAW_LIBS=$(shell pkg-config --libs xaw7)
25#     export XML_INCLUDES=$(shell pkg-config --cflags xerces-c)
26#
27# You make have to explicitely point pkg-config to the *.pc files needed.
28# For example, Xquartz X11 libraries on macOS can be located by adding
29# the following line before those given above:
30#
31#     export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig
32#
33# If you introduce a new variable that is handled as described above,
34# please add to section .@InjectedEnvironment
35#
36# -----------------------------------------------------
37# ARB Makefile and ARB source code are aware of the following defines:
38#
39# $(MACH)               name of the machine (LINUX or DARWIN; see config.makefile)
40# DEBUG                 compiles the DEBUG sections
41# DEBUG_GRAPHICS        all X-graphics are flushed immediately (for debugging)
42# ARB_64=0/1            1=>compile 64 bit version
43# UNIT_TESTS=0/1        1=>compile in unit tests and call them after build
44# COVERAGE=0/1/2        compile in gcov support (useful together with UNIT_TESTS=1)
45#                       0=no, 1+2=compile in, 1=show
46# STABS=0/1             force stabs format? (0 = "use default format")
47# SANITIZE=0/#/all      use Sanitizer? (defaults to 0,
48#                                       1=AddressSanitizer+LeakSanitizer,
49#                                       2=UndefinedBehaviorSanitizer,
50#                                       combine bit-values to activate multiple Sanitizers,
51#                                       specify 'all' to activate all)
52# IGNORE_LEAKS=1        does not abort when leaks are detected (while using SANITIZE=1/all)
53# SHOWTODO=0/1          activate TODO-warnings? (defaults to 0, except for ralf)
54#
55# -----------------------------------------------------
56# The ARB source code is aware of the following defines:
57#
58# NDEBUG                doesn't compile the DEBUG sections
59# DEVEL_$(DEVELOPER)    developer-dependent flag (enables you to have private sections in code)
60#                       DEVELOPER='ANY' (default setting) will be ignored
61#                       configurable in config.makefile
62#
63# -----------------------------------------------------
64
65ifndef ARB_ORG_MAKEFLAGS
66 ARB_ORG_MAKEFLAGS=$(MAKEFLAGS)
67else
68 ifeq ($(ARB_ORG_MAKEFLAGS),)
69  ARB_ORG_MAKEFLAGS=$(MAKEFLAGS)
70 endif
71endif
72
73# Read configuration
74include config.makefile
75CONFIG_MAKEFILE_FOUND=$(strip $(wildcard config.makefile))
76
77# strip spaces from values defined in config.makefile
78# (otherwise they easily have spaces appended)
79ifdef DEVELOPER
80 DEVELOPER := $(strip $(DEVELOPER))
81endif
82ifdef OPENGL
83 OPENGL := $(strip $(OPENGL))
84endif
85ifdef ISINA
86 ISINA := $(strip $(ISINA))
87endif
88ifdef DEBUG
89 DEBUG := $(strip $(DEBUG))
90endif
91ifdef UNIT_TESTS
92 UNIT_TESTS := $(strip $(UNIT_TESTS))
93endif
94ifdef COVERAGE
95 COVERAGE := $(strip $(COVERAGE))
96endif
97ifdef SHOWTODO
98 SHOWTODO := $(strip $(SHOWTODO))
99endif
100ifdef STABS
101 STABS := $(strip $(STABS))
102endif
103ifdef TRACESYM
104 TRACESYM := $(strip $(TRACESYM))
105endif
106ifdef DEBUG_GRAPHICS
107 DEBUG_GRAPHICS := $(strip $(DEBUG_GRAPHICS))
108endif
109
110# set defaults for (or strip) variables commented out in config.makefile:
111ifdef SANITIZE
112 SANITIZE := $(strip $(SANITIZE))
113else
114 SANITIZE:=0
115endif
116ifdef IGNORE_LEAKS
117 IGNORE_LEAKS := $(strip $(IGNORE_LEAKS))
118else
119 IGNORE_LEAKS:=0
120endif
121ifndef DARWIN
122 DARWIN:=0
123else
124 DARWIN := $(strip $(DARWIN))
125endif
126ifndef LINUX
127 LINUX:=0
128else
129 LINUX := $(strip $(LINUX))
130endif
131ifndef DEBIAN
132 DEBIAN:=0
133else
134 DEBIAN := $(strip $(DEBIAN))
135endif
136ifndef ARB_64
137 ARB_64=1#default to 64bit
138else
139 ARB_64 := $(strip $(ARB_64))
140endif
141
142# Variables allowed for injection [InjectedEnvironment]
143# (alternatively initialize them with '?=', e.g. done for XLIBS and XINCLUDES)
144# In both cases add them to SOURCE_TOOLS/export2sub
145ifndef XML_INCLUDES
146 XML_INCLUDES=
147endif
148ifndef XAW_LIBS
149 XAW_LIBS=
150endif
151
152
153ifneq ($(CONFIG_MAKEFILE_FOUND),)
154 ifneq ($(DARWIN)$(LINUX),10)
155  ifneq ($(DARWIN)$(LINUX),01)
156   $(error exactly one of DARWIN=1 or LINUX=1 has to be defined (got:$(DARWIN)$(LINUX)))
157  endif
158 endif
159endif
160
161# compiler settings:
162ifneq ($(CC),use__A_CC__instead_of__CC)
163 A_CC:=$(CC)# compile C
164 A_CXX:=$(CXX)# compile C++
165
166# uncomment to ensure no submakefile uses CC and CXX directly
167 override CC:=use__A_CC__instead_of__CC
168 override CXX:=use__A_CXX__instead_of__CXX
169endif
170
171export CC CXX A_CC A_CXX
172
173# unconditionally prepend $(ARBHOME)/lib to LD_LIBRARY_PATH if not found
174ifeq ($(findstring $(ARBHOME)/lib,$(LD_LIBRARY_PATH)),)
175 LD_LIBRARY_PATH:=${ARBHOME}/lib:$(LD_LIBRARY_PATH)
176endif
177
178# store LD_LIBRARY_PATH to circumvent SIP restrictions:
179ARBBUILD_LIBRARY_PATH:=$(LD_LIBRARY_PATH)
180
181FORCEMASK = umask 002
182NODIR=--no-print-directory
183
184SED:=$(ARBHOME)/SH/arb_sed
185READLINK:=$(ARBHOME)/SH/arb_readlink
186
187# ---------------------- compiler version detection
188
189# supported gcc versions:
190ALLOWED_gcc_VERSIONS=\
191                        4.4.3         4.4.5  4.4.6  4.4.7 \
192                 4.5.2  \
193          4.6.1  4.6.2  4.6.3  4.6.4 \
194          4.7.1  4.7.2  4.7.3  4.7.4 \
195   4.8.0  4.8.1  4.8.2  4.8.3  4.8.4  4.8.5 \
196   4.9.0  4.9.1  4.9.2  4.9.3  4.9.4 \
197   5.1.0  5.2.0  5.3.0  5.4.0  5.5.0 \
198   6.1.0  6.2.0  6.3.0  6.4.0  6.5.0 \
199   7.1.0  7.2.0  7.3.0  7.4.0  7.5.0 \
200   8.1.0  8.2.0  8.3.0  8.4.0  8.5.0 \
201   9.1.0  9.2.0  9.3.0  9.4.0  9.5.0 \
202  10.1.0 10.2.0 10.3.0 10.4.0 10.5.0 \
203
204# Note: starting with version 5, arb silently accepts any subversion number
205# above zero. See SOURCE_TOOLS/arb_compiler_version.pl@acceptSubVersions
206#
207# This may cause problems when manually checking for compiler versions in code
208# (GCC_VERSION_CODE is not affected, GCC_PATCHLEVEL_CODE may cause problems!)
209# ----------------------
210
211COMPILER_INFO:=$(shell SOURCE_TOOLS/arb_compiler_version.pl $(A_CXX))
212COMPILER_NAME:=$(word 1,$(COMPILER_INFO))
213COMPILER_VERSION:=$(word 2,$(COMPILER_INFO))
214
215USE_CLANG:=0
216ifneq ($(COMPILER_NAME),gcc)
217 ifeq ($(COMPILER_NAME),clang)
218  USE_CLANG:=1
219 else
220  ifeq ($(COMPILER_VERSION),4.6.4)
221#  gcc version 4.6.4 segfaults when dumping symbols for detection (silently accept as gcc)
222   COMPILER_NAME:=gcc
223  else
224   $(error failed to detect COMPILER_NAME (got '$(COMPILER_NAME)', expected 'clang' or 'gcc'))
225  endif
226 endif
227endif
228
229ifeq ($(USE_CLANG),1)
230# accept all clang versions:
231 ALLOWED_COMPILER_VERSIONS=$(COMPILER_VERSION)
232else
233 ALLOWED_COMPILER_VERSIONS=$(ALLOWED_gcc_VERSIONS)
234endif
235
236COMPILER_VERSION_ALLOWED=$(strip $(subst ___,,$(foreach version,$(ALLOWED_COMPILER_VERSIONS),$(findstring ___$(version)___,___$(COMPILER_VERSION)___))))
237
238#---------------------- split gcc version
239
240SPLITTED_VERSION:=$(subst ., ,$(COMPILER_VERSION))
241
242USE_GCC_MAJOR:=$(word 1,$(SPLITTED_VERSION))
243USE_GCC_MINOR:=$(word 2,$(SPLITTED_VERSION))
244USE_GCC_PATCHLEVEL:=$(word 3,$(SPLITTED_VERSION))
245
246USE_GCC_452_OR_HIGHER:=
247USE_GCC_46_OR_HIGHER:=
248USE_GCC_47_OR_HIGHER:=
249USE_GCC_48_OR_HIGHER:=
250USE_GCC_49_OR_HIGHER:=
251USE_GCC_50_OR_HIGHER:=
252USE_GCC_60_OR_HIGHER:=
253USE_GCC_70_OR_HIGHER:=
254USE_GCC_80_OR_HIGHER:=
255USE_GCC_90_OR_HIGHER:=
256
257ifeq ($(USE_CLANG),0)
258 ifeq ($(USE_GCC_MAJOR),4)
259  ifeq ($(USE_GCC_MINOR),5)
260   ifneq ('$(findstring $(USE_GCC_PATCHLEVEL),23456789)','')
261    USE_GCC_452_OR_HIGHER:=yes
262   endif
263  else
264   ifneq ('$(findstring $(USE_GCC_MINOR),6789)','')
265    USE_GCC_452_OR_HIGHER:=yes
266    USE_GCC_46_OR_HIGHER:=yes
267    ifneq ($(USE_GCC_MINOR),6)
268     USE_GCC_47_OR_HIGHER:=yes
269     ifneq ($(USE_GCC_MINOR),7)
270      USE_GCC_48_OR_HIGHER:=yes
271       ifneq ($(USE_GCC_MINOR),8)
272        USE_GCC_49_OR_HIGHER:=yes
273       endif
274     endif
275    endif
276   endif
277  endif
278 else
279  # gcc 5.x or higher
280  USE_GCC_452_OR_HIGHER:=yes
281  USE_GCC_46_OR_HIGHER:=yes
282  USE_GCC_47_OR_HIGHER:=yes
283  USE_GCC_48_OR_HIGHER:=yes
284  USE_GCC_49_OR_HIGHER:=yes
285  USE_GCC_50_OR_HIGHER:=yes
286  ifneq ($(USE_GCC_MAJOR),5)
287   # gcc 6.x or higher
288   USE_GCC_60_OR_HIGHER:=yes
289   ifneq ($(USE_GCC_MAJOR),6)
290    # gcc 7.x or higher
291    USE_GCC_70_OR_HIGHER:=yes
292    ifneq ($(USE_GCC_MAJOR),7)
293     # gcc 8.x or higher
294     USE_GCC_80_OR_HIGHER:=yes
295     ifneq ($(USE_GCC_MAJOR),8)
296      # gcc 9.x or higher
297      USE_GCC_90_OR_HIGHER:=yes
298     endif
299    endif
300   endif
301  endif
302 endif
303endif
304
305#---------------------- define special directories for non standard builds
306
307ifeq ($(DARWIN),1)
308 OSX_FW:=/System/Library/Frameworks
309 OSX_FW_OPENGL:=$(OSX_FW)/OpenGL.framework/Versions/A/Libraries
310 OSX_FW_GLUT:=$(OSX_FW)/GLUT.framework/Versions/A/Libraries
311 OSX_FW_IMAGEIO:=$(OSX_FW)/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources
312endif
313
314#---------------------- SSE vectorization
315# for details about vectorization checks see SOURCE_TOOLS/vectorize.README
316
317DISABLE_VECTORIZE_CHECK:=0#         set to 1 to completely disable vectorization checks
318TRACE_MISSED_VECTORIZATIONS:=0#     set to 1 to activate detailed output about failed vectorizations
319#                                   (does also show details about successful vectorized loops, which are not optimal)
320VECTORIZATION_CHECK_CANDIDATES:=0#  set to 1 to show vectorizations that may be checked
321#                                   (for yet unchecked files)
322# Note: TRACE_MISSED_VECTORIZATIONS and VECTORIZATION_CHECK_CANDIDATES cannot be used together!
323
324#---------------------- Support for OPENMP
325
326USE_OPENMP:=1
327ifeq ($(DARWIN),1)
328        USE_OPENMP:=0
329endif
330
331#----------------------
332
333ifeq ($(DARWIN),1)
334 LINK_STATIC=1# link static
335else
336 LINK_STATIC=0# link dynamically
337#  LINK_STATIC=1# link static (testing only)
338endif
339
340shared_cflags :=# flags for shared lib compilation
341onlyC_flags :=# flags only suitable for C (not C++; see cxxflags).
342clflags :=# linker flags (when passed through gcc)
343extended_warnings :=# warning flags for C and C++-compiler
344extended_cpp_warnings :=# warning flags for C++-compiler only
345
346ifeq ($(DEBUG),0)
347 dflags := -DNDEBUG# defines
348 ifeq ($(USE_CLANG),1)
349  cflags := -O3# compiler flags (C and C++)
350 else
351  clflags += -Wl,-O2# passthrough linker flags
352# ------- standard optimization:
353  cflags := -O3# compiler flags (C and C++)
354# ------- test changed optimization (DISABLE_VECTORIZE_CHECK for -O2 or lower):
355#  cflags := -O2# do not commit uncommented!
356#  DISABLE_VECTORIZE_CHECK:=1
357 endif
358endif
359
360ifeq ($(DEBIAN),1)
361 clflags += -Wl,-rpath=/usr/lib/arb/lib -Wl,-z,relro
362endif
363
364ifeq ($(DEBUG),1)
365 dflags := -DDEBUG
366
367 gdb_common := -g -g3 -ggdb -ggdb3
368
369 DBGOPTI:=-O0
370 ifneq ('$(SANITIZE)','0')
371  # sanitizer report several bogus buffer-overflows when arb is build with -O0 (e.g. with gcc 7.5.0)
372  DBGOPTI:=-O1
373 endif
374
375 ifeq ($(STABS),1)
376  $(error STABS no longer supported)
377 endif
378
379 cflags := $(DBGOPTI) $(gdb_common)
380 # cflags := -O2 $(gdb_common) # use this for callgrind (force inlining)
381
382 ifeq ($(DARWIN),0)
383  clflags += -Wl,-g
384# Note:
385# Previously '-Wl,-noinhibit-exec' was added to 'clflags' here,
386# to fix some issues with launchpad binutils (see [12972]).
387# But that change also caused 'undefined symbols' NOT to be reported as errors
388# at link time, producing executables that fail at runtime :/
389 endif
390
391 ifeq ($(DEBUG_GRAPHICS),1)
392  dflags += -DDEBUG_GRAPHICS
393 endif
394
395endif # DEBUG only
396
397# ------------------------------ POST_COMPILE - control how much you get spammed
398# (please do not change default in SVN)
399POST_COMPILE := 2>&1 | $(ARBHOME)/SOURCE_TOOLS/postcompile.pl
400
401# POST_COMPILE += --original                                  # dont modify compiler output
402# POST_COMPILE += --hide-Noncopyable-advices
403# POST_COMPILE += --show-useless-Weff++
404# POST_COMPILE += --no-warnings
405# POST_COMPILE += --only-first-error
406# POST_COMPILE += --no-warnings --only-first-error
407
408# always pass used compiler version to postcompile:
409POST_COMPILE += --compiler=$(COMPILER_VERSION)
410
411# ------------------------------
412
413# Enable extra warnings
414extended_warnings :=
415extended_cpp_warnings :=
416
417# C and C++
418extended_warnings     += -Wwrite-strings -Wunused -Wno-aggregate-return
419
420ifeq ('$(USE_GCC_50_OR_HIGHER)','yes')
421# disable shadow warnings for gcc 4.8 (and lower)
422# (does e.g. warn if a method-name is used as parameter in another method - even for derived classes. unusable!)
423extended_warnings     += -Wshadow
424endif
425
426# C++ only
427extended_cpp_warnings += -Wnon-virtual-dtor -Wreorder -Wpointer-arith -Wdisabled-optimization -Wmissing-format-attribute
428extended_cpp_warnings += -Wctor-dtor-privacy
429# extended_cpp_warnings += -Wfloat-equal
430
431extended_cpp_warnings += -Wmissing-noreturn
432# extended_cpp_warnings += -Wold-style-cast# (warns about 28405 old-style casts)
433extended_cpp_warnings += -Winit-self
434extended_cpp_warnings += -Wstrict-aliasing
435extended_cpp_warnings += -Wextra
436
437# ------- above only warning-options already available in gcc 4.4.3
438
439#  -Weffc++ broken in 4.7.x series
440# gcc 4.7.3 crashes on GenomeImport.cxx when -Weffc++ is active
441# (bug reported https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56923; apparently wont be fixed for 4.7-series)
442# gcc 4.7.4 crashes on DBwriter.cxx when -Weffc++ is active
443WEFFC_BROKEN:=0
444ifeq ('$(USE_GCC_47_OR_HIGHER)','yes')
445 ifneq ('$(USE_GCC_48_OR_HIGHER)','yes')
446  WEFFC_BROKEN:=1
447 endif
448endif
449ifeq ('$(WEFFC_BROKEN)','0')
450 extended_cpp_warnings += -Weffc++
451endif
452
453# turn off -Wmaybe-uninitialized in debug mode (gets activated with -Wextra). too many bogus warnings
454ifeq ($(DEBUG),1)
455 ifeq ($(USE_CLANG),0)
456  extended_cpp_warnings += -Wno-maybe-uninitialized
457 endif
458endif
459
460SUGGEST_FINAL:=
461
462ifeq ('$(USE_GCC_452_OR_HIGHER)','yes')
463 extended_cpp_warnings += -Wlogical-op# gcc 4.5.2
464endif
465ifeq ('$(USE_GCC_47_OR_HIGHER)','yes')
466 extended_cpp_warnings += -Wzero-as-null-pointer-constant# gcc 4.7
467endif
468ifeq ('$(USE_GCC_48_OR_HIGHER)','yes')
469 extended_cpp_warnings += -Wunused-local-typedefs# available since gcc 4.7 (but fails for each STATIC_ASSERT, so enable only for Cxx11)
470endif
471ifeq ('$(USE_GCC_50_OR_HIGHER)','yes')
472 extended_cpp_warnings += -Wswitch-bool
473 extended_cpp_warnings += -Wlogical-not-parentheses
474 extended_cpp_warnings += -Wsizeof-array-argument
475 extended_cpp_warnings += -Wbool-compare
476
477 SUGGEST_FINAL:=yes
478endif
479ifeq ('$(USE_GCC_60_OR_HIGHER)','yes')
480 extended_cpp_warnings += -Wduplicated-cond
481endif
482ifeq ('$(USE_GCC_80_OR_HIGHER)','yes')
483 extended_cpp_warnings += -Wmultistatement-macros
484endif
485
486# switch off final suggestions for 8.3.0 and 8.4.0:
487ifeq ('$(COMPILER_VERSION)','8.3.0')
488 SUGGEST_FINAL:=no
489endif
490ifeq ('$(COMPILER_VERSION)','8.4.0')
491 SUGGEST_FINAL:=no
492endif
493
494ifeq ($(DEVELOPER),RELEASE)
495# switch off final suggestions in RELEASE:
496 SUGGEST_FINAL:=no
497endif
498# suggest final:
499ifeq ('$(SUGGEST_FINAL)','yes')
500  extended_cpp_warnings += -Wsuggest-final-types
501  extended_cpp_warnings += -Wsuggest-final-methods
502  dflags += -DSUGGESTS_FINAL
503endif
504
505#---------------------- turn off clang bogus warnings
506
507ifeq ($(USE_CLANG),1)
508# -Wmismatched-tags warns about struct/class mismatch in forward declarations (which is explicitely allowed)
509# -Wchar-subscripts reports too many bogus warnings for "array['x']" (when 'x' is known to be in range [0..128])
510# -Wunused-private-field report too many false positives (currently ~ 2 of 3)
511# -Wstring-plus-int warns about common ARB coding practice
512# -Wgnu-static-float-init warns about accepted GNU extension
513 extended_cpp_warnings += -Wno-mismatched-tags -Wno-char-subscripts -Wno-unused-private-field -Wno-string-plus-int
514 ifeq ('$(COMPILER_VERSION)','4.2.1')
515# jenkins build (doesn't know switch -Wno-gnu-static-float-init)
516  extended_cpp_warnings += -Wno-gnu
517 else
518  extended_cpp_warnings += -Wno-gnu-static-float-init
519 endif
520endif
521
522#---------------------- developer
523
524ifneq ($(DEVELOPER),ANY) # ANY=default setting (skip all developer specific code)
525 dflags += -DDEVEL_$(DEVELOPER)# activate developer/release specific code
526endif
527
528#---------------------- activate TODO warnings?
529
530ifndef SHOWTODO
531 ifeq ($(DEVELOPER),RALF)
532  SHOWTODO:=1
533 else
534  SHOWTODO:=0
535 endif
536endif
537ifeq ($(SHOWTODO),1)
538 dflags += -DWARN_TODO# activate "TODO" warnings
539endif
540
541#---------------------- activate threads?
542# only useful if compiler is able to compile Cxx11 or better
543
544ifeq ('$(USE_GCC_48_OR_HIGHER)','yes')
545# see also ./TEMPLATES/cxxforward.h@USE_Cxx11
546cflags += -pthread
547clflags += -pthread
548endif
549
550#---------------------- activate Sanitizers?
551
552ASAN_OPTIONS:=handle_segv=0:color=0
553ifeq ($(IGNORE_LEAKS),1)
554 ASAN_OPTIONS+=:detect_leaks=0 # disable leak-detection
555else
556 ASAN_OPTIONS+=:detect_leaks=1 # detect leaks (normal setting)
557endif
558ASAN_OPTIONS+=:check_initialization_order=1
559# ASAN_OPTIONS+=:abort_on_error=1
560
561# suppressions: SOURCE_TOOLS/arb.leaksan.supp
562LSAN_OPTIONS:=max_leaks=3:suppressions=$(ARBHOME)/SOURCE_TOOLS/arb.leaksan.supp
563
564UBSAN_OPTIONS:=print_stacktrace=1
565
566SANITIZE_ADDRESS:=0
567SANITIZE_UNDEFINED:=0
568
569ifneq ($(SANITIZE),0)
570 ifeq ($(SANITIZE),all)
571  SANITIZE:=3
572 endif
573
574 ifeq ($(SANITIZE),1)
575  SANITIZE_ADDRESS:=1
576 else
577  ifeq ($(SANITIZE),2)
578   SANITIZE_UNDEFINED:=1
579  else
580   ifeq ($(SANITIZE),3)
581    SANITIZE_ADDRESS:=1
582    SANITIZE_UNDEFINED:=1
583   else
584    $(error Unknown value '$(SANITIZE)' specified for SANITIZE in config.makefile)
585   endif
586  endif
587 endif
588endif
589
590ifeq ($(SANITIZE_ADDRESS),1)
591 ifneq ('$(USE_GCC_48_OR_HIGHER)','yes')
592  $(info AddressSanitizer not usable with gcc $(COMPILER_VERSION) - disabled)
593  SANITIZE_ADDRESS:=0
594 else
595  ifneq ('$(USE_GCC_49_OR_HIGHER)','yes')
596   $(info LeakSanitizer does not work with gcc $(COMPILER_VERSION) - disabled)
597   # need to disable AddressSanitizer (otherwise build fails; only affects gcc 4.8.x series)
598   SANITIZE_ADDRESS:=0
599  endif
600 endif
601endif
602
603ifeq ($(SANITIZE_UNDEFINED),1)
604 ifneq ('$(USE_GCC_49_OR_HIGHER)','yes')
605  $(info UndefinedBehaviorSanitizer not usable with gcc $(COMPILER_VERSION) - disabled)
606  SANITIZE_UNDEFINED:=0
607 endif
608endif
609
610SANITIZE_ANY:=0
611ifeq ($(SANITIZE_ADDRESS),1)
612 SANITIZE_ANY:=1
613endif
614ifeq ($(SANITIZE_UNDEFINED),1)
615 SANITIZE_ANY:=1
616endif
617
618# vectorization fails if sanitizer active where it normally succeeds -> disable check
619ifeq ($(SANITIZE_ANY),1)
620 $(info disabling vectorize checks. would fail with sanitized code)
621 DISABLE_VECTORIZE_CHECK:=1
622else
623 $(info no sanitizer enabled. reset: SANITIZE=0)
624 SANITIZE:=0
625endif
626
627# deactivate some bogus warnings occurring when sanitizing NDEBUG version
628# (do not disable for future gcc-version >= 8.x -> test again when available)
629ifeq ($(SANITIZE_ANY),1)
630 ifeq ($(DEBUG),0)
631  ifneq ('$(USE_GCC_80_OR_HIGHER)','yes')
632   extended_cpp_warnings += -Wno-format-overflow
633   extended_cpp_warnings += -Wno-maybe-uninitialized
634  endif
635 endif
636endif
637
638#---------------------- 32 or 64 bit
639
640cross_cflags:=
641cross_lflags:=
642cross_clflags:=
643
644ifeq ($(ARB_64),1)
645 dflags += -DARB_64
646 shared_cflags += -fPIC
647 CROSS_LIB:=# empty => autodetect below
648 ifeq ($(DARWIN),1)
649  cross_cflags  += -arch x86_64
650  cross_lflags  += -arch x86_64
651  cross_clflags += -arch x86_64
652 endif
653else
654 CROSS_LIB:=/lib
655endif
656
657cflags  += $(cross_cflags)
658clflags += $(cross_clflags)
659
660ifeq ('$(CROSS_LIB)','')
661# autodetect libdir
662 ifeq ($(ARB_64),1)
663  CROSS_LIB:=$(shell (test -d /lib64 && echo lib64) || echo lib)
664 else
665  CROSS_LIB:=$(shell (test -d /lib32 && echo lib32) || echo lib)
666 endif
667endif
668
669#---------------------- unit tests
670
671ifndef UNIT_TESTS
672 UNIT_TESTS=0#default is "no tests"
673endif
674ifeq ($(UNIT_TESTS),1)
675 dflags += -DUNIT_TESTS
676 UNIT_TESTER_LIB=UNIT_TESTER/UNIT_TESTER.a
677else
678 UNIT_TESTER_LIB=
679endif
680
681#---------------------- use gcov
682
683ifndef COVERAGE
684 COVERAGE=0#default is "no"
685endif
686ifneq ($(COVERAGE),0)
687 GCOV_FLAGS=--coverage
688 $(info disabling vectorize checks. would fail with COVERAGE on)
689 DISABLE_VECTORIZE_CHECK:=1
690else
691 GCOV_FLAGS=
692endif
693
694cflags       += $(GCOV_FLAGS)
695clflags      += $(GCOV_FLAGS)
696cross_lflags += $(GCOV_FLAGS)
697
698#---------------------- other flags
699
700dflags += -D$(MACH) # define machine
701
702ifeq ($(DARWIN),1)
703 shared_cflags += -fno-common
704else
705 dflags +=  $(shell getconf LFS_CFLAGS)
706endif
707
708cflags += -pipe
709cflags += -fmessage-length=0# dont wrap compiler output
710cflags += -fshow-column# show columns
711cflags += -funit-at-a-time
712cflags += -fPIC
713cflags += -fno-common# link all global data into one namespace
714cflags += -fstrict-aliasing# gcc 3.4
715
716onlyC_flags += -Werror-implicit-function-declaration
717
718ifeq ('$(USE_GCC_48_OR_HIGHER)','yes')
719 cflags += -fno-diagnostics-show-caret#gcc 4.8 (4.7.?)
720endif
721#cflags += -save-temps# uncomment to see preprocessor output
722
723#---------------------- various sanitizers
724# There are some disabled tests in CORE/arb_misc.cxx@sanitizers
725# which trigger sanitizer reports.
726
727ifeq ($(SANITIZE_ANY),1)
728 cflags  += -ggdb3 -fno-omit-frame-pointer
729endif
730
731SANI_CFLAGS:=
732SANI_CLFLAGS:=
733
734# activate AddressSanitizer+LeakSanitizer?
735ifeq ($(SANITIZE_ADDRESS),1)
736 SANI_CFLAGS += -fsanitize=address
737 SANI_CLFLAGS += -fsanitize=address
738 dflags  += -DLEAKS_SANITIZED
739endif
740
741# activate UndefinedBehaviorSanitizer?
742ifeq ($(SANITIZE_UNDEFINED),1)
743 SANI_CFLAGS += -fsanitize=undefined
744 SANI_CLFLAGS += -fsanitize=undefined
745 dflags  += -DUNDEF_SANITIZED
746 ifeq ('$(USE_GCC_50_OR_HIGHER)','yes')
747   # abort on runtime errors
748   SANI_CFLAGS += -fno-sanitize-recover=all
749 endif
750
751cflags += $(SANI_CFLAGS)
752clflags += $(SANI_CLFLAGS)
753
754#
755# Note: alignment-sanitizer is deactivated for ARBDB and PROBE!
756 ifeq ('$(DEBUG)','1')
757  ifeq ($(USE_GCC_MAJOR),4)
758   ifeq ($(USE_GCC_MINOR),9)
759    ifneq ('$(findstring $(USE_GCC_PATCHLEVEL),01)','')
760# workaround https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63531 for 4.9.0 + 4.9.1
761# (problem is fixed in 4.9.2 release)
762     extended_cpp_warnings:=$(subst -Weffc++,,$(extended_cpp_warnings))
763    endif
764   endif
765  endif
766 endif
767endif
768
769#---------------------- X11 location
770
771ifeq ($(DARWIN),1)
772 XHOME:=$(PREFIX)
773else
774 ifeq ($(DEBIAN),1)
775  XHOME:=$(PREFIX)
776 else
777  XHOME:=/usr/X11R6
778 endif
779endif
780
781XINCLUDES ?= -I$(XHOME)/include
782XLIBS     ?= -L$(XHOME)/$(CROSS_LIB)
783ifeq ($(DARWIN),1)
784 XINCLUDES += -I$(OSX_FW)/GLUT.framework/Headers -I$(OSX_FW)/OpenGL.framework/Headers -I$(OSX_SDK)/usr/include/krb5
785
786 XLIBS += -lXm -lpng -lz -lXt -lX11 -lXext -lXp -lXmu -lXi
787 XLIBS += -Wl,-dylib_file,$(OSX_FW_OPENGL)/libGL.dylib:$(OSX_FW_OPENGL)/libGL.dylib
788 XLIBS += -Wl,-dylib_file,$(OSX_FW_OPENGL)/libGLU.dylib:$(OSX_FW_OPENGL)/libGLU.dylib
789else
790 XLIBS += -lXm -lXpm -lXt -lXext -lX11
791endif
792
793#---------------------- open GL
794
795ifeq ($(OPENGL),1)
796 cflags += -DARB_OPENGL # activate OPENGL code
797 GL     := gl # this is the name of the OPENGL base target
798 GL_LIB_SYS := -lGL -lGLU
799 GL_LIB_ARB := -L$(ARBHOME)/GL/glAW -lglAW
800
801 ifeq ($(DARWIN),1)
802  GL_LIB_SYS += -lpthread
803 endif
804
805 GL_PNGLIBS_ARB := -L$(ARBHOME)/GL/glpng -lglpng_arb
806 GL_PNGLIBS_SYS := -lpng
807
808 GLEWLIB := -lGLEW -lGLw
809 GLUTLIB := -lglut
810
811 GL_LIBS_SYS := $(GL_LIB_SYS) $(GL_PNGLIBS_SYS) $(GLEWLIB) $(GLUTLIB)
812 GL_LIBS_ARB := $(GL_LIB_ARB) $(GL_PNGLIBS_ARB)
813
814 RNA3D_LIB := RNA3D/RNA3D.a
815else
816 GL_LIBS_SYS:=# no opengl -> no libs
817 GL_LIBS_ARB:=# no opengl -> no libs
818 GL:=# dont build ARB openGL libs
819
820 RNA3D_LIB :=
821endif
822
823RNA3D_LIB_4_DEPENDS := RNA3D/RNA3D.a
824
825GL_LIBS:=$(GL_LIBS_ARB) $(GL_LIBS_SYS)
826
827#---------------------- sina:
828
829ifndef ISINA
830 # build sina delivered with arb?
831 ifeq ($(LINUX),1)
832  ifeq ('$(USE_GCC_70_OR_HIGHER)','yes')
833   ISINA := 1# default to 'yes' for linux with gcc>=7
834  endif
835 endif
836 ifndef ISINA
837  ISINA := 0# 'no' otherwise
838 endif
839endif
840
841#---------------------- tiff lib:
842
843TIFFLIBS := -ltiff
844
845#---------------------- XML lib:
846
847XMLLIBS := -lxerces-c
848
849#---------------------- glib:
850
851ARB_NEEDED_GLIB=glib-2.0
852
853ARB_GLIB_INCLUDE:=$(strip $(shell pkg-config --cflags $(ARB_NEEDED_GLIB)))
854ARB_GLIB_LIBS:=$(strip    $(shell pkg-config --libs   $(ARB_NEEDED_GLIB)))
855
856#---------------------- sunrpc lib:
857# Note: sunrpc has been removed from glibc
858# (e.g. in SuSE Leap 15.3 and Fedora 28)
859# see https://fedoraproject.org/wiki/Changes/SunRPCRemoval
860#
861HAVE_LIBTIRPC=$(strip $(shell pkg-config --exists libtirpc && echo libtirpc))
862ifeq ($(HAVE_LIBTIRPC),)
863 ARB_RPC_INCLUDE:=
864 ARB_RPC_LIBS:=
865else
866 ARB_RPC_INCLUDE:=$(strip $(shell pkg-config --cflags $(HAVE_LIBTIRPC)))
867 ARB_RPC_LIBS:=$(strip    $(shell pkg-config --libs   $(HAVE_LIBTIRPC)))
868endif
869
870#---------------------- basic libs:
871
872ARB_CORE_LIBS:=$(ARB_GLIB_LIBS) $(ARB_RPC_LIBS)
873
874SYSLIBS:=
875ifeq ($(DARWIN),1)
876 SYSLIBS += -lstdc++
877else
878 SYSLIBS += -lm $(ARB_CORE_LIBS)
879endif
880
881#---------------------- system dependent commands
882
883ifeq ($(DARWIN),1)
884 TIME:=gtime
885else
886 TIME:=/usr/bin/time
887endif
888
889#---------------------- SSE vectorizer
890# for details see SOURCE_TOOLS/vectorize.README
891
892ifeq ($(DEBUG),0)
893 ifeq ($(USE_GCC_49_OR_HIGHER),yes)
894  ifeq ($(DISABLE_VECTORIZE_CHECK),0)
895   cflags += -fopt-info-vec
896   cflags += -fopt-info-vec-missed
897   ifeq ($(TRACE_MISSED_VECTORIZATIONS),1)
898#   Shows reasons for unsuccessful vectorization:
899    cflags += -ftree-vectorizer-verbose=10
900    POST_COMPILE += --dump-loop-optimization
901    ifeq ($(VECTORIZATION_CHECK_CANDIDATES),1)
902     $(error TRACE_MISSED_VECTORIZATIONS and VECTORIZATION_CHECK_CANDIDATES may not be used together!)
903    endif
904   endif
905   ifeq ($(VECTORIZATION_CHECK_CANDIDATES),1)
906    POST_COMPILE += --loop-optimization-candi
907   endif
908   POST_COMPILE += --check-loop-optimization
909  endif
910 else
911  ifeq ($(USE_GCC_48_OR_HIGHER),yes)
912# no automatic vectorization-check for gcc<4.9.0
913# -> uncomment the next 2 lines and grep the spam it will produce for 'vectorized.*loops'
914#  cflags += -fopt-info -fopt-info-vec-missed
915#  POST_COMPILE += --original
916  endif
917 endif
918endif
919
920#---------------------- stop early on broken flags/compiler combination
921
922ifeq ($(DEBUG),0)
923 ifeq ($(SANITIZE_ANY),1)
924  ifeq ('$(COMPILER_VERSION)','4.9.1')
925   $(error compiling DEBUG=0 + SANITIZE!=0 crashes with gcc $(COMPILER_VERSION) (gcc 4.9.2 works))
926  endif
927 endif
928endif
929
930#---------------------- include symbols?
931
932ifeq ($(TRACESYM),1)
933 ifeq ($(USE_CLANG),0)
934  cflags  += -rdynamic
935  clflags += -rdynamic -Wl,--export-dynamic
936 endif
937endif
938
939#---------------------- warn about duplicate variable definitions
940
941ifeq ($(DARWIN),1)
942clflags += -Wl,-warn_commons
943else
944clflags += -Wl,--warn-common
945endif
946
947#---------------------- differences between linking executables and shared libs:
948
949# executables:
950ifeq ($(DARWIN),1)
951 blflags:=$(clflags)
952else
953 blflags:=$(clflags) -Wl,--no-undefined
954endif
955
956# shared libraries
957llflags:=$(clflags)
958
959# dont use clflags below
960clflags:=
961
962# -------------------------------------------------------------------------
963#       Don't put any machine/version/etc conditionals below!
964#       (instead define variables above)
965# -------------------------------------------------------------------------
966
967cflags += -W -Wall $(dflags) $(extended_warnings)
968cxxflags := $(extended_cpp_warnings)# flags only suitable for C++ (not C; see onlyC_flags).
969
970# add CFLAGS + CPPFLAGS from environment for DEBIAN build
971ifeq ($(DEBIAN),1)
972 cflags := $(CFLAGS) $(cflags)
973 cxxflags += $(CPPFLAGS)
974endif
975
976ifeq ('$(USE_CLANG)','1')
977# none of the following standards works with clang3.3 (under linux) => dont use standard (as done before r15516)
978#  cxxflags += -std=gnu++11
979#  cxxflags += -std=gnu++0x
980else
981 ifeq ('$(USE_GCC_60_OR_HIGHER)','yes')
982  cxxflags += -std=gnu++14# see also TEMPLATES/cxxforward.h@USE_Cxx14
983 else
984  ifeq ('$(USE_GCC_47_OR_HIGHER)','yes')
985   cxxflags += -std=gnu++11# see also TEMPLATES/cxxforward.h@USE_Cxx11
986  else
987#  gcc versions between 4.3 (lowest supported) and <4.7
988   cxxflags += -std=gnu++0x
989  endif
990 endif
991endif
992
993LINK_STATIC_LIB := $(AR) -csq# link static lib
994LINK_EXECUTABLE := $(A_CXX) $(blflags) -o# link executable (c++)
995
996ifeq ($(LINK_STATIC),1)
997 SHARED_LIB_SUFFIX = a# static lib suffix
998 LINK_SHARED_LIB := $(LINK_STATIC_LIB)
999else
1000 SHARED_LIB_SUFFIX = so# shared lib suffix
1001 LINK_SHARED_LIB := $(A_CXX) $(llflags) -shared -o# link shared lib
1002endif
1003
1004ifeq ($(DARWIN),1)
1005 lflags4perl:=
1006else
1007 lflags4perl:=$(cross_lflags) -shared
1008endif
1009
1010# delete variables unused below
1011blflags:=
1012llflags:=
1013
1014# other used tools
1015MAKEDEPEND_PLAIN = makedepend
1016MAKEDEPEND = $(FORCEMASK);$(MAKEDEPEND_PLAIN)
1017
1018SEPNODATE:=--------------------------------------------------------------------------------
1019SEP=[`date +%M:%S.%N`] ------------------------------------------------
1020# to analyse timings run
1021# make -j9 clean; make -j9 all  | grep '^\[' | sort
1022# make -j9 "TIMED_TARGET=perl" clean_timed_target | grep '^\[' | sort
1023
1024# ------------------------------------------------------------ DYNLIBDEFS
1025# various dynamic library definitions for linking executables:
1026#
1027# SYSLIBS:    system libraries needed by database lib
1028# ARBDB_LIB:  database lib
1029# DBSYS_LIBS: executable using database (but no GUI)
1030# GUI_LIBS:   executable using database and GUI (arb gui uses database)
1031#
1032# Note: definitions exported to sub-makefiles are described in SOURCE_TOOLS/parent_make.txt
1033
1034CORE_LIB=-lCORE
1035ARBDB_LIB=-lARBDB $(CORE_LIB)
1036DBSYS_LIBS = $(ARBDB_LIB) $(SYSLIBS)
1037
1038GUI_LIBS_PREFIX:=
1039ifeq ($(DARWIN),1)
1040# this seem to be added at wrong place, since opengl is only needed to link EDIT4
1041 GUI_LIBS_PREFIX:=-framework GLUT -framework OpenGL
1042endif
1043
1044GUI_LIBS=$(GUI_LIBS_PREFIX) $(DBSYS_LIBS) -lAWT -lWINDOW $(XLIBS)
1045
1046LIBPATH = -L$(ARBHOME)/lib
1047
1048DEST_LIB = lib
1049DEST_BIN = bin
1050
1051CC_INCLUDES  := -I. -I$(ARBHOME)/INCLUDE $(XINCLUDES) $(ARB_GLIB_INCLUDE) $(ARB_RPC_INCLUDE)
1052CXX_INCLUDES := $(CC_INCLUDES)
1053MAKEDEPENDFLAGS := -- -DARB_OPENGL -DUNIT_TESTS -D__cplusplus -I. -Y$(ARBHOME)/INCLUDE
1054
1055# ---------------------------------------
1056# wrap main()
1057
1058use_ARB_main=$(ARBHOME)/SOURCE_TOOLS/arb_main_cpp.o
1059use_ARB_main_C=$(ARBHOME)/SOURCE_TOOLS/arb_main_c.o
1060
1061# -----------------------------------------
1062# unique build-id
1063# - different for different calls of make
1064# - constant in recursive calls
1065
1066ifndef ARBBID
1067 ARBBID:=$(shell SOURCE_TOOLS/uniqueID.sh)
1068endif
1069
1070# -----------------------------------------
1071#     export variables to submakefiles
1072
1073include SOURCE_TOOLS/export2sub
1074
1075# do not define (exported) variables below this point
1076
1077# -------------------------
1078#     Main arb targets:
1079# -------------------------
1080
1081first_target:
1082                $(MAKE) checks
1083                @echo $(SEPNODATE)
1084                @echo 'Main targets:'
1085                @echo ''
1086                @echo ' all         - Compile ARB + TOOLs + and copy shared libs + link foreign software'
1087                @echo '               (That is most likely the target you want)'
1088                @echo ''
1089                @echo ' clean       - remove generated files ("SUBDIR/SUBDIR.clean" to clean only SUBDIR)'
1090                @echo ' rebuild     - clean + all'
1091                @echo ' cleanlinked - remove all binaries'
1092                @echo ' relink      - cleanlinked + all (=relink all from objects)'
1093                @echo ''
1094                @echo 'Targets for automated builds:'
1095                @echo ''
1096                @echo ' ALL, REBUILD, TARFILE + TARFILE_QUICK '
1097                @echo '             - same as all, rebuild, tarfile + tarfile_quick'
1098                @echo '             - if errors occur, they are extracted and listed at tail of output'
1099                @echo ''
1100                @echo $(SEPNODATE)
1101                @echo ''
1102                @echo 'Development targets:'
1103                @echo ''
1104                @echo ' depends               - create or update dependencies ("SUBDIR/SUBDIR.depends" to update only SUBDIR)'
1105                @echo ' proto                 - create or update prototypes ("SUBDIR/SUBDIR.proto" to update only SUBDIR)'
1106                @echo ' tags                  - create tags for xemacs'
1107                @echo ' show                  - show available shortcuts (AKA subtargets)'
1108                @echo ' up                    - shortcut for depends+proto+tags'
1109ifeq ($(UNIT_TESTS),1)
1110                @echo ' ut                    - only run tests'
1111                @echo ' "UNIT=..." oneunit    - build one unit and run tests (see also UNIT_TESTER/Makefile.setup.local)'
1112endif
1113ifneq ($(SANITIZE),0)
1114                @echo ' sanitize              - all + run arb_ntree with sanitizer (test.arb + execute _logged)'
1115endif
1116                @echo ' modified              - rebuild files modified in svn checkout (does touch)'
1117                @echo ' touch                 - touch files modified in svn checkout'
1118                @echo ''
1119                @echo 'Some often used sub targets:'
1120                @echo ''
1121                @echo ' arb                   - Just compile ARB (but none of the integrated tools)'
1122                @echo ' menus                 - create lib/gde/arb.menu from GDEHELP/ARB_GDEmenus.source'
1123                @echo ' perl                  - Compile the PERL XSUBS into lib/ARB.so  and create links in lib to perl'
1124                @echo ' binlink               - Create all links in the bin directory'
1125                @echo ''
1126                @echo 'Internal maintenance:'
1127                @echo ''
1128                @echo ' relinfo               - show help on release targets'
1129                @echo ' tarfile               - make rebuild and create arb version tarfile ("tarfile_quick" to skip rebuild)'
1130                @echo ' save                  - save all basic ARB sources into arbsrc_DATE ("savetest" to check filelist)'
1131                @echo ' patch                 - save svn diff to patchfile'
1132                @echo ' source_doc            - create doxygen documentation'
1133                @echo ' relocated             - rebuild partly (use when you have relocated ARBHOME)'
1134                @echo ' check_res             - check resource usage'
1135                @echo ' dep_graph             - Build dependency graphs'
1136                @echo ' clean_cov             - Clean coverage results'
1137                @echo ''
1138                @echo ' clean_opengl_changed  - clean after changing OPENGL setting in config.Makefile'
1139                @echo ' clean_checked_vect    - clean units containing vectorization checks'
1140                @echo ' cleanRelinkable       - similar to cleanlinked (but skips raxml8 to avoid rebuild)'
1141                @echo ''
1142                @echo ' post_commit_check     - Checks whether'
1143                @echo '                         * main make targets work,'
1144                @echo '                         * dependencies and prototypes are up to date,'
1145                @echo '                         * SVN-controlled files remain unaffected by called targets and'
1146                @echo '                         * all generated files are ignored.'
1147                @echo '                       (has to be called in a clean SVN checkout)'
1148                @echo $(SEPNODATE)
1149                @echo ''
1150
1151relinfo:
1152                @echo ''
1153                @echo $(SEPNODATE)
1154                @echo 'Release targets:'
1155                @echo ''
1156                @echo ' inc_candi     - increase RC candidate-number  (only possible in "rc" branch, not needed for RC1)'
1157                @echo ' inc_patch     - increase release patchlevel   (only possible in "stable" branch)'
1158                @echo ' inc_minor     - increase minor version number (only possible in "trunk")'
1159                @echo ' inc_major     - increase MAJOR version number (only possible in "trunk")'
1160                @echo ''
1161                @echo ' show_version  - show version tag'
1162                @echo ''
1163                @echo $(SEPNODATE)
1164                @echo ''
1165
1166# auto-generate config.makefile:
1167
1168config.makefile : config.makefile.template
1169                @echo --------------------------------------------------------------------------------
1170ifeq ($(CONFIG_MAKEFILE_FOUND),)
1171                @cp $< $@
1172                @echo '$(ARBHOME)/$@:1: has been generated.'
1173                @echo 'Please edit $@ to configure your system!'
1174                @echo --------------------------------------------------------------------------------
1175                @false
1176else
1177                @echo '$(ARBHOME)/$<:1: is more recent than'
1178                @echo '$(ARBHOME)/$@:1:'
1179                @ls -al config.makefile*
1180                @echo --------------------------------------------------------------------------------
1181                @echo "Updating $@ (if this fails, check manually)"
1182                SOURCE_TOOLS/update_config_makefile.pl
1183                @echo "Sucessfully updated $@"
1184                @echo --------------------------------------------------------------------------------
1185                @ls -al config.makefile*
1186                @echo --------------------------------------------------------------------------------
1187                @echo "Diff to your old config.makefile:"
1188                @echo --------------------------------------------------------------------------------
1189                -diff $@.bak $@
1190                @echo --------------------------------------------------------------------------------
1191endif
1192
1193# check if everything is configured correctly
1194
1195check_DEVELOPER:
1196ifndef DEVELOPER
1197                @echo 'config.makefile:1: DEVELOPER not defined'
1198                @false
1199endif
1200
1201check_DEBUG:
1202ifndef dflags
1203                @echo 'config.makefile:1: DEBUG has to be defined. Valid values are 0 and 1'
1204                @false
1205endif
1206
1207check_ARB_64:
1208ifndef ARB_64
1209                @echo 'config.makefile:1: ARB_64 has to be defined. Valid values are 0 and 1'
1210                @false
1211endif
1212
1213# ---------------------------------------- check gcc version
1214
1215COMPILER_BROKEN:=0
1216
1217ifeq ('$(COMPILER_VERSION_ALLOWED)', '4.6.4')
1218COMPILER_BROKEN:=1
1219endif
1220ifeq ('$(COMPILER_VERSION_ALLOWED)', '4.8.0')
1221COMPILER_BROKEN:=1
1222endif
1223
1224check_same_GCC_VERSION:
1225                $(ARBHOME)/SOURCE_TOOLS/check_same_compiler_version.pl $(COMPILER_NAME) $(COMPILER_VERSION_ALLOWED)
1226
1227check_GCC_VERSION:
1228                @echo 'Compiler version check:'
1229# see .@ALLOWED_gcc_VERSIONS
1230ifeq ('$(COMPILER_VERSION_ALLOWED)', '')
1231                @echo "  - Your compiler is '$(COMPILER_NAME)' version '$(COMPILER_VERSION)'"
1232                @echo '    This version is not in the list of supported $(COMPILER_NAME)-versions:'
1233                @$(foreach version,$(ALLOWED_COMPILER_VERSIONS),echo '    * $(version)';)
1234                @echo '  - You may either ..'
1235                @echo '    - add your version to ALLOWED_$(COMPILER_NAME)_VERSIONS in the Makefile and try it out or'
1236                @echo '    - switch to one of the allowed versions (see arb_README_gcc.txt for installing'
1237                @echo '      a different version of gcc)'
1238                $(error Unsupported compiler '$(COMPILER_NAME)' version '$(COMPILER_VERSION)')
1239else
1240 ifeq ($(COMPILER_BROKEN),1)
1241                $(error compilation refused for $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)'. Refer to http://bugs.arb-home.de/wiki/GccVersionInfo for details.)
1242 else
1243                @echo "  - Supported $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)' detected - fine!"
1244                @echo ''
1245  ifeq ($(USE_CLANG),1)
1246                @echo "Dump clang version:"
1247                $(A_CXX) -v
1248  endif
1249                $(MAKE) check_same_GCC_VERSION
1250 endif
1251endif
1252
1253#---------------------- check ARBHOME
1254
1255# use arb_INSTALL.txt to determine whether ARBHOME points to correct directory
1256ARB_INSTALL_FOUND=$(wildcard $(ARBHOME)/arb_INSTALL.txt)
1257
1258check_ARBHOME:
1259ifeq ($(strip $(ARB_INSTALL_FOUND)),)
1260                @echo ------------------------------------------------------------
1261                @echo "ARBHOME is set to '$(ARBHOME)'"
1262                @echo "The environment variable ARBHOME has to point to the top arb source directory."
1263                @echo "If you use bash enter:"
1264                @echo "          export ARBHOME='`pwd`'"
1265                @echo ------------------------------------------------------------
1266                @false
1267endif
1268
1269ARB_PATH_SET=$(findstring $(ARBHOME)/bin,$(PATH))
1270
1271check_PATH: check_ARBHOME
1272ifeq ($(strip $(ARB_PATH_SET)),)
1273                @echo ------------------------------------------------------------
1274                @echo "The environment variable PATH has to contain $(ARBHOME)/bin"
1275                @echo "If you use bash enter:"
1276                @echo '                 export PATH=$$ARBHOME/bin:$$PATH'
1277                @echo ------------------------------------------------------------
1278                @false
1279endif
1280
1281check_TOOLS:
1282        @util/arb_check_build_env.pl \
1283                "$(A_CC)" \
1284                "$(A_CXX)" \
1285                "$(LINK_SHARED_LIB)" \
1286
1287have_makedepend:
1288        @util/arb_check_build_env.pl --check-only "$(MAKEDEPEND_PLAIN)"
1289
1290check_ENVIRONMENT : check_PATH check_TOOLS
1291                @echo "-------------------- Environment [start]"
1292                @echo "ARBHOME='$(ARBHOME)'"
1293                @echo "PATH='$(PATH)'"
1294                @echo "LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)'"
1295                @echo "-------------------- Environment [end]"
1296
1297check_tabs: check_setup
1298ifeq ($(DEBUG),1)
1299        @SOURCE_TOOLS/tabBrake.pl
1300endif
1301
1302force_tab_check:
1303        @touch -t 198001010000 SOURCE_TOOLS/stamp.tabBrake
1304        @$(MAKE) check_tabs
1305
1306
1307# ---------------------
1308
1309check_setup: check_ENVIRONMENT check_DEBUG check_ARB_64 check_DEVELOPER check_GCC_VERSION
1310                @echo Your setup seems to be ok.
1311
1312checks: check_setup check_tabs
1313        @rm -f SOURCE_TOOLS/postcompile.sav
1314
1315
1316# end test section ------------------------------
1317
1318# ---------------------------------------
1319# List of standard top level directories
1320#
1321# sub-makefiles have to define the targets
1322# - 'depends' and
1323# - 'clean'
1324#
1325# when adding new libraries/subdirs here, also add a dependency vs 'links' or 'links_non_perl' in .@DD_links_non_perl
1326
1327TL_ARCHIVES = \
1328                        AISC/AISC.a \
1329                        ARB_GDE/ARB_GDE.a \
1330                        AWTC/AWTC.a \
1331                        AWTI/AWTI.a \
1332                        CONSENSUS_TREE/CONSENSUS_TREE.a \
1333                        CONVERTALN/CONVERTALN.a \
1334                        DBSERVER/DBSERVER.a \
1335                        DIST/DIST.a \
1336                        EDIT4/EDIT4.a \
1337                        EISPACK/EISPACK.a \
1338                        GENOM/GENOM.a \
1339                        GENOM_IMPORT/GENOM_IMPORT.a \
1340                        ISLAND_HOPPING/ISLAND_HOPPING.a \
1341                        MERGE/MERGE.a \
1342                        MULTI_PROBE/MULTI_PROBE.a \
1343                        NALIGNER/NALIGNER.a \
1344                        NAMES/NAMES.a \
1345                        NAMES_COM/server.a \
1346                        NTREE/NTREE.a \
1347                        PARSIMONY/PARSIMONY.a \
1348                        PHYLO/PHYLO.a \
1349                        PRIMER_DESIGN/PRIMER_DESIGN.a \
1350                        PROBE/PROBE.a \
1351                        PROBE_COM/server.a \
1352                        PROBE_DESIGN/PROBE_DESIGN.a \
1353                        $(RNA3D_LIB) \
1354                        RNACMA/RNACMA.a \
1355                        SECEDIT/SECEDIT.a \
1356                        SEQ_QUALITY/SEQ_QUALITY.a \
1357                        SERVERCNTRL/SERVERCNTRL.a \
1358                        STAT/STAT.a \
1359                        TREEGEN/TREEGEN.a \
1360                        WETC/WETC.a \
1361                        XML/XML.a \
1362
1363TL_SHARED_ARCHIVES = \
1364                        ARBDB/libARBDB.so \
1365                        CORE/libCORE.so \
1366                        AWT/libAWT.so \
1367                        WINDOW/libWINDOW.so \
1368
1369TL_ARCHIV_COLLECTIONS = \
1370                        SL/SL.archColl \
1371
1372TL_TOOLS_COLLECTIONS = \
1373                        AISC_MKPTPS/AISC_MKPTPS.toolColl \
1374                        TOOLS/TOOLS.toolColl \
1375                        PERLTOOLS/PERLTOOLS.toolColl \
1376                        PROBE_SET/PROBE_SET.toolColl \
1377                        READSEQ/READSEQ.toolColl \
1378
1379RECURSIVE_SUBS = \
1380                        GDE/GDE.sub \
1381                        UNIT_TESTER/UNIT_TESTER.sub \
1382
1383SUBDIRS = \
1384        $(RECURSIVE_SUBS) \
1385        $(TL_ARCHIVES:.a=.sub) \
1386        $(TL_SHARED_ARCHIVES:.so=.sub) \
1387        $(TL_ARCHIV_COLLECTIONS:.archColl=.sub) \
1388        $(TL_TOOLS_COLLECTIONS:.toolColl=.sub) \
1389
1390# sub directories inside TL_ARCHIV_COLLECTIONS
1391CL_ARCH_DIRS = $(foreach coll,$(TL_ARCHIV_COLLECTIONS),$(shell find $(dir $(coll)) -maxdepth 1 -mindepth 1 -type d))
1392
1393# archives inside CL_ARCH_DIRS:
1394CL_ARCHIVES = $(foreach adir,$(CL_ARCH_DIRS),$(dir $(adir))$(notdir $(adir))/$(notdir $(adir)).a)
1395
1396# -----------------------
1397#     library packets
1398
1399ARCHS_CLIENT_PROBE = PROBE_COM/client.a
1400ARCHS_CLIENT_NAMES = NAMES_COM/client.a
1401
1402ARCHS_MAKEBIN = AISC_MKPTPS/AISC_MKPTPS.a AISC/AISC.a
1403
1404# communication libs need aisc and aisc_mkpts:
1405
1406AISC/AISC.dummy: proto_tools
1407
1408comtools: AISC/AISC.dummy
1409
1410ARCHS_SEQUENCE = \
1411                SL/SEQUENCE/SEQUENCE.a \
1412                SL/ALIVIEW/ALIVIEW.a \
1413                SL/PRONUC/PRONUC.a \
1414
1415ARCHS_TREE = \
1416                SL/ARB_TREE/ARB_TREE.a \
1417                SL/FILTER/FILTER.a \
1418                $(ARCHS_SEQUENCE) \
1419
1420# parsimony tree (used by NTREE, PARSIMONY, STAT(->EDIT4), DIST(obsolete!))
1421ARCHS_AP_TREE = \
1422                SL/AP_TREE/AP_TREE.a \
1423                $(ARCHS_TREE) \
1424
1425# --------------------------------------------------------------------------------
1426# dependencies for linking shared libs
1427
1428link_core:      core
1429link_db:        db link_core
1430link_aw:        aw link_db
1431link_awt:       awt link_aw
1432
1433#***************************************************************************************
1434#               Individual_Programs_Section
1435#***************************************************************************************
1436
1437arbmainwrapper:
1438        $(MAKE) -C SOURCE_TOOLS -r mainwrapper
1439
1440
1441#***********************************    arb_ntree **************************************
1442NTREE = bin/arb_ntree
1443ARCHS_NTREE = \
1444                NTREE/NTREE.a \
1445                ARB_GDE/ARB_GDE.a \
1446                SL/GROUP_SEARCH/GROUP_SEARCH.a \
1447                SL/SAICALC/SAICALC.a \
1448                SL/DB_UI/DB_UI.a \
1449                AWTC/AWTC.a \
1450                AWTI/AWTI.a \
1451                CONSENSUS_TREE/CONSENSUS_TREE.a \
1452                GENOM_IMPORT/GENOM_IMPORT.a \
1453                GENOM/GENOM.a \
1454                MERGE/MERGE.a \
1455                MULTI_PROBE/MULTI_PROBE.a \
1456                PRIMER_DESIGN/PRIMER_DESIGN.a \
1457                PROBE_DESIGN/PROBE_DESIGN.a \
1458                SEQ_QUALITY/SEQ_QUALITY.a \
1459                SERVERCNTRL/SERVERCNTRL.a \
1460                SL/ALILINK/ALILINK.a \
1461                SL/AW_NAME/AW_NAME.a \
1462                SL/CONSENSUS/CONSENSUS.a \
1463                SL/DB_SCANNER/DB_SCANNER.a \
1464                SL/DB_QUERY/DB_QUERY.a \
1465                SL/QUERY/QUERY.a \
1466                SL/SEQIO/SEQIO.a \
1467                STAT/STAT.a \
1468                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1469                SL/HELIX/HELIX.a \
1470                SL/REGEXPR/REGEXPR.a \
1471                SL/REFENTRIES/REFENTRIES.a \
1472                SL/NDS/NDS.a \
1473                SL/ITEM_SHADER/ITEM_SHADER.a \
1474                SL/ITEMS/ITEMS.a \
1475                SL/INSDEL/INSDEL.a \
1476                SL/LOCATION/LOCATION.a \
1477                SL/MACROS/MACROS.a \
1478                SL/PVP/PVP.a \
1479                SL/TRANSLATE/TRANSLATE.a \
1480                SL/TREEDISP/TREEDISP.a \
1481                SL/TREE_ADMIN/TREE_ADMIN.a \
1482                SL/TREE_READ/TREE_READ.a \
1483                SL/TREE_WRITE/TREE_WRITE.a \
1484                SL/XFERGUI/XFERGUI.a \
1485                SL/XFERSET/XFERSET.a \
1486                XML/XML.a \
1487                $(ARCHS_AP_TREE) \
1488
1489ARCHS_NTREE_ALL = $(ARCHS_NTREE) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) $(XMLLIBS)
1490
1491$(NTREE): $(ARCHS_NTREE:.a=.dummy) link_awt
1492        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NTREE_ALL) || ( \
1493                echo "$(SEP) Link $@"; \
1494                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL)" ; \
1495                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL) && \
1496                echo "$(SEP) Link $@ [done]"; \
1497                )
1498
1499#***********************************    arb_edit4 **************************************
1500EDIT4 = bin/arb_edit4
1501
1502ARCHS_EDIT4 := \
1503                EDIT4/EDIT4.a \
1504                ARB_GDE/ARB_GDE.a \
1505                SL/FAST_ALIGNER/FAST_ALIGNER.a \
1506                AWTC/AWTC.a \
1507                ISLAND_HOPPING/ISLAND_HOPPING.a \
1508                SECEDIT/SECEDIT.a \
1509                SERVERCNTRL/SERVERCNTRL.a \
1510                SL/AW_HELIX/AW_HELIX.a \
1511                SL/AW_NAME/AW_NAME.a \
1512                SL/CONSENSUS/CONSENSUS.a \
1513                SL/ITEMS/ITEMS.a \
1514                STAT/STAT.a \
1515                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1516                SL/HELIX/HELIX.a \
1517                SL/TRANSLATE/TRANSLATE.a \
1518                SL/MACROS/MACROS.a \
1519                SL/NDS/NDS.a \
1520                $(ARCHS_AP_TREE) \
1521                XML/XML.a \
1522
1523ifeq ($(OPENGL),1)
1524ARCHS_EDIT4 += RNA3D/RNA3D.a
1525endif
1526
1527ARCHS_EDIT4_ALL = $(ARCHS_EDIT4) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) $(LIBS_EDIT4)
1528
1529LIBS_EDIT4 := $(GL_LIBS)
1530
1531$(EDIT4): $(ARCHS_EDIT4:.a=.dummy) link_awt
1532        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_EDIT4_ALL) || ( \
1533                echo "$(SEP) Link $@"; \
1534                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL)" ; \
1535                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL) && \
1536                echo "$(SEP) Link $@ [done]"; \
1537                )
1538
1539#***********************************    arb_rnacma **************************************
1540RNACMA = bin/arb_rnacma
1541ARCHS_RNACMA = \
1542                RNACMA/RNACMA.a \
1543
1544ARCHS_RNACMA_ALL = $(ARCHS_RNACMA) $(DBSYS_LIBS)
1545
1546$(RNACMA) : $(ARCHS_RNACMA:.a=.dummy) link_db
1547        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_RNACMA_ALL) || ( \
1548                echo "$(SEP) Link $@"; \
1549                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL)"; \
1550                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL) && \
1551                echo "$(SEP) Link $@ [done]"; \
1552                )
1553
1554#***********************************    arb_wetc **************************************
1555WETC = bin/arb_wetc
1556ARCHS_WETC = \
1557                WETC/WETC.a \
1558                SL/HELIX/HELIX.a \
1559                SL/FILTER/FILTER.a \
1560                XML/XML.a \
1561
1562ARCHS_WETC_ALL = $(ARCHS_WETC) $(GUI_LIBS)
1563
1564$(WETC): $(ARCHS_WETC:.a=.dummy) link_awt
1565        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_WETC_ALL) || ( \
1566                echo "$(SEP) Link $@"; \
1567                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL)" ; \
1568                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL) && \
1569                echo "$(SEP) Link $@ [done]"; \
1570                )
1571
1572#***********************************    arb_dist **************************************
1573DIST = bin/arb_dist
1574ARCHS_DIST = \
1575                DIST/DIST.a \
1576                CONSENSUS_TREE/CONSENSUS_TREE.a \
1577                EISPACK/EISPACK.a \
1578                SERVERCNTRL/SERVERCNTRL.a \
1579                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1580                SL/HELIX/HELIX.a \
1581                SL/MATRIX/MATRIX.a \
1582                SL/MACROS/MACROS.a \
1583                SL/NDS/NDS.a \
1584                SL/ITEMS/ITEMS.a \
1585                SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a \
1586                XML/XML.a \
1587                $(ARCHS_AP_TREE) \
1588
1589ARCHS_DIST_ALL = $(ARCHS_DIST) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS)
1590
1591$(DIST): $(ARCHS_DIST:.a=.dummy) link_awt
1592        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DIST_ALL) || ( \
1593                echo "$(SEP) Link $@"; \
1594                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL)" ; \
1595                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL) && \
1596                echo "$(SEP) Link $@ [done]"; \
1597                )
1598
1599#***********************************    arb_pars **************************************
1600PARSIMONY = bin/arb_pars
1601ARCHS_PARSIMONY = \
1602                PARSIMONY/PARSIMONY.a \
1603                SERVERCNTRL/SERVERCNTRL.a \
1604                SL/AW_NAME/AW_NAME.a \
1605                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1606                SL/HELIX/HELIX.a \
1607                SL/MACROS/MACROS.a \
1608                SL/NDS/NDS.a \
1609                SL/ITEMS/ITEMS.a \
1610                SL/TRANSLATE/TRANSLATE.a \
1611                SL/TREEDISP/TREEDISP.a \
1612                XML/XML.a \
1613                $(ARCHS_AP_TREE) \
1614
1615ARCHS_PARSIMONY_ALL = $(ARCHS_PARSIMONY) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS)
1616
1617$(PARSIMONY): $(ARCHS_PARSIMONY:.a=.dummy) link_awt
1618        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PARSIMONY_ALL) || ( \
1619                echo "$(SEP) Link $@"; \
1620                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL)" ; \
1621                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL) && \
1622                echo "$(SEP) Link $@ [done]"; \
1623                )
1624
1625#*********************************** arb_convert_aln **************************************
1626CONVERT_ALN = bin/arb_convert_aln
1627ARCHS_CONVERT_ALN =     \
1628                CONVERTALN/CONVERTALN.a \
1629
1630ARCHS_CONVERT_ALN_ALL = $(ARCHS_CONVERT_ALN) $(DBSYS_LIBS)
1631
1632$(CONVERT_ALN) : $(ARCHS_CONVERT_ALN:.a=.dummy) link_db
1633        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_CONVERT_ALN_ALL) || ( \
1634                echo "$(SEP) Link $@"; \
1635                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL)"; \
1636                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL) && \
1637                echo "$(SEP) Link $@ [done]"; \
1638                )
1639
1640#*********************************** arb_treegen **************************************
1641
1642TREEGEN = bin/arb_treegen
1643ARCHS_TREEGEN = \
1644                TREEGEN/TREEGEN.a \
1645
1646ARCHS_TREEGEN_ALL = $(ARCHS_TREEGEN)
1647
1648$(TREEGEN) :  $(ARCHS_TREEGEN:.a=.dummy)
1649        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main_C) $(ARCHS_TREEGEN_ALL) || ( \
1650                echo "$(SEP) Link $@"; \
1651                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL)" ; \
1652                $(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL) && \
1653                echo "$(SEP) Link $@ [done]"; \
1654                )
1655
1656#***********************************    arb_naligner **************************************
1657NALIGNER = bin/arb_naligner
1658ARCHS_NALIGNER = \
1659                NALIGNER/NALIGNER.a \
1660                SERVERCNTRL/SERVERCNTRL.a \
1661                SL/HELIX/HELIX.a \
1662
1663ARCHS_NALIGNER_ALL = $(ARCHS_NALIGNER) $(ARCHS_CLIENT_PROBE) $(DBSYS_LIBS)
1664
1665$(NALIGNER): $(ARCHS_NALIGNER:.a=.dummy) link_db
1666        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NALIGNER_ALL) || ( \
1667                echo "$(SEP) Link $@"; \
1668                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL)" ; \
1669                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL) && \
1670                echo "$(SEP) Link $@ [done]"; \
1671                )
1672
1673#***********************************    arb_phylo **************************************
1674PHYLO = bin/arb_phylo
1675ARCHS_PHYLO = \
1676                PHYLO/PHYLO.a \
1677                SL/HELIX/HELIX.a \
1678                SL/FILTER/FILTER.a \
1679                SL/MACROS/MACROS.a \
1680                XML/XML.a \
1681
1682ARCHS_PHYLO_ALL = $(ARCHS_PHYLO) $(GUI_LIBS)
1683
1684$(PHYLO): $(ARCHS_PHYLO:.a=.dummy) link_awt
1685        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PHYLO_ALL) || ( \
1686                echo "$(SEP) Link $@"; \
1687                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL)" ; \
1688                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL) && \
1689                echo "$(SEP) Link $@ [done]"; \
1690                )
1691
1692#***************************************************************************************
1693#                                       SERVER SECTION
1694#***************************************************************************************
1695
1696#***********************************    arb_db_server **************************************
1697DBSERVER = bin/arb_db_server
1698ARCHS_DBSERVER = \
1699                DBSERVER/DBSERVER.a \
1700                SERVERCNTRL/SERVERCNTRL.a \
1701
1702ARCHS_DBSERVER_ALL = $(ARCHS_DBSERVER) $(ARBDB_LIB) $(ARCHS_CLIENT_PROBE) $(SYSLIBS)
1703
1704$(DBSERVER): $(ARCHS_DBSERVER:.a=.dummy) link_db
1705        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DBSERVER_ALL) || ( \
1706                echo "$(SEP) Link $@"; \
1707                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL)" ; \
1708                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL) && \
1709                echo "$(SEP) Link $@ [done]"; \
1710                )
1711
1712#***********************************    arb_pt_server **************************************
1713PROBE = bin/arb_pt_server
1714
1715ARCHS_PROBE_DEPEND = \
1716                PROBE/PROBE.a \
1717                SL/PTCLEAN/PTCLEAN.a \
1718                SERVERCNTRL/SERVERCNTRL.a \
1719                SL/HELIX/HELIX.a \
1720
1721ARCHS_PROBE_ALL = $(ARCHS_PROBE_DEPEND) $(ARCHS_CLIENT_PROBE) $(ARBDB_LIB) $(SYSLIBS)
1722
1723$(PROBE): $(ARCHS_PROBE_DEPEND:.a=.dummy) link_db
1724        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) config.makefile $(ARCHS_PROBE_ALL) || ( \
1725                echo "$(SEP) Link $@"; \
1726                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL)" ; \
1727                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL) && \
1728                echo "$(SEP) Link $@ [done]"; \
1729                )
1730
1731#***********************************    arb_name_server **************************************
1732NAMES = bin/arb_name_server
1733ARCHS_NAMES = \
1734                NAMES/NAMES.a \
1735                SERVERCNTRL/SERVERCNTRL.a \
1736
1737ARCHS_NAMES_ALL = $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) NAMES_COM/server.a $(SYSLIBS)
1738
1739$(NAMES): $(ARCHS_NAMES:.a=.dummy) link_db
1740        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NAMES_ALL) || ( \
1741                echo "$(SEP) Link $@"; \
1742                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL)" ; \
1743                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL) && \
1744                echo "$(SEP) Link $@ [done]"; \
1745                )
1746
1747#***********************************    SHARED LIBRARIES SECTION  **************************************
1748
1749prepare_libdir: addlibs
1750
1751addlibs:
1752        (perl $(ARBHOME)/SOURCE_TOOLS/provide_libs.pl \
1753                                "arbhome=$(ARBHOME)" \
1754                                "opengl=$(OPENGL)" \
1755                                "link_static=$(LINK_STATIC)" \
1756        )
1757
1758#***************************************************************************************
1759#                       Recursive calls to sub-makefiles
1760#***************************************************************************************
1761
1762%.depends: have_makedepend
1763        @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile
1764        @$(MAKE) -C $(@D) -r \
1765                "AUTODEPENDS=1" \
1766                "MAIN=nothing" \
1767                "cflags=noCflagsHere_use_MAKEDEPENDFLAGS" \
1768                "cxxflags=noCxxflagsHere_use_MAKEDEPENDFLAGS" \
1769                depends
1770        @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null
1771        @cat $(@D)/Makefile \
1772                | SOURCE_TOOLS/fix_depends.pl "(from main)" \
1773                >$(@D)/Makefile.2
1774        @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile
1775        @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed
1776
1777%.proto:
1778        @($(MAKE) -C $(@D) \
1779                "AUTODEPENDS=0" \
1780                "MAIN=nothing" \
1781                "cflags=noCflags" \
1782                "cxxflags=noCxxflags" \
1783                proto 2>&1 ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
1784
1785%.clean:
1786        @$(MAKE) -C $(@D) \
1787                "AUTODEPENDS=0" \
1788                "MAIN=nothing" \
1789                "cflags=noCflags" \
1790                "cxxflags=noCxxflags" \
1791                clean
1792
1793
1794# stop wrong targets:
1795target_is_missing_lib_prefix:
1796        @echo "Error: Denied to build shared library target with missing 'lib'-prefix"
1797        false
1798
1799ARBDB/ARBDB.dummy:   target_is_missing_lib_prefix
1800CORE/CORE.dummy:     target_is_missing_lib_prefix
1801AWT/AWT.dummy:       target_is_missing_lib_prefix
1802WINDOW/WINDOW.dummy: target_is_missing_lib_prefix
1803
1804# rule to generate main target (normally a library):
1805# @@@ check effect of setting LANG=C below
1806%.dummy:
1807        @( export ID=$$$$; LANG=C; \
1808        (( \
1809            echo "$(SEP) Make $(@D)"; \
1810            $(MAKE) -C $(@D) -r \
1811                "AUTODEPENDS=1" \
1812                "MAIN=$(@F:.dummy=.a)" \
1813                "cflags=$(cflags) -DIN_ARB_$(subst /,_,$(@D))" \
1814                && \
1815            echo "$(SEP) Make $(@D) [done]"; \
1816        ) >$(@D).$$ID.log 2>&1 && (cat $(@D).$$ID.log;rm $(@D).$$ID.log)) || (cat $(@D).$$ID.log;rm $(@D).$$ID.log;false))
1817
1818# Additional dependencies for subtargets:
1819
1820PROBE_COM/PROBE_COM.dummy : comtools
1821NAMES_COM/NAMES_COM.dummy : comtools
1822
1823com: PROBE_COM/PROBE_COM.dummy NAMES_COM/NAMES_COM.dummy
1824
1825# stop wrong more targets:
1826PROBE_COM/server.dummy:
1827        @echo Unwanted request to make target $<
1828        false
1829
1830PROBE_COM/client.dummy:
1831        @echo Unwanted request to make target $<
1832        false
1833
1834NAMES_COM/server.dummy:
1835        @echo Unwanted request to make target $<
1836        false
1837
1838NAMES_COM/client.dummy:
1839        @echo Unwanted request to make target $<
1840        false
1841
1842
1843ARBDB/libARBDB.dummy:                   links
1844CORE/libCORE.dummy:                     links
1845
1846PERLTOOLS/PERLTOOLS.dummy:              core db
1847
1848# all subdirs perl not depends on go here (ADD_links_non_perl)
1849AWT/libAWT.dummy:                       links_non_perl
1850AWTI/AWTI.dummy:                        links_non_perl
1851CONSENSUS_TREE/CONSENSUS_TREE.dummy:    links_non_perl
1852CONVERTALN/CONVERTALN.dummy:            links_non_perl
1853DBSERVER/DBSERVER.dummy:                links_non_perl
1854DIST/DIST.dummy:                        links_non_perl
1855EDIT4/EDIT4.dummy:                      links_non_perl com
1856EISPACK/EISPACK.dummy:                  links_non_perl
1857GDE/GDE.dummy:                          links_non_perl
1858GENOM/GENOM.dummy:                      links_non_perl
1859GENOM_IMPORT/GENOM_IMPORT.dummy:        links_non_perl
1860ISLAND_HOPPING/ISLAND_HOPPING.dummy:    links_non_perl
1861MERGE/MERGE.dummy:                      links_non_perl
1862NTREE/NTREE.dummy:                      links_non_perl
1863PARSIMONY/PARSIMONY.dummy:              links_non_perl
1864PHYLO/PHYLO.dummy:                      links_non_perl
1865PRIMER_DESIGN/PRIMER_DESIGN.dummy:      links_non_perl
1866PROBE_SET/PROBE_SET.dummy:              links_non_perl link_db
1867READSEQ/READSEQ.dummy:                  links_non_perl
1868RNACMA/RNACMA.dummy:                    links_non_perl header_libs
1869SECEDIT/SECEDIT.dummy:                  links_non_perl
1870SEQ_QUALITY/SEQ_QUALITY.dummy:          links_non_perl
1871SERVERCNTRL/SERVERCNTRL.dummy:          links_non_perl com
1872SL/ALILINK/ALILINK.dummy:               links_non_perl
1873SL/ALIVIEW/ALIVIEW.dummy:               links_non_perl
1874SL/AP_TREE/AP_TREE.dummy:               links_non_perl
1875SL/ARB_TREE/ARB_TREE.dummy:             links_non_perl
1876SL/AW_HELIX/AW_HELIX.dummy:             links_non_perl
1877SL/CONSENSUS/CONSENSUS.dummy:           links_non_perl
1878SL/DB_QUERY/DB_QUERY.dummy:             links_non_perl
1879SL/DB_SCANNER/DB_SCANNER.dummy:         links_non_perl
1880SL/DB_UI/DB_UI.dummy:                   links_non_perl
1881SL/FAST_ALIGNER/FAST_ALIGNER.dummy:     links_non_perl
1882SL/FILTER/FILTER.dummy:                 links_non_perl
1883SL/FILTSEQEXP/FILTSEQEXP.dummy:         links_non_perl
1884SL/GROUP_SEARCH/GROUP_SEARCH.dummy:     links_non_perl
1885SL/GUI_ALIVIEW/GUI_ALIVIEW.dummy:       links_non_perl
1886SL/HEADERTESTS/HEADERTESTS.dummy:       links_non_perl
1887SL/HELIX/HELIX.dummy:                   links_non_perl
1888SL/INSDEL/INSDEL.dummy:                 links_non_perl
1889SL/ITEM_SHADER/ITEM_SHADER.dummy:       links_non_perl
1890SL/ITEMS/ITEMS.dummy:                   links_non_perl
1891SL/LOCATION/LOCATION.dummy:             links_non_perl
1892SL/MACROS/MACROS.dummy:                 links_non_perl
1893SL/MATRIX/MATRIX.dummy:                 links_non_perl
1894SL/NDS/NDS.dummy:                       links_non_perl
1895SL/NEIGHBOURJOIN/NEIGHBOURJOIN.dummy:   links_non_perl
1896SL/PRONUC/PRONUC.dummy:                 links_non_perl
1897SL/PTCLEAN/PTCLEAN.dummy:               links_non_perl link_db
1898SL/PVP/PVP.dummy:                       links_non_perl
1899SL/QUERY/QUERY.dummy:                   links_non_perl link_db
1900SL/REFENTRIES/REFENTRIES.dummy:         links_non_perl
1901SL/REGEXPR/REGEXPR.dummy:               links_non_perl
1902SL/SAICALC/SAICALC.dummy:               links_non_perl
1903SL/SEQIO/SEQIO.dummy:                   links_non_perl
1904SL/SEQUENCE/SEQUENCE.dummy:             links_non_perl
1905SL/TRANSLATE/TRANSLATE.dummy:           links_non_perl
1906SL/TREE_ADMIN/TREE_ADMIN.dummy:         links_non_perl
1907SL/TREE_READ/TREE_READ.dummy:           links_non_perl
1908SL/TREE_WRITE/TREE_WRITE.dummy:         links_non_perl
1909SL/TREEDISP/TREEDISP.dummy:             links_non_perl
1910SL/XFERGUI/XFERGUI.dummy:               links_non_perl
1911SL/XFERSET/XFERSET.dummy:               links_non_perl
1912STAT/STAT.dummy:                        links_non_perl
1913TREEGEN/TREEGEN.dummy:                  links_non_perl
1914WETC/WETC.dummy:                        links_non_perl
1915WINDOW/libWINDOW.dummy:                 links_non_perl
1916XML/XML.dummy:                          links_non_perl
1917
1918ifeq ($(OPENGL),1)
1919GL/glAW/glAW.dummy: links_non_perl
1920GL/glpng/glpng.dummy: links_non_perl
1921GL/GL.dummy: GL/glAW/glAW.dummy GL/glpng/glpng.dummy
1922RNA3D/RNA3D.dummy: links_non_perl gl
1923endif
1924
1925UNIT_TESTER/UNIT_TESTER.dummy:          link_db \
1926        SERVERCNTRL/SERVERCNTRL.dummy \
1927
1928# see also TOOLS/Makefile@TOOLSLIBDEPENDS
1929TOOLS/TOOLS.dummy : links_non_perl link_db \
1930        CONSENSUS_TREE/CONSENSUS_TREE.dummy \
1931        SERVERCNTRL/SERVERCNTRL.dummy \
1932        SL/FILTER/FILTER.dummy \
1933        SL/FILTSEQEXP/FILTSEQEXP.dummy \
1934        SL/INSDEL/INSDEL.dummy \
1935        SL/REGEXPR/REGEXPR.dummy \
1936        SL/SEQIO/SEQIO.dummy \
1937        SL/TREE_READ/TREE_READ.dummy \
1938        SL/TREE_WRITE/TREE_WRITE.dummy \
1939        XML/XML.dummy \
1940
1941AWTC/AWTC.dummy :                       com
1942
1943NAMES/NAMES.dummy :                     com
1944SL/AW_NAME/AW_NAME.dummy :              com
1945
1946PROBE/PROBE.dummy :                     com
1947MULTI_PROBE/MULTI_PROBE.dummy :         com
1948PROBE_DESIGN/PROBE_DESIGN.dummy :       com
1949NALIGNER/NALIGNER.dummy :               com
1950
1951ARB_GDE/ARB_GDE.dummy :                 proto_tools menus
1952
1953compile_compatibility: SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.dummy
1954
1955#***************************************************************************************
1956#                       Short aliases to make targets
1957#***************************************************************************************
1958
1959show:
1960                @echo $(SEP)
1961                @echo 'Aliases for often needed targets:'
1962                @echo ''
1963                @echo ' executables:'
1964                @echo ''
1965                @echo '  nt     arb_ntree'
1966                @echo '  e4     arb_edit4 (includes secedit)'
1967                @echo '  di     arb_dist'
1968                @echo '  ph     arb_phylo'
1969                @echo '  pa     arb_parsimony'
1970                @echo '  tg     arb_treegen'
1971                @echo '  ds     arb_dbserver'
1972                @echo '  pt     arb_pt_server'
1973                @echo '  na     arb_name_server'
1974                @echo ''
1975                @echo ' libraries:'
1976                @echo ''
1977                @echo '  com    communication libraries'
1978                @echo '  db     ARB database'
1979                @echo '  aw     GUI lib'
1980                @echo '  awt    GUI toolkit'
1981                @echo '  awtc   general purpose library'
1982                @echo '  awti   import/export library'
1983                @echo '  mp     multi probe library'
1984                @echo '  ge     genome library'
1985                @echo '  pd     probe design lib'
1986                @echo '  prd    primer design lib'
1987                @echo ''
1988                @echo ' other targets:'
1989                @echo ''
1990                @echo '  help   recompile help files'
1991                @echo '  tools  make small tools used by arb'
1992                @echo ''
1993                @echo ' foreign targets:'
1994                @echo ''
1995                @echo '  gde    GDE'
1996                @echo '  agde   ARB_GDE'
1997                @echo ''
1998                @echo 'for other targets inspect $(ARBHOME)/Makefile'
1999                @echo ''
2000                @echo $(SEP)
2001
2002source_doc:
2003        @echo "Remove some links (doxygen crashes otherwise):"
2004        find . \( -name "AISC" -o -name "C" -o -name "GDEHELP" \) -type l -exec rm {} \;
2005        doxygen 2>&1 1>/dev/null
2006        $(MAKE) forcelinks
2007
2008dep_graph:
2009        @echo "Building some dependency graphs"
2010        SOURCE_TOOLS/dependency_graphs.pl
2011
2012help:   HELP_SOURCE/HELP_SOURCE.dummy
2013
2014HELP_SOURCE/HELP_SOURCE.dummy: link_core xml menus
2015
2016db:     ARBDB/libARBDB.dummy
2017core:   CORE/libCORE.dummy
2018aw:     WINDOW/libWINDOW.dummy
2019awt:    AWT/libAWT.dummy
2020awtc:   AWTC/AWTC.dummy
2021awti:   AWTI/AWTI.dummy
2022
2023mp:     MULTI_PROBE/MULTI_PROBE.dummy
2024mg:     MERGE/MERGE.dummy
2025ge:     GENOM/GENOM.dummy
2026prd:    PRIMER_DESIGN/PRIMER_DESIGN.dummy
2027
2028nt:     menus $(NTREE)
2029
2030nal:    $(NALIGNER)
2031
2032di:     $(DIST)
2033ph:     $(PHYLO)
2034pa:     $(PARSIMONY)
2035tg:     $(TREEGEN)
2036
2037ifeq ($(OPENGL),1)
20383d:     RNA3D/RNA3D.dummy
2039gl:     GL/GL.dummy
2040else
2041noopengl:
2042        @echo "invalid target for OPENGL=0"
20433d: noopengl
2044gl: noopengl
2045endif
2046
2047SL/SL.dummy: com
2048
2049ds:     $(DBSERVER)
2050pt:     $(PROBE)
2051pst:    PROBE_SET/PROBE_SET.dummy
2052pd:     PROBE_DESIGN/PROBE_DESIGN.dummy
2053na:     $(NAMES)
2054sq:     SEQ_QUALITY/SEQ_QUALITY.dummy
2055cma:    $(RNACMA)
2056
2057sec:    SECEDIT/SECEDIT.dummy
2058
2059e4:     $(EDIT4) readseq menus
2060
2061gi:     GENOM_IMPORT/GENOM_IMPORT.dummy
2062wetc:   $(WETC)
2063
2064xml:    XML/XML.dummy
2065stat:   STAT/STAT.dummy $(NTREE) $(EDIT4)
2066fa:     SL/FAST_ALIGNER/FAST_ALIGNER.dummy
2067
2068#********************************************************************************
2069
2070up_by_remake: depends proto vectorize_checks
2071
2072up: up_by_remake tags valgrind_update
2073
2074#********************************************************************************
2075
2076touch:
2077        SOURCE_TOOLS/touch_modified.pl
2078
2079modified: touch
2080        $(MAKE) all
2081
2082#********************************************************************************
2083
2084libdepends:
2085        $(MAKE) -C "SOURCE_TOOLS" \
2086                "RNA3D_LIB=$(RNA3D_LIB_4_DEPENDS)" \
2087                libdepends
2088
2089#********************************************************************************
2090
2091# create generated headers:
2092genheaders: TEMPLATES/TEMPLATES.dummy
2093
2094clrdotdepends:
2095        rm PROBE_COM/.depends || true
2096        rm NAMES_COM/.depends || true
2097        rm PERL2ARB/.depends || true
2098
2099comdepends: comtools clrdotdepends have_makedepend
2100        @echo "$(SEP) Partially build com interface"
2101        $(MAKE) PROBE_COM/PROBE_COM.depends NAMES_COM/NAMES_COM.depends
2102        $(MAKE) PROBE_COM/server.depends    NAMES_COM/server.depends
2103
2104depends: genheaders comdepends vectorize_checks have_makedepend
2105        @echo "$(SEP) Updating other dependencies"
2106        $(MAKE) $(subst NAMES_COM/server.depends,,$(subst PROBE_COM/server.depends,,$(SUBDIRS:.sub=.depends))) \
2107                HELP_SOURCE/HELP_SOURCE.depends \
2108                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.depends \
2109
2110        $(MAKE) libdepends
2111
2112depend: depends
2113
2114# ------------------------------------------------------------
2115# dependency generation tests for AISC code
2116#(all should work w/o creating wrong dependencies;
2117# neither in XXX_COM/Makefile nor in code using AISC interface)
2118dependstest1: silent_clean
2119        $(MAKE) depends
2120dependstest2: silent_clean
2121        $(MAKE) com
2122dependstest3: silent_clean
2123        $(MAKE) aw
2124dependstest4: silent_clean
2125        $(MAKE) pt
2126dependstest5: silent_clean
2127        $(MAKE) na
2128dependstest6: silent_clean
2129        $(MAKE) nt
2130dependstest7: silent_clean
2131        $(MAKE) all
2132# ------------------------------------------------------------
2133
2134vectorize_checks:
2135        $(MAKE) -C SOURCE_TOOLS -r vectorize_checks
2136
2137clean_checked_vect: lib/lib.clean
2138        SOURCE_TOOLS/clean_checked_vectorizations.sh
2139
2140# ------------------------------------------------------------
2141
2142AISC_MKPTPS/AISC_MKPTPS.dummy: links
2143
2144proto_tools: AISC_MKPTPS/AISC_MKPTPS.dummy
2145
2146proto: proto_tools
2147        @echo $(SEP) Updating prototypes
2148        $(MAKE) \
2149                ARBDB/ARBDB.proto \
2150                AISC_COM/AISC_COM.proto \
2151                ARB_GDE/ARB_GDE.proto \
2152                CORE/CORE.proto \
2153                CONVERTALN/CONVERTALN.proto \
2154                NTREE/NTREE.proto \
2155                MERGE/MERGE.proto \
2156                PROBE/PROBE.proto \
2157                SERVERCNTRL/SERVERCNTRL.proto \
2158                SL/SL.proto \
2159
2160#********************************************************************************
2161
2162valgrind_update: links
2163        @echo $(SEP) Updating for valgrind
2164        $(MAKE) -C SOURCE_TOOLS valgrind_update
2165
2166#********************************************************************************
2167
2168TAGFILE=TAGS
2169UTAGS=TAGS.$(ARBBID)
2170TAGFILE_TMP=$(UTAGS).tmp
2171
2172TAG_SOURCE_HEADERS=$(UTAGS).headers.tmp
2173TAG_SOURCE_CODE=$(UTAGS).codefiles.tmp
2174TAG_SOURCE_LISTS=$(TAG_SOURCE_HEADERS) $(TAG_SOURCE_CODE)
2175
2176ETAGS_IGNORE_LIST=SOURCE_TOOLS/etags_ignore.lst
2177
2178ETAGS=ctags -e -I @$(ETAGS_IGNORE_LIST) --sort=no --if0=no --extra=q
2179ETAGS_TYPES=--C-kinds=cgnsut --C++-kinds=cgnsut
2180ETAGS_FUN  =--C-kinds=fm     --C++-kinds=fm
2181ETAGS_REST =--C-kinds=dev    --C++-kinds=dev
2182
2183FILTER_TAGS_SOURCES= \
2184        $(SED) -e 's/^.\///g' | \
2185        grep -vi '^HEADERLIBS\|^GDE/\|/GEN[CH]/'
2186
2187$(TAG_SOURCE_HEADERS): links
2188        @find . \( -name '*.hxx' -o -name "*.h" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2189
2190$(TAG_SOURCE_CODE): links
2191        @find . \( -name '*.cxx' -o -name "*.c" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2192
2193$(UTAGS).1.tmp: $(TAG_SOURCE_HEADERS)
2194        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2195$(UTAGS).2.tmp: $(TAG_SOURCE_HEADERS)
2196        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2197$(UTAGS).3.tmp: $(TAG_SOURCE_HEADERS)
2198        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2199$(UTAGS).4.tmp: $(TAG_SOURCE_CODE)
2200        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2201$(UTAGS).5.tmp: $(TAG_SOURCE_CODE)
2202        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2203$(UTAGS).6.tmp: $(TAG_SOURCE_CODE)
2204        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2205
2206TAGS_ALL_PARTS=$(UTAGS).1.tmp $(UTAGS).2.tmp $(UTAGS).3.tmp $(UTAGS).4.tmp $(UTAGS).5.tmp $(UTAGS).6.tmp
2207
2208$(TAGFILE_TMP) : $(TAGS_ALL_PARTS)
2209        @cat $(TAGS_ALL_PARTS) > $@
2210        @rm $(TAGS_ALL_PARTS) $(TAG_SOURCE_LISTS)
2211
2212cleanOldTags:
2213        @find $(ARBHOME) -name 'TAGS.*.tmp' -ctime +2 -exec rm {} \;
2214
2215tags: $(TAGFILE_TMP) cleanOldTags
2216        @mv_if_diff $(TAGFILE_TMP) $(TAGFILE)
2217
2218#********************************************************************************
2219
2220LINKSTAMP=SOURCE_TOOLS/stamp.generate_all_links
2221
2222links: checks $(LINKSTAMP) arbmainwrapper
2223links_no_checks: $(LINKSTAMP) arbmainwrapper
2224
2225forcelinks:
2226        -rm $(LINKSTAMP)
2227        $(MAKE) links
2228
2229$(LINKSTAMP): SOURCE_TOOLS/generate_all_links.sh genheaders
2230        +SOURCE_TOOLS/generate_all_links.sh
2231        touch $(LINKSTAMP)
2232
2233clean_links:
2234#       avoid to delete linked pts, nas or arb_tcp.dat:
2235        find . -path './lib' -prune -o -type l -exec rm {} \;
2236#       removed obsolete file - refuses to disappear due to 'prune' above
2237        @rm -f lib/help/GDEHELP
2238        @rm -f $(LINKSTAMP) lib/inputMasks/format.readme
2239
2240redo_links: clean_links
2241        $(MAKE) links_no_checks
2242
2243#********************************************************************************
2244
2245header_libs:
2246        @(( \
2247                echo "$(SEP) Make HEADERLIBS"; \
2248                $(MAKE) -C HEADERLIBS all && \
2249                echo "$(SEP) Make HEADERLIBS [done]"; \
2250        ) > HEADERLIBS.log 2>&1 && (cat HEADERLIBS.log;rm HEADERLIBS.log)) || (cat HEADERLIBS.log;rm HEADERLIBS.log;false)
2251
2252#********************************************************************************
2253
2254gde:            GDE/GDE.dummy
2255GDE:            gde
2256agde:           ARB_GDE/ARB_GDE.dummy
2257tools:          TOOLS/TOOLS.dummy
2258convert:        $(CONVERT_ALN)
2259readseq:        READSEQ/READSEQ.dummy
2260
2261#***************************************************************************************
2262#                       Some user commands
2263#***************************************************************************************
2264
2265menus: binlink links
2266        @(( \
2267                echo "$(SEP) Make GDEHELP"; \
2268                $(MAKE) -C GDEHELP -r all && \
2269                echo "$(SEP) Make GDEHELP [done]"; \
2270        ) > GDEHELP.log 2>&1 && (cat GDEHELP.log;rm GDEHELP.log)) || (cat GDEHELP.log;rm GDEHELP.log;false)
2271
2272ifeq ($(DEBUG),1)
2273BIN_TARGET=develall
2274else
2275BIN_TARGET=all
2276endif
2277
2278
2279binlink:
2280        $(MAKE) -C bin $(BIN_TARGET)
2281
2282check_bin_dep: binlink
2283        SOURCE_TOOLS/check_bin_dependencies.pl
2284
2285fig_cure:
2286        SOURCE_TOOLS/sortfig.pl doit
2287
2288preplib:
2289        (cd lib;$(MAKE) all)
2290
2291# --------------------------------------------------------------------------------
2292# This section is quite tricky:
2293#
2294# make 'perl' is a BIG target, so when it has to be made, it has to be started
2295# as early as possible to reduce overall compile time. Since 'make' does not
2296# provide any priorities, i force it to build all 'perl'-prerequisites early, by
2297# adding artificial dependencies to these prerequisites
2298#
2299# That behavior is likely to be system-dependent.
2300# My goal was only to make it work on my current development system,
2301# where this saves about 20% of overall build time.
2302
2303ifeq ($(WITHPERL),1)
2304links_non_perl: PERLTOOLS/PERLTOOLS.dummy
2305perltools:      links_non_perl
2306perl:           realperl
2307else
2308links_non_perl: links
2309perl:           links
2310        $(MAKE) "WITHPERL=1" perl
2311endif
2312
2313# ---------------------------------------- perl
2314
2315realperl: perltools
2316        (( \
2317                echo "$(SEP) Make PERL2ARB" ; \
2318                $(TIME) $(MAKE) -C PERL2ARB -r -f Makefile.main \
2319                        "AUTODEPENDS=1" \
2320                        "dflags=$(dflags)" \
2321                        "cflags4perl=$(cflags) $(cxxflags) $(dflags)" \
2322                        "lflags4perl=$(lflags4perl)" \
2323                        "COMPILER_VERSION=$(COMPILER_VERSION)" \
2324                        all && \
2325                $(MAKE) -C PERL_SCRIPTS/test test && \
2326                echo "$(SEP) Make PERL2ARB [done]" ; \
2327        ) > PERL2ARB.log 2>&1 && (cat PERL2ARB.log;rm PERL2ARB.log)) || (cat PERL2ARB.log;rm PERL2ARB.log;false)
2328
2329perl_clean:
2330        @$(MAKE) -C PERL2ARB -r -f Makefile.main \
2331                "AUTODEPENDS=0" \
2332                clean
2333
2334PERL2ARB/PERL2ARB.clean:
2335        $(MAKE) perl_clean
2336        $(MAKE) -C PERL_SCRIPTS/test clean
2337
2338# ---------------------------------------- bindings to script languages
2339
2340bindings: lib/libCORE.so lib/libARBDB.so
2341        $(MAKE) -C BINDINGS all ARBDEPENDS="$(^:%=../%)" DFLAGS="$(dflags)"
2342
2343bindings_clean:
2344        $(MAKE) -C BINDINGS clean
2345
2346# ---------------------------------------- check resources
2347
2348check_res:
2349        $(ARBHOME)/SOURCE_TOOLS/check_resources.pl
2350
2351# ---------------------------------------- cleaning
2352
2353rmbak:
2354        @echo "[cleanup backup/core files]"
2355        @find . \(      -name '*%' \
2356                        -o -name '*.bak' \
2357                        -o -name '*~' \) \
2358                        -o \( -name 'core' -a \! -type d \) \
2359                -exec rm -v {} \; || \
2360        echo "Warning: target 'rmbak' reported problems when removing misc. backup files (ignored)"
2361        @echo "[cleanup done]"
2362
2363bin_reinit:
2364        $(MAKE) bin/bin.clean
2365        $(MAKE) -C "bin" all
2366
2367clean_directories:
2368        -rm -rf \
2369                $(ARBHOME)/PROBE_SET/bin \
2370                $(ARBHOME)/INCLUDE \
2371
2372libclean:
2373        -find $(ARBHOME) -type f \( -name '*.a' ! -type l \) -exec rm -f {} \;
2374        -find $(ARBHOME) -type f \( -name 'lib*.so' ! -type l \) -exec rm -f {} \;
2375
2376objclean:
2377        -find $(ARBHOME) -type f \( -name '*.o' ! -type l \) -exec rm -f {} \;
2378
2379# bin.clean and HELP_SOURCE.clean interfere
2380clean3:
2381        $(MAKE) bin/bin.clean
2382        $(MAKE) HELP_SOURCE/HELP_SOURCE.clean
2383
2384
2385# delete all binaries (similar to 'cleanlinked')
2386cleanRelinkable: libclean UNIT_TESTER/UNIT_TESTER.clean
2387        $(MAKE) -C bin cleanbinariesRelinkable
2388        $(MAKE) -C PROBE_SET cleanLinked
2389
2390
2391clean2: $(SUBDIRS:.sub=.clean) \
2392                clean3 \
2393                rmbak \
2394                libclean \
2395                objclean \
2396                lib/lib.clean \
2397                GDEHELP/GDEHELP.clean \
2398                HEADERLIBS/HEADERLIBS.clean \
2399                SOURCE_TOOLS/SOURCE_TOOLS.clean \
2400                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.clean \
2401                UNIT_TESTER/UNIT_TESTER.clean \
2402                TEMPLATES/TEMPLATES.clean \
2403                perl_clean \
2404                clean_directories \
2405
2406        rm -f *.last_gcc *.last_compiler config.makefile.bak
2407
2408# links are needed for cleanup
2409clean: redo_links motif_xpm_hack_clean
2410        $(MAKE) clean2
2411        $(MAKE) clean_cov_all clean_links
2412
2413silent_clean:
2414        $(MAKE) clean >/dev/null
2415
2416# 'relocated' is about 50% faster than 'rebuild'
2417reloc_clean: links
2418        @echo "---------------------------------------- Relocation cleanup"
2419        $(MAKE) \
2420                perl_clean \
2421                GDEHELP/GDEHELP.clean \
2422                HELP_SOURCE/genhelp/genhelp.clean \
2423                bin/bin.clean \
2424                libclean \
2425                objclean
2426
2427relocated: links
2428        $(MAKE) reloc_clean
2429        @echo "---------------------------------------- and remake"
2430        $(MAKE) build
2431
2432# -----------------------------------
2433# some stress tests
2434# (helpful to reveal race conditions with -j)
2435
2436rebuild4ever: rebuild
2437        $(MAKE) rebuild4ever
2438
2439build4ever: build
2440        $(MAKE) build4ever
2441
2442clean4ever: clean
2443        $(MAKE) clean4ever
2444
2445test4ever: ut
2446        $(MAKE) test4ever
2447
2448perl4ever: clean
2449        $(MAKE) links
2450        $(MAKE) perl
2451        $(MAKE) perl4ever
2452
2453help4ever: clean
2454        $(MAKE) help
2455        $(MAKE) help4ever
2456
2457# -----------------------------------
2458
2459cleanlinked: bin/bin.clean libclean
2460
2461relink: cleanlinked
2462        $(MAKE) all
2463
2464# --------------------------------------------------------------------------------
2465# source related targets
2466
2467CLOC=cloc
2468CLOCFLAGS=--no3 --quiet --progress-rate=0
2469CLOCARB=--exclude-dir=GDE .
2470CLOCEXT=GDE
2471CLOCCODE=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.code.def
2472CLOCREST=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.rest.def
2473CLOCFILT=tail --lines=+4
2474
2475cloc:
2476        @echo 'Arb code:'
2477        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCARB) | $(CLOCFILT)
2478        @echo 'Arb rest:'
2479        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCARB) | $(CLOCFILT)
2480        @echo 'External code:'
2481        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCEXT) | $(CLOCFILT)
2482        @echo 'External rest:'
2483        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCEXT) | $(CLOCFILT)
2484
2485
2486# patch generation
2487patch:
2488        SOURCE_TOOLS/arb_create_patch.sh arbPatch --svn
2489
2490# source tarball generation
2491save: sourcetarfile
2492
2493sourcetarfile: rmbak
2494        util/arb_save
2495
2496# test early whether save will work
2497savetest:
2498        @util/arb_srclst.pl >/dev/null
2499
2500testsave: savetest
2501
2502save2: rmbak
2503        util/arb_save ignore
2504
2505save_test: rmbak
2506        @echo "Testing source list.."
2507        @util/arb_srclst.pl > /dev/null
2508
2509save_test_no_error:
2510        @-$(MAKE) save_test
2511
2512# --------------------------------------------------------------------------------
2513# version management
2514
2515inc_candi:
2516        touch SOURCE_TOOLS/inc_candi.stamp
2517        $(MAKE) do_version_update
2518
2519inc_patch:
2520        touch SOURCE_TOOLS/inc_patch.stamp
2521        $(MAKE) do_version_update
2522
2523inc_minor:
2524        touch SOURCE_TOOLS/inc_minor.stamp
2525        $(MAKE) do_version_update
2526
2527inc_major:
2528        touch SOURCE_TOOLS/inc_major.stamp
2529        $(MAKE) do_version_update
2530
2531do_version_update:
2532        @echo Incrementing version information
2533        $(MAKE) savetest
2534        $(MAKE) genheaders # auto upgrades version early
2535
2536show_version:
2537        $(MAKE) genheaders # updates version info
2538        @echo "$(SEP) ARB version info"
2539        @grep ARB_VERSION TEMPLATES/arb_build.h
2540        @echo "$(SEP)"
2541
2542# --------------------------------------------------------------------------------
2543# special cleanups
2544
2545clean_opengl_changed: RNA3D/RNA3D.clean EDIT4/EDIT4.clean WINDOW/WINDOW.clean GL/GL.clean
2546
2547# --------------------------------------------------------------------------------
2548
2549arbapplications: nt pa e4 wetc pt na nal di ph ds wetc cma
2550
2551arb_external: convert tools gde readseq tg pst
2552
2553arb_no_perl: arbapplications help arb_external
2554
2555arb: motif_xpm_hack
2556        $(MAKE) "WITHPERL=1" perl arb_no_perl
2557
2558motif_xpm_hack:
2559        $(MAKE) -r -C "lib/motifHack" all
2560
2561motif_xpm_hack_clean:
2562        $(MAKE) -r -C "lib/motifHack" clean
2563
2564# --------------------------------------------------------------------------------
2565# special targets for SOURCE_TOOLS/remake_after_change.pl
2566
2567rac_arb_dist:           di
2568rac_arb_edit4:          e4
2569rac_arb_ntree:          nt
2570rac_arb_pars:           pa
2571rac_arb_phylo:          ph
2572rac_arb_wetc:           wetc
2573rac_arb_naligner:       nal
2574rac_arb_pt_server:      pt
2575rac_arb_db_server:      ds
2576rac_arb_name_server:    na
2577rac_arb_convert_aln:    convert
2578rac_arb_treegen:        tg
2579rac_arb_rnacma:         cma
2580rac_arb_help2xml:       help
2581
2582rac_arb_a2ps:           tools
2583rac_arb_consensus_tree: tools
2584rac_arb_dnarates:       tools
2585rac_arb_export_rates:   tools
2586rac_arb_export_tree:    tools
2587rac_arb_gene_probe:     tools
2588rac_arb_message:        tools
2589rac_arb_primer:         tools
2590rac_arb_probe:          tools
2591rac_arb_read_tree:      tools
2592
2593# --------------------------------------------------------------------------------
2594# unit testing
2595# @@@ work in progress
2596#
2597# goal is to automatically test all libraries/executables using TESTED_UNITS_AUTO
2598# currently not all test executables link w/o error.
2599# therefor units are organized in three sets:
2600#
2601#   TESTED_UNITS     = testable and contain tests
2602#   UNTESTED_UNITS   = testable, but no tests written yet
2603#   UNTESTABLE_UNITS = not testable
2604
2605# always define OPENGL units manually:
2606OPENGL_TESTS :=
2607ifeq ($(OPENGL),1)
2608OPENGL_TESTS += \
2609        $(subst .a,.test,$(RNA3D_LIB)) \
2610        GL/glAW/libglAW.test \
2611        GL/glpng/libglpng_arb.test \
2612
2613endif
2614
2615UNITS_NOT_AUTODETECTED = \
2616        HELP_SOURCE/HELP_SOURCE.tooltests
2617
2618TESTED_UNITS_AUTO = \
2619        $(OPENGL_TESTS) \
2620        $(TL_ARCHIVES:.a=.test) \
2621        $(TL_SHARED_ARCHIVES:.so=.test) \
2622        $(CL_ARCHIVES:.a=.test) \
2623        $(TL_TOOLS_COLLECTIONS:.toolColl=.tooltests) \
2624        $(UNITS_NOT_AUTODETECTED) \
2625
2626UNTESTED_UNITS = \
2627        $(OPENGL_TESTS) \
2628        EISPACK/EISPACK.test \
2629        GENOM/GENOM.test \
2630        ISLAND_HOPPING/ISLAND_HOPPING.test \
2631        NALIGNER/NALIGNER.test \
2632        NAMES/NAMES.test \
2633        PHYLO/PHYLO.test \
2634        PRIMER_DESIGN/PRIMER_DESIGN.test \
2635        READSEQ/READSEQ.tooltests \
2636        SECEDIT/SECEDIT.test \
2637        SEQ_QUALITY/SEQ_QUALITY.test \
2638        SERVERCNTRL/SERVERCNTRL.test \
2639        SL/ALIVIEW/ALIVIEW.test \
2640        SL/AP_TREE/AP_TREE.test \
2641        SL/ARB_TREE/ARB_TREE.test \
2642        SL/AW_HELIX/AW_HELIX.test \
2643        SL/AW_NAME/AW_NAME.test \
2644        SL/DB_SCANNER/DB_SCANNER.test \
2645        SL/DB_UI/DB_UI.test \
2646        SL/GUI_ALIVIEW/GUI_ALIVIEW.test \
2647        SL/HELIX/HELIX.test \
2648        SL/QUERY/QUERY.test \
2649        SL/REFENTRIES/REFENTRIES.test \
2650        SL/SEQUENCE/SEQUENCE.test \
2651        SL/TREE_ADMIN/TREE_ADMIN.test \
2652        SL/TREE_WRITE/TREE_WRITE.test \
2653        SL/XFERGUI/XFERGUI.test \
2654        STAT/STAT.test \
2655        TREEGEN/TREEGEN.test \
2656        WETC/WETC.test \
2657        XML/XML.test \
2658
2659# untestable units
2660
2661UNTESTABLE_UNITS = \
2662        AISC/AISC.test \
2663        NAMES_COM/server.test \
2664        PROBE_COM/server.test \
2665
2666# --------------------
2667# put all units containing tests into the following 4 sections (see also TESTED_UNITS below)
2668
2669# recent development
2670UNITS_TESTED_FIRST = \
2671        SL/MATRIX/MATRIX.test \
2672        AWTI/AWTI.test \
2673        SL/FILTSEQEXP/FILTSEQEXP.test \
2674        SL/GROUP_SEARCH/GROUP_SEARCH.test \
2675        SL/PVP/PVP.test \
2676        SL/SAICALC/SAICALC.test \
2677        SL/TRANSLATE/TRANSLATE.test \
2678        SL/XFERSET/XFERSET.test \
2679
2680# start units with long duration early
2681UNITS_RUNNING_LONG = \
2682        ARBDB/libARBDB.test \
2683        AWTC/AWTC.test \
2684        TOOLS/TOOLS.tooltests \
2685
2686# plain test-libaries that are not linked anywhere
2687TEST_SANDBOXES = \
2688        SL/CB/CB.test \
2689        SL/HEADERTESTS/HEADERTESTS.test \
2690
2691UNITS_TESTED = \
2692        AISC_MKPTPS/AISC_MKPTPS.tooltests \
2693        ARB_GDE/ARB_GDE.test \
2694        AWT/libAWT.test \
2695        CONSENSUS_TREE/CONSENSUS_TREE.test \
2696        CONVERTALN/CONVERTALN.test \
2697        CORE/libCORE.test \
2698        DBSERVER/DBSERVER.test \
2699        DIST/DIST.test \
2700        EDIT4/EDIT4.test \
2701        GENOM_IMPORT/GENOM_IMPORT.test \
2702        HELP_SOURCE/HELP_SOURCE.tooltests \
2703        MERGE/MERGE.test \
2704        MULTI_PROBE/MULTI_PROBE.test \
2705        NTREE/NTREE.test \
2706        PARSIMONY/PARSIMONY.test \
2707        PERLTOOLS/PERLTOOLS.tooltests \
2708        PROBE/PROBE.test \
2709        PROBE_DESIGN/PROBE_DESIGN.test \
2710        PROBE_SET/PROBE_SET.tooltests \
2711        RNACMA/RNACMA.test \
2712        SL/ALILINK/ALILINK.test \
2713        SL/CONSENSUS/CONSENSUS.test \
2714        SL/DB_QUERY/DB_QUERY.test \
2715        SL/FAST_ALIGNER/FAST_ALIGNER.test \
2716        SL/FILTER/FILTER.test \
2717        SL/INSDEL/INSDEL.test \
2718        SL/ITEM_SHADER/ITEM_SHADER.test \
2719        SL/ITEMS/ITEMS.test \
2720        SL/LOCATION/LOCATION.test \
2721        SL/MACROS/MACROS.test \
2722        SL/NDS/NDS.test \
2723        SL/NEIGHBOURJOIN/NEIGHBOURJOIN.test \
2724        SL/PRONUC/PRONUC.test \
2725        SL/PTCLEAN/PTCLEAN.test \
2726        SL/REGEXPR/REGEXPR.test \
2727        SL/SEQIO/SEQIO.test \
2728        SL/TREE_READ/TREE_READ.test \
2729        SL/TREEDISP/TREEDISP.test \
2730        WINDOW/libWINDOW.test \
2731
2732TESTED_UNITS = \
2733        $(UNITS_TESTED_FIRST) \
2734        $(UNITS_RUNNING_LONG) \
2735        $(TEST_SANDBOXES) \
2736        $(UNITS_TESTED) \
2737
2738# ----------------------------------------
2739
2740ifeq ($(DEVELOPER),RALF)
2741
2742DEFINED_TEST_UNITS = \
2743        $(TESTED_UNITS) \
2744        $(UNTESTED_UNITS) \
2745        $(UNTESTABLE_UNITS) \
2746
2747list_undefined_units:
2748        @UNIT_TESTER/list_undefined_units.pl $(DEFINED_TEST_UNITS) -- $(TESTED_UNITS_AUTO)
2749
2750else
2751
2752list_undefined_units:
2753
2754endif
2755
2756# ----------------------------------------
2757
2758TEST_LOG_DIR = UNIT_TESTER/logs
2759TEST_RUN_SUITE=$(MAKE) $(NODIR) -C UNIT_TESTER -f Makefile.suite -r
2760# -> UNIT_TESTER/Makefile.suite
2761TEST_MAKE_FLAGS=
2762TEST_POST_CLEAN=
2763ifeq ($(COVERAGE),1)
2764TEST_POST_CLEAN=$(MAKE) clean_cov
2765TEST_MAKE_FLAGS+=-j1
2766endif
2767
2768
2769%.test:
2770        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2771        ( \
2772            echo "take[1]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2773            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2774                "UNITDIR=$(@D)" \
2775                "UNITLIBNAME=$(@F:.test=)" \
2776                "COVERAGE=$(COVERAGE)" \
2777                "ARB_PID=$(ARB_PID)_$(@F)" \
2778                runtest; \
2779            echo "take[1]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"; \
2780            $(TEST_POST_CLEAN) \
2781        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1; \
2782        UNIT_TESTER/log_result.pl $(TEST_LOG_DIR)/$(@F).log )
2783
2784%.notest:
2785        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2786        ( \
2787            echo "take[4]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2788            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2789                "UNITDIR=$(@D)" \
2790                "UNITLIBNAME=$(@F:.notest=)" \
2791                "COVERAGE=0" \
2792                "ARB_PID=$(ARB_PID)_$(@F)" \
2793                check_no_test; \
2794            echo "take[4]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'" \
2795        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1 )
2796
2797
2798# tool test aliases (used to test one or multiple executable(s) in a single subdir):
2799%.tooltests:
2800        $(error please define an explicit tooltest alias for $@)
2801
2802AISC_MKPTPS/AISC_MKPTPS.tooltests : AISC_MKPTPS/mkptypes.test
2803        @echo "aliasing $@ -> $^"
2804PERLTOOLS/PERLTOOLS.tooltests : PERLTOOLS/arb_proto_2_xsub.test
2805        @echo "aliasing $@ -> $^"
2806PROBE_SET/PROBE_SET.tooltests : PROBE_SET/fb_test.test
2807        @echo "aliasing $@ -> $^"
2808HELP_SOURCE/HELP_SOURCE.tooltests : HELP_SOURCE/arb_help2xml.test
2809        @echo "aliasing $@ -> $^"
2810TOOLS/TOOLS.tooltests : TOOLS/arb_consensus_tree.test TOOLS/arb_probe.test TOOLS/arb_test.test
2811        @echo "aliasing $@ -> $^"
2812
2813# aliases for tools w/o tests:
2814READSEQ/READSEQ.tooltests:
2815        @echo "Note: no tests for $@"
2816
2817
2818test_base: $(UNIT_TESTER_LIB:.a=.dummy) $(subst .test,.dummy,$(TEST_SANDBOXES))
2819
2820clean_cov:
2821        find . \( -name "*.gcda" -o -name "*.gcov" -o -name "*.cov" \) -exec rm {} \;
2822
2823clean_cov_all: clean_cov
2824        find . \( -name "*.gcno" \) -exec rm {} \;
2825
2826cleanup_faked_arbpids:
2827        @rm ~/.arb_tmp/tmp/arb_pids_${USER}_${ARB_PID}_* || true
2828
2829cleanup_faked_arbpids_and_fail: cleanup_faked_arbpids
2830        @false
2831
2832NOTESTS_IN_UNTESTED = $(subst .test,.notest,$(UNTESTED_UNITS))
2833
2834run_tests_faked_arbpid:
2835        +@$(TEST_RUN_SUITE) init
2836        @echo "take[2]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2837        @$(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(TESTED_UNITS) $(NOTESTS_IN_UNTESTED) || $(MAKE) cleanup_faked_arbpids_and_fail
2838        @echo "take[2]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2839        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2840        @$(MAKE) clean_cov >/dev/null
2841        @$(MAKE) cleanup_faked_arbpids
2842
2843 # @@@ instead of only running UNIT, this should as well run all tests this unit depends on? according to 'needs_libs'
2844 # @@@ 'run_tests_faked_arbpid' does not work for UNIT=ARBDB/libARBDB or UNIT=PARS/PARS -> could be solved via extra suffix, e.g. ARBDB/libARBDB.unit
2845
2846run_onetest_faked_arbpid:
2847        +@$(TEST_RUN_SUITE) init
2848        @echo "take[3]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2849        test -n "$(UNIT)" || (echo "Error: UNIT has to be defined for target 'run_onetest_faked_arbpid'!"; false)
2850        $(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(UNIT).test || $(MAKE) cleanup_faked_arbpids_and_fail
2851        @echo "take[3]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2852        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2853        @$(MAKE) clean_cov >/dev/null
2854        @$(MAKE) cleanup_faked_arbpids
2855
2856run_tests: test_base clean_cov
2857        $(MAKE) "ARB_PID=UT_$$$$" run_tests_faked_arbpid list_undefined_units
2858
2859run_oneunitstests: test_base
2860        $(MAKE) "ARB_PID=UT_$$$$" run_onetest_faked_arbpid
2861
2862
2863ut:
2864ifeq ($(UNIT_TESTS),1)
2865        @echo $(MAKE) run_tests
2866        @$(MAKE) run_tests
2867else
2868        @echo "Not compiled with unit tests"
2869endif
2870
2871
2872aut:
2873        +@$(TEST_RUN_SUITE) unskip
2874        $(MAKE) ut
2875
2876# --------------------------------------------------------------------------------
2877
2878TIMELOG=$(ARBHOME)/arb_time.log
2879TIMEARGS=--append --output=$(TIMELOG) --format=" * %E(%S+%U) %P [%C]"
2880TIMECMD=$(TIME) $(TIMEARGS)
2881
2882time_one:
2883ifeq ($(ONE_TIMED_TARGET),)
2884        @echo "Error: You have to pass ONE_TIMED_TARGET to $@"
2885        false
2886else
2887        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET)"
2888        @$(TIMECMD) $(MAKE) $(ONE_TIMED_TARGET)
2889        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET) [done]"
2890endif
2891
2892timed_target:
2893ifeq ($(TIMED_TARGET),)
2894        @echo "Error: You have to pass TIMED_TARGET to $@"
2895        false
2896else
2897        @echo "Build time:" > $(TIMELOG)
2898        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2899        @cat $(TIMELOG)
2900        @rm $(TIMELOG)
2901endif
2902
2903timed_target_tested:
2904ifeq ($(TIMED_TARGET),)
2905        @echo "Error: You have to pass TIMED_TARGET to $@"
2906        false
2907else
2908        @echo "Build time:" > $(TIMELOG)
2909        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2910        $(MAKE) "ONE_TIMED_TARGET=ut" time_one
2911        @cat $(TIMELOG)
2912        @rm $(TIMELOG)
2913endif
2914
2915clean_timed_target:
2916ifeq ($(TIMED_TARGET),)
2917        @echo "Error: You have to pass TIMED_TARGET to $@"
2918        false
2919else
2920        @echo "Build time:" > $(TIMELOG)
2921        $(MAKE) "ONE_TIMED_TARGET=clean" time_one
2922        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2923        @cat $(TIMELOG)
2924        @rm $(TIMELOG)
2925endif
2926
2927# --------------------------------------------------------------------------------
2928
2929CHECKOUT_MODIFIED=0# set to 1 to temporarily skip test for modifications (do not check in if set to 1)
2930
2931check_svn_does_not_contain_generated:
2932ifeq ($(CHECKOUT_MODIFIED),0)
2933        @echo "Testing that build does not modify files in SVN"
2934        @test 0 = `svn status | wc -l` || ( \
2935                echo "The checkout is not/no longer clean:"; \
2936                svn status; \
2937                echo "- if this fails instantly, your checkout is not clean"; \
2938                echo "- if this fails after other targets, these targets modify checked in data"; \
2939                echo "  (a common cause may be that depends are not up to date)"; \
2940                false)
2941else
2942        grep -Hn 'CHECKOUT_MODIFIED' Makefile
2943endif
2944
2945check_svn_ignores_generated:
2946        @test 0 = `svn status | grep '^\?' | wc -l` || ( \
2947                echo "There are svn-unignored files:"; \
2948                svn status | grep '^\?'; \
2949                echo "(all generated files should be svn-ignored)"; \
2950                false)
2951
2952check_svn_state: check_svn_does_not_contain_generated
2953        $(MAKE) check_svn_ignores_generated
2954        $(MAKE) savetest
2955
2956things_that_always_should_work: depends proto
2957
2958post_commit_check:
2959        @echo "---------------------------------------- [Initial]"
2960        $(MAKE) check_svn_state
2961
2962        $(MAKE) clean
2963        @echo "---------------------------------------- [After 'make clean']"
2964        $(MAKE) check_svn_state
2965
2966        $(MAKE) things_that_always_should_work
2967        @echo "---------------------------------------- [After 'make things_that_always_should_work']"
2968        $(MAKE) check_svn_state
2969
2970        $(MAKE) all
2971        @echo "---------------------------------------- [After 'make all']"
2972        $(MAKE) check_svn_state
2973
2974        $(MAKE) things_that_always_should_work
2975        @echo "---------------------------------------- [Final]"
2976        $(MAKE) check_svn_state
2977
2978# --------------------------------------------------------------------------------
2979# sanitize arb_ntree; also works for clients (arb_edit4, ...) started from there.
2980
2981sanitize: all
2982        ( \
2983                export "LSAN_OPTIONS=max_leaks=30:suppressions=$(ARBHOME)/SOURCE_TOOLS/arb.leaksan.supp"; \
2984                echo "sake[1]: Entering directory \`$(ARBHOME)'"; \
2985                $(ARBHOME)/bin/arb_ntree --execute _logged ~/data/test.arb 2>&1 ; \
2986                echo "sake[1]: Leaving directory \`$(ARBHOME)'" \
2987        ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
2988
2989# --------------------------------------------------------------------------------
2990# build and test one unit:
2991
2992build_oneunit:
2993        $(MAKE) "WITHPERL=1" $(UNIT).dummy
2994
2995oneunit:
2996ifndef UNIT
2997        @echo "Please define UNIT, e.g. using"
2998        @echo "      make \"UNIT=ARBDB/libARBDB\"       oneunit"
2999        @echo "      make \"UNIT=SL/TREEDISP/TREEDISP\" oneunit"
3000        @echo "(Note: 1st is a shared library, 2nd isn't)"
3001        false
3002else
3003        @echo "Build time" > $(TIMELOG)
3004        @echo "$(SEP) $(MAKE) build_oneunit"
3005        @$(TIMECMD) $(MAKE) build_oneunit
3006 ifeq ($(UNIT_TESTS),1)
3007        @echo "$(SEP) $(MAKE) run_oneunitstests"
3008        @$(TIMECMD) $(MAKE) run_oneunitstests
3009 endif
3010        @cat $(TIMELOG)
3011        @rm $(TIMELOG)
3012endif
3013
3014# --------------------------------------------------------------------------------
3015# Main targets:
3016
3017tarfile: rebuild
3018        $(MAKE) prepare_libdir
3019        util/arb_compress
3020
3021tarfile_quick: all
3022        $(MAKE) prepare_libdir
3023        util/arb_compress
3024
3025# -----------------------------------
3026
3027build: arb
3028        $(MAKE) check_bin_dep preplib compile_compatibility fig_cure
3029
3030all:
3031        @echo "Build time" > $(TIMELOG)
3032#       $(MAKE) clean_checked_vect # uncomment to rebuild sources where expected vectorization gets tested
3033        @echo "$(SEP) $(MAKE) all"
3034        @$(TIMECMD) $(MAKE) build
3035        @echo $(SEP)
3036        @echo "made 'all' with success."
3037        @echo "to start arb enter 'arb'"
3038ifeq ($(UNIT_TESTS),1)
3039        @echo "$(SEP) $(MAKE) run_tests"
3040        @$(TIMECMD) $(MAKE) run_tests
3041endif
3042        @echo "$(SEP) $(MAKE) all [done]"
3043ifeq ($(DEBUG),1)
3044        @$(MAKE) save_test_no_error >/dev/null # just show hints
3045endif
3046        @cat $(TIMELOG)
3047        @rm $(TIMELOG)
3048
3049rebuild: clean
3050        $(MAKE) all
3051
3052# --------------------------------------------------------------------------------
3053# special targets showing obvious error at bottom
3054# (intended to be used from automated builds)
3055
3056BUILD_LOG=build.log
3057SHELL=bash
3058REDIRECT_KEEP_EXITCODE = tee $(BUILD_LOG) ; exit "$${PIPESTATUS[0]}"
3059EXTRACT_ERROR_SUMMARY  = (./SOURCE_TOOLS/short_error_summary.pl $(BUILD_LOG); false)
3060
3061ALL:
3062        @(($(MAKE) all 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3063
3064REBUILD:
3065        @(($(MAKE) rebuild 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3066
3067TARFILE:
3068        @(($(MAKE) tarfile 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3069
3070TARFILE_QUICK:
3071        @(($(MAKE) tarfile_quick 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3072
Note: See TracBrowser for help on using the repository browser.