source: trunk/Makefile

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