source: branches/species/Makefile

Last change on this file was 19695, checked in by westram, 7 days ago
  • refactored selection list admin
    • uses SelectionAdmin to provide global data
    • moved code from NTREE to SPECSEL
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 88.9 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/SPECSEL/SPECSEL.a \
1461                SL/GROUP_SEARCH/GROUP_SEARCH.a \
1462                SL/SAICALC/SAICALC.a \
1463                SL/DB_UI/DB_UI.a \
1464                SL/ARB_SPEC/ARB_SPEC.a \
1465                SL/MASKS/MASKS.a \
1466                AWTC/AWTC.a \
1467                AWTI/AWTI.a \
1468                CONSENSUS_TREE/CONSENSUS_TREE.a \
1469                GENOM_IMPORT/GENOM_IMPORT.a \
1470                GENOM/GENOM.a \
1471                MERGE/MERGE.a \
1472                MULTI_PROBE/MULTI_PROBE.a \
1473                PRIMER_DESIGN/PRIMER_DESIGN.a \
1474                PROBE_DESIGN/PROBE_DESIGN.a \
1475                SEQ_QUALITY/SEQ_QUALITY.a \
1476                SERVERCNTRL/SERVERCNTRL.a \
1477                SL/ALILINK/ALILINK.a \
1478                SL/AW_NAME/AW_NAME.a \
1479                SL/APP/APP.a \
1480                SL/CONSENSUS/CONSENSUS.a \
1481                SL/CANVAS/CANVAS.a \
1482                SL/DB_SCANNER/DB_SCANNER.a \
1483                SL/DB_QUERY/DB_QUERY.a \
1484                SL/QUERY/QUERY.a \
1485                SL/SEQIO/SEQIO.a \
1486                STAT/STAT.a \
1487                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1488                SL/GUI_TK/GUI_TK.a \
1489                SL/HELIX/HELIX.a \
1490                SL/REGEXPR/REGEXPR.a \
1491                SL/REFENTRIES/REFENTRIES.a \
1492                SL/NDS/NDS.a \
1493                SL/ITEM_SHADER/ITEM_SHADER.a \
1494                SL/ITEMS/ITEMS.a \
1495                SL/INSDEL/INSDEL.a \
1496                SL/LOCATION/LOCATION.a \
1497                SL/MACROS/MACROS.a \
1498                SL/PVP/PVP.a \
1499                SL/TRANSLATE/TRANSLATE.a \
1500                SL/TREEDISP/TREEDISP.a \
1501                SL/TREE_ADMIN/TREE_ADMIN.a \
1502                SL/TREE_READ/TREE_READ.a \
1503                SL/TREE_WRITE/TREE_WRITE.a \
1504                SL/XFERGUI/XFERGUI.a \
1505                SL/XFERSET/XFERSET.a \
1506                XML/XML.a \
1507                $(ARCHS_AP_TREE) \
1508
1509ARCHS_NTREE_ALL = $(ARCHS_NTREE) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) $(XMLLIBS)
1510
1511$(NTREE): $(ARCHS_NTREE:.a=.dummy) link_aw
1512        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NTREE_ALL) || ( \
1513                echo "$(SEP) Link $@"; \
1514                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL)" ; \
1515                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL) && \
1516                echo "$(SEP) Link $@ [done]"; \
1517                )
1518
1519#***********************************    arb_edit4 **************************************
1520EDIT4 = bin/arb_edit4
1521
1522ARCHS_EDIT4 := \
1523                EDIT4/EDIT4.a \
1524                ARB_GDE/ARB_GDE.a \
1525                SL/FAST_ALIGNER/FAST_ALIGNER.a \
1526                AWTC/AWTC.a \
1527                ISLAND_HOPPING/ISLAND_HOPPING.a \
1528                SECEDIT/SECEDIT.a \
1529                SERVERCNTRL/SERVERCNTRL.a \
1530                SL/APP/APP.a \
1531                SL/GUI_TK/GUI_TK.a \
1532                SL/ARB_SPEC/ARB_SPEC.a \
1533                SL/AW_HELIX/AW_HELIX.a \
1534                SL/AW_NAME/AW_NAME.a \
1535                SL/CONSENSUS/CONSENSUS.a \
1536                SL/CANVAS/CANVAS.a \
1537                SL/ITEMS/ITEMS.a \
1538                STAT/STAT.a \
1539                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1540                SL/HELIX/HELIX.a \
1541                SL/TRANSLATE/TRANSLATE.a \
1542                SL/MACROS/MACROS.a \
1543                SL/MAPKEY/MAPKEY.a \
1544                SL/NDS/NDS.a \
1545                $(ARCHS_AP_TREE) \
1546                XML/XML.a \
1547
1548ifeq ($(OPENGL),1)
1549ARCHS_EDIT4 += RNA3D/RNA3D.a
1550endif
1551
1552ARCHS_EDIT4_ALL = $(ARCHS_EDIT4) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) $(LIBS_EDIT4)
1553
1554LIBS_EDIT4 := $(GL_LIBS)
1555
1556$(EDIT4): $(ARCHS_EDIT4:.a=.dummy) link_aw
1557        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_EDIT4_ALL) || ( \
1558                echo "$(SEP) Link $@"; \
1559                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL)" ; \
1560                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL) && \
1561                echo "$(SEP) Link $@ [done]"; \
1562                )
1563
1564#***********************************    arb_rnacma **************************************
1565RNACMA = bin/arb_rnacma
1566ARCHS_RNACMA = \
1567                RNACMA/RNACMA.a \
1568
1569ARCHS_RNACMA_ALL = $(ARCHS_RNACMA) $(DBSYS_LIBS)
1570
1571$(RNACMA) : $(ARCHS_RNACMA:.a=.dummy) link_db
1572        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_RNACMA_ALL) || ( \
1573                echo "$(SEP) Link $@"; \
1574                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL)"; \
1575                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL) && \
1576                echo "$(SEP) Link $@ [done]"; \
1577                )
1578
1579#***********************************    arb_wetc **************************************
1580WETC = bin/arb_wetc
1581ARCHS_WETC = \
1582                WETC/WETC.a \
1583                SL/APP/APP.a \
1584                SL/MACROS/MACROS.a \
1585                SL/GUI_TK/GUI_TK.a \
1586                SL/HELIX/HELIX.a \
1587                SL/FILTER/FILTER.a \
1588                XML/XML.a \
1589
1590ARCHS_WETC_ALL = $(ARCHS_WETC) $(GUI_LIBS)
1591
1592$(WETC): $(ARCHS_WETC:.a=.dummy) link_aw
1593        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_WETC_ALL) || ( \
1594                echo "$(SEP) Link $@"; \
1595                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL)" ; \
1596                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL) && \
1597                echo "$(SEP) Link $@ [done]"; \
1598                )
1599
1600#***********************************    arb_dist **************************************
1601DIST = bin/arb_dist
1602ARCHS_DIST = \
1603                DIST/DIST.a \
1604                CONSENSUS_TREE/CONSENSUS_TREE.a \
1605                EISPACK/EISPACK.a \
1606                SERVERCNTRL/SERVERCNTRL.a \
1607                SL/APP/APP.a \
1608                SL/GUI_TK/GUI_TK.a \
1609                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1610                SL/HELIX/HELIX.a \
1611                SL/MATRIX/MATRIX.a \
1612                SL/MACROS/MACROS.a \
1613                SL/NDS/NDS.a \
1614                SL/ITEMS/ITEMS.a \
1615                SL/ARB_SPEC/ARB_SPEC.a \
1616                SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a \
1617                XML/XML.a \
1618                $(ARCHS_AP_TREE) \
1619
1620ARCHS_DIST_ALL = $(ARCHS_DIST) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS)
1621
1622$(DIST): $(ARCHS_DIST:.a=.dummy) link_aw
1623        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DIST_ALL) || ( \
1624                echo "$(SEP) Link $@"; \
1625                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL)" ; \
1626                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL) && \
1627                echo "$(SEP) Link $@ [done]"; \
1628                )
1629
1630#***********************************    arb_pars **************************************
1631PARSIMONY = bin/arb_pars
1632ARCHS_PARSIMONY = \
1633                PARSIMONY/PARSIMONY.a \
1634                SERVERCNTRL/SERVERCNTRL.a \
1635                SL/APP/APP.a \
1636                SL/GUI_TK/GUI_TK.a \
1637                SL/AW_NAME/AW_NAME.a \
1638                SL/CANVAS/CANVAS.a \
1639                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1640                SL/HELIX/HELIX.a \
1641                SL/MACROS/MACROS.a \
1642                SL/NDS/NDS.a \
1643                SL/ITEMS/ITEMS.a \
1644                SL/TRANSLATE/TRANSLATE.a \
1645                SL/TREEDISP/TREEDISP.a \
1646                XML/XML.a \
1647                $(ARCHS_AP_TREE) \
1648
1649ARCHS_PARSIMONY_ALL = $(ARCHS_PARSIMONY) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS)
1650
1651$(PARSIMONY): $(ARCHS_PARSIMONY:.a=.dummy) link_aw
1652        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PARSIMONY_ALL) || ( \
1653                echo "$(SEP) Link $@"; \
1654                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL)" ; \
1655                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL) && \
1656                echo "$(SEP) Link $@ [done]"; \
1657                )
1658
1659#*********************************** arb_convert_aln **************************************
1660CONVERT_ALN = bin/arb_convert_aln
1661ARCHS_CONVERT_ALN =     \
1662                CONVERTALN/CONVERTALN.a \
1663
1664ARCHS_CONVERT_ALN_ALL = $(ARCHS_CONVERT_ALN) $(DBSYS_LIBS)
1665
1666$(CONVERT_ALN) : $(ARCHS_CONVERT_ALN:.a=.dummy) link_db
1667        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_CONVERT_ALN_ALL) || ( \
1668                echo "$(SEP) Link $@"; \
1669                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL)"; \
1670                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL) && \
1671                echo "$(SEP) Link $@ [done]"; \
1672                )
1673
1674#*********************************** arb_treegen **************************************
1675
1676TREEGEN = bin/arb_treegen
1677ARCHS_TREEGEN = \
1678                TREEGEN/TREEGEN.a \
1679
1680ARCHS_TREEGEN_ALL = $(ARCHS_TREEGEN)
1681
1682$(TREEGEN) :  $(ARCHS_TREEGEN:.a=.dummy)
1683        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main_C) $(ARCHS_TREEGEN_ALL) || ( \
1684                echo "$(SEP) Link $@"; \
1685                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL)" ; \
1686                $(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL) && \
1687                echo "$(SEP) Link $@ [done]"; \
1688                )
1689
1690#***********************************    arb_naligner **************************************
1691NALIGNER = bin/arb_naligner
1692ARCHS_NALIGNER = \
1693                NALIGNER/NALIGNER.a \
1694                SERVERCNTRL/SERVERCNTRL.a \
1695                SL/HELIX/HELIX.a \
1696
1697ARCHS_NALIGNER_ALL = $(ARCHS_NALIGNER) $(ARCHS_CLIENT_PROBE) $(DBSYS_LIBS)
1698
1699$(NALIGNER): $(ARCHS_NALIGNER:.a=.dummy) link_db
1700        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NALIGNER_ALL) || ( \
1701                echo "$(SEP) Link $@"; \
1702                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL)" ; \
1703                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL) && \
1704                echo "$(SEP) Link $@ [done]"; \
1705                )
1706
1707#***********************************    arb_phylo **************************************
1708PHYLO = bin/arb_phylo
1709ARCHS_PHYLO = \
1710                PHYLO/PHYLO.a \
1711                SL/APP/APP.a \
1712                SL/GUI_TK/GUI_TK.a \
1713                SL/HELIX/HELIX.a \
1714                SL/FILTER/FILTER.a \
1715                SL/MACROS/MACROS.a \
1716                XML/XML.a \
1717
1718ARCHS_PHYLO_ALL = $(ARCHS_PHYLO) $(GUI_LIBS)
1719
1720$(PHYLO): $(ARCHS_PHYLO:.a=.dummy) link_aw
1721        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PHYLO_ALL) || ( \
1722                echo "$(SEP) Link $@"; \
1723                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL)" ; \
1724                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL) && \
1725                echo "$(SEP) Link $@ [done]"; \
1726                )
1727
1728#***************************************************************************************
1729#                                       SERVER SECTION
1730#***************************************************************************************
1731
1732#***********************************    arb_db_server **************************************
1733DBSERVER = bin/arb_db_server
1734ARCHS_DBSERVER = \
1735                DBSERVER/DBSERVER.a \
1736                SERVERCNTRL/SERVERCNTRL.a \
1737
1738ARCHS_DBSERVER_ALL = $(ARCHS_DBSERVER) $(ARBDB_LIB) $(ARCHS_CLIENT_PROBE) $(SYSLIBS)
1739
1740$(DBSERVER): $(ARCHS_DBSERVER:.a=.dummy) link_db
1741        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DBSERVER_ALL) || ( \
1742                echo "$(SEP) Link $@"; \
1743                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL)" ; \
1744                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL) && \
1745                echo "$(SEP) Link $@ [done]"; \
1746                )
1747
1748#***********************************    arb_pt_server **************************************
1749PROBE = bin/arb_pt_server
1750
1751ARCHS_PROBE_DEPEND = \
1752                PROBE/PROBE.a \
1753                SL/PTCLEAN/PTCLEAN.a \
1754                SERVERCNTRL/SERVERCNTRL.a \
1755                SL/HELIX/HELIX.a \
1756
1757ARCHS_PROBE_ALL = $(ARCHS_PROBE_DEPEND) $(ARCHS_CLIENT_PROBE) $(ARBDB_LIB) $(SYSLIBS)
1758
1759$(PROBE): $(ARCHS_PROBE_DEPEND:.a=.dummy) link_db
1760        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) config.makefile $(ARCHS_PROBE_ALL) || ( \
1761                echo "$(SEP) Link $@"; \
1762                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL)" ; \
1763                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL) && \
1764                echo "$(SEP) Link $@ [done]"; \
1765                )
1766
1767#***********************************    arb_name_server **************************************
1768NAMES = bin/arb_name_server
1769ARCHS_NAMES = \
1770                NAMES/NAMES.a \
1771                SERVERCNTRL/SERVERCNTRL.a \
1772
1773ARCHS_NAMES_ALL = $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) NAMES_COM/server.a $(SYSLIBS)
1774
1775$(NAMES): $(ARCHS_NAMES:.a=.dummy) link_db
1776        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NAMES_ALL) || ( \
1777                echo "$(SEP) Link $@"; \
1778                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL)" ; \
1779                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL) && \
1780                echo "$(SEP) Link $@ [done]"; \
1781                )
1782
1783#***********************************    SHARED LIBRARIES SECTION  **************************************
1784
1785prepare_libdir: addlibs
1786
1787addlibs:
1788        (perl $(ARBHOME)/SOURCE_TOOLS/provide_libs.pl \
1789                                "arbhome=$(ARBHOME)" \
1790                                "opengl=$(OPENGL)" \
1791                                "link_static=$(LINK_STATIC)" \
1792        )
1793
1794#***************************************************************************************
1795#                       Recursive calls to sub-makefiles
1796#***************************************************************************************
1797
1798%.depends: have_makedepend
1799        @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile
1800        @$(MAKE) -C $(@D) -r \
1801                "AUTODEPENDS=1" \
1802                "MAIN=nothing" \
1803                "cflags=noCflagsHere_use_MAKEDEPENDFLAGS" \
1804                "cxxflags=noCxxflagsHere_use_MAKEDEPENDFLAGS" \
1805                depends
1806        @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null
1807        @cat $(@D)/Makefile \
1808                | SOURCE_TOOLS/fix_depends.pl "(from main)" \
1809                >$(@D)/Makefile.2
1810        @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile
1811        @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed
1812
1813%.proto:
1814        @($(MAKE) -C $(@D) \
1815                "AUTODEPENDS=0" \
1816                "MAIN=nothing" \
1817                "cflags=noCflags" \
1818                "cxxflags=noCxxflags" \
1819                proto 2>&1 ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
1820
1821%.clean:
1822        @$(MAKE) -C $(@D) \
1823                "AUTODEPENDS=0" \
1824                "MAIN=nothing" \
1825                "cflags=noCflags" \
1826                "cxxflags=noCxxflags" \
1827                clean
1828
1829
1830# stop wrong targets:
1831target_is_missing_lib_prefix:
1832        @echo "Error: Denied to build shared library target with missing 'lib'-prefix"
1833        false
1834
1835ARBDB/ARBDB.dummy:   target_is_missing_lib_prefix
1836CORE/CORE.dummy:     target_is_missing_lib_prefix
1837AWT/AWT.dummy:       target_is_missing_lib_prefix
1838WINDOW/WINDOW.dummy: target_is_missing_lib_prefix
1839
1840# rule to generate main target (normally a library):
1841# @@@ check effect of setting LANG=C below
1842%.dummy:
1843        @( export ID=$$$$; LANG=C; \
1844        (( \
1845            echo "$(SEP) Make $(@D)"; \
1846            $(MAKE) -C $(@D) -r \
1847                "AUTODEPENDS=1" \
1848                "MAIN=$(@F:.dummy=.a)" \
1849                "cflags=$(cflags) -DIN_ARB_$(subst /,_,$(@D))" \
1850                && \
1851            echo "$(SEP) Make $(@D) [done]"; \
1852        ) >$(@D).$$ID.log 2>&1 && (cat $(@D).$$ID.log;rm $(@D).$$ID.log)) || (cat $(@D).$$ID.log;rm $(@D).$$ID.log;false))
1853
1854# Additional dependencies for subtargets:
1855
1856PROBE_COM/PROBE_COM.dummy : comtools
1857NAMES_COM/NAMES_COM.dummy : comtools
1858
1859com: PROBE_COM/PROBE_COM.dummy NAMES_COM/NAMES_COM.dummy
1860
1861# stop wrong more targets:
1862PROBE_COM/server.dummy:
1863        @echo Unwanted request to make target $<
1864        false
1865
1866PROBE_COM/client.dummy:
1867        @echo Unwanted request to make target $<
1868        false
1869
1870NAMES_COM/server.dummy:
1871        @echo Unwanted request to make target $<
1872        false
1873
1874NAMES_COM/client.dummy:
1875        @echo Unwanted request to make target $<
1876        false
1877
1878
1879ARBDB/libARBDB.dummy:                   links
1880CORE/libCORE.dummy:                     links
1881
1882PERLTOOLS/PERLTOOLS.dummy:              core db
1883
1884# all subdirs perl not depends on go here (ADD_links_non_perl)
1885AWTI/AWTI.dummy:                        links_non_perl
1886CONSENSUS_TREE/CONSENSUS_TREE.dummy:    links_non_perl
1887CONVERTALN/CONVERTALN.dummy:            links_non_perl
1888DBSERVER/DBSERVER.dummy:                links_non_perl
1889DIST/DIST.dummy:                        links_non_perl
1890EDIT4/EDIT4.dummy:                      links_non_perl com
1891EISPACK/EISPACK.dummy:                  links_non_perl
1892GDE/GDE.dummy:                          links_non_perl
1893GENOM/GENOM.dummy:                      links_non_perl
1894GENOM_IMPORT/GENOM_IMPORT.dummy:        links_non_perl
1895ISLAND_HOPPING/ISLAND_HOPPING.dummy:    links_non_perl
1896MERGE/MERGE.dummy:                      links_non_perl
1897NTREE/NTREE.dummy:                      links_non_perl
1898PARSIMONY/PARSIMONY.dummy:              links_non_perl
1899PHYLO/PHYLO.dummy:                      links_non_perl
1900PRIMER_DESIGN/PRIMER_DESIGN.dummy:      links_non_perl
1901PROBE_SET/PROBE_SET.dummy:              links_non_perl link_db
1902READSEQ/READSEQ.dummy:                  links_non_perl
1903RNACMA/RNACMA.dummy:                    links_non_perl header_libs
1904SECEDIT/SECEDIT.dummy:                  links_non_perl
1905SEQ_QUALITY/SEQ_QUALITY.dummy:          links_non_perl
1906SERVERCNTRL/SERVERCNTRL.dummy:          links_non_perl com
1907SL/ALILINK/ALILINK.dummy:               links_non_perl
1908SL/ALIVIEW/ALIVIEW.dummy:               links_non_perl
1909SL/AP_TREE/AP_TREE.dummy:               links_non_perl
1910SL/APP/APP.dummy:                       links_non_perl
1911SL/ARB_SPEC/ARB_SPEC.dummy:             links_non_perl
1912SL/ARB_TREE/ARB_TREE.dummy:             links_non_perl
1913SL/AW_HELIX/AW_HELIX.dummy:             links_non_perl
1914SL/CONSENSUS/CONSENSUS.dummy:           links_non_perl
1915SL/CANVAS/CANVAS.dummy:                 links_non_perl
1916SL/DB_QUERY/DB_QUERY.dummy:             links_non_perl
1917SL/DB_SCANNER/DB_SCANNER.dummy:         links_non_perl
1918SL/DB_UI/DB_UI.dummy:                   links_non_perl
1919SL/FAST_ALIGNER/FAST_ALIGNER.dummy:     links_non_perl
1920SL/FILTER/FILTER.dummy:                 links_non_perl
1921SL/FILTSEQEXP/FILTSEQEXP.dummy:         links_non_perl
1922SL/GROUP_SEARCH/GROUP_SEARCH.dummy:     links_non_perl
1923SL/GUI_ALIVIEW/GUI_ALIVIEW.dummy:       links_non_perl
1924SL/GUI_TK/GUI_TK.dummy:                 links_non_perl
1925SL/HEADERTESTS/HEADERTESTS.dummy:       links_non_perl
1926SL/HELIX/HELIX.dummy:                   links_non_perl
1927SL/INSDEL/INSDEL.dummy:                 links_non_perl
1928SL/ITEM_SHADER/ITEM_SHADER.dummy:       links_non_perl
1929SL/ITEMS/ITEMS.dummy:                   links_non_perl
1930SL/LOCATION/LOCATION.dummy:             links_non_perl
1931SL/MACROS/MACROS.dummy:                 links_non_perl
1932SL/MASKS/MASKS.dummy:                   links_non_perl
1933SL/MATRIX/MATRIX.dummy:                 links_non_perl
1934SL/MAPKEY/MAPKEY.dummy:                 links_non_perl
1935SL/NDS/NDS.dummy:                       links_non_perl
1936SL/NEIGHBOURJOIN/NEIGHBOURJOIN.dummy:   links_non_perl
1937SL/PRONUC/PRONUC.dummy:                 links_non_perl
1938SL/PTCLEAN/PTCLEAN.dummy:               links_non_perl link_db
1939SL/PVP/PVP.dummy:                       links_non_perl
1940SL/QUERY/QUERY.dummy:                   links_non_perl link_db
1941SL/REFENTRIES/REFENTRIES.dummy:         links_non_perl
1942SL/REGEXPR/REGEXPR.dummy:               links_non_perl
1943SL/SAICALC/SAICALC.dummy:               links_non_perl
1944SL/SPECSEL/SPECSEL.dummy:               links_non_perl
1945SL/SEQIO/SEQIO.dummy:                   links_non_perl
1946SL/SEQUENCE/SEQUENCE.dummy:             links_non_perl
1947SL/TRANSLATE/TRANSLATE.dummy:           links_non_perl
1948SL/TREE_ADMIN/TREE_ADMIN.dummy:         links_non_perl
1949SL/TREE_READ/TREE_READ.dummy:           links_non_perl
1950SL/TREE_WRITE/TREE_WRITE.dummy:         links_non_perl
1951SL/TREEDISP/TREEDISP.dummy:             links_non_perl
1952SL/XFERGUI/XFERGUI.dummy:               links_non_perl
1953SL/XFERSET/XFERSET.dummy:               links_non_perl
1954STAT/STAT.dummy:                        links_non_perl
1955TREEGEN/TREEGEN.dummy:                  links_non_perl
1956WETC/WETC.dummy:                        links_non_perl
1957WINDOW/libWINDOW.dummy:                 links_non_perl
1958XML/XML.dummy:                          links_non_perl
1959
1960ifeq ($(OPENGL),1)
1961GL/glAW/glAW.dummy: links_non_perl
1962GL/glpng/glpng.dummy: links_non_perl
1963GL/GL.dummy: GL/glAW/glAW.dummy GL/glpng/glpng.dummy
1964RNA3D/RNA3D.dummy: links_non_perl gl
1965endif
1966
1967UNIT_TESTER/UNIT_TESTER.dummy:          link_db \
1968        SERVERCNTRL/SERVERCNTRL.dummy \
1969
1970# see also TOOLS/Makefile@TOOLSLIBDEPENDS
1971TOOLS/TOOLS.dummy : links_non_perl link_db \
1972        CONSENSUS_TREE/CONSENSUS_TREE.dummy \
1973        SERVERCNTRL/SERVERCNTRL.dummy \
1974        SL/FILTER/FILTER.dummy \
1975        SL/FILTSEQEXP/FILTSEQEXP.dummy \
1976        SL/INSDEL/INSDEL.dummy \
1977        SL/REGEXPR/REGEXPR.dummy \
1978        SL/SEQIO/SEQIO.dummy \
1979        SL/TREE_READ/TREE_READ.dummy \
1980        SL/TREE_WRITE/TREE_WRITE.dummy \
1981        XML/XML.dummy \
1982
1983AWTC/AWTC.dummy :                       com
1984
1985NAMES/NAMES.dummy :                     com
1986SL/AW_NAME/AW_NAME.dummy :              com
1987
1988PROBE/PROBE.dummy :                     com
1989MULTI_PROBE/MULTI_PROBE.dummy :         com
1990PROBE_DESIGN/PROBE_DESIGN.dummy :       com
1991NALIGNER/NALIGNER.dummy :               com
1992
1993ARB_GDE/ARB_GDE.dummy :                 proto_tools menus
1994
1995compile_compatibility: SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.dummy
1996
1997#***************************************************************************************
1998#                       Short aliases to make targets
1999#***************************************************************************************
2000
2001show:
2002                @echo $(SEP)
2003                @echo 'Aliases for often needed targets:'
2004                @echo ''
2005                @echo ' executables:'
2006                @echo ''
2007                @echo '  nt     arb_ntree'
2008                @echo '  e4     arb_edit4 (includes secedit)'
2009                @echo '  di     arb_dist'
2010                @echo '  ph     arb_phylo'
2011                @echo '  pa     arb_parsimony'
2012                @echo '  tg     arb_treegen'
2013                @echo '  ds     arb_dbserver'
2014                @echo '  pt     arb_pt_server'
2015                @echo '  na     arb_name_server'
2016                @echo ''
2017                @echo ' libraries:'
2018                @echo ''
2019                @echo '  com    communication libraries'
2020                @echo '  db     ARB database'
2021                @echo '  aw     GUI lib'
2022                @echo '  awt    GUI toolkit'
2023                @echo '  awtc   general purpose library'
2024                @echo '  awti   import/export library'
2025                @echo '  mp     multi probe library'
2026                @echo '  ge     genome library'
2027                @echo '  pd     probe design lib'
2028                @echo '  prd    primer design lib'
2029                @echo ''
2030                @echo ' other targets:'
2031                @echo ''
2032                @echo '  help   recompile help files'
2033                @echo '  tools  make small tools used by arb'
2034                @echo ''
2035                @echo ' foreign targets:'
2036                @echo ''
2037                @echo '  gde    GDE'
2038                @echo '  agde   ARB_GDE'
2039                @echo ''
2040                @echo 'for other targets inspect $(ARBHOME)/Makefile'
2041                @echo ''
2042                @echo $(SEP)
2043
2044source_doc:
2045        @echo "Remove some links (doxygen crashes otherwise):"
2046        find . \( -name "AISC" -o -name "C" -o -name "GDEHELP" \) -type l -exec rm {} \;
2047        doxygen 2>&1 1>/dev/null
2048        $(MAKE) forcelinks
2049
2050dep_graph:
2051        @echo "Building some dependency graphs"
2052        SOURCE_TOOLS/dependency_graphs.pl
2053
2054help:   HELP_SOURCE/HELP_SOURCE.dummy
2055
2056HELP_SOURCE/HELP_SOURCE.dummy: link_core xml menus
2057
2058db:     ARBDB/libARBDB.dummy
2059core:   CORE/libCORE.dummy
2060aw:     WINDOW/libWINDOW.dummy
2061awtc:   AWTC/AWTC.dummy
2062awti:   AWTI/AWTI.dummy
2063
2064mp:     MULTI_PROBE/MULTI_PROBE.dummy
2065mg:     MERGE/MERGE.dummy
2066ge:     GENOM/GENOM.dummy
2067prd:    PRIMER_DESIGN/PRIMER_DESIGN.dummy
2068
2069nt:     menus $(NTREE)
2070
2071nal:    $(NALIGNER)
2072
2073di:     $(DIST)
2074ph:     $(PHYLO)
2075pa:     $(PARSIMONY)
2076tg:     $(TREEGEN)
2077
2078ifeq ($(OPENGL),1)
20793d:     RNA3D/RNA3D.dummy
2080gl:     GL/GL.dummy
2081else
2082noopengl:
2083        @echo "invalid target for OPENGL=0"
20843d: noopengl
2085gl: noopengl
2086endif
2087
2088SL/SL.dummy: com
2089
2090ds:     $(DBSERVER)
2091pt:     $(PROBE)
2092pst:    PROBE_SET/PROBE_SET.dummy
2093pd:     PROBE_DESIGN/PROBE_DESIGN.dummy
2094na:     $(NAMES)
2095sq:     SEQ_QUALITY/SEQ_QUALITY.dummy
2096cma:    $(RNACMA)
2097
2098sec:    SECEDIT/SECEDIT.dummy
2099
2100e4:     $(EDIT4) readseq menus
2101
2102gi:     GENOM_IMPORT/GENOM_IMPORT.dummy
2103wetc:   $(WETC)
2104
2105xml:    XML/XML.dummy
2106stat:   STAT/STAT.dummy $(NTREE) $(EDIT4)
2107fa:     SL/FAST_ALIGNER/FAST_ALIGNER.dummy
2108
2109#********************************************************************************
2110
2111up_by_remake: depends proto vectorize_checks
2112
2113up: up_by_remake tags valgrind_update
2114
2115#********************************************************************************
2116
2117touch:
2118        SOURCE_TOOLS/touch_modified.pl
2119
2120modified: touch
2121        $(MAKE) all
2122
2123#********************************************************************************
2124
2125libdepends:
2126        $(MAKE) -C "SOURCE_TOOLS" \
2127                "RNA3D_LIB=$(RNA3D_LIB_4_DEPENDS)" \
2128                libdepends
2129
2130#********************************************************************************
2131
2132# create generated headers:
2133genheaders: TEMPLATES/TEMPLATES.dummy
2134
2135clrdotdepends:
2136        rm PROBE_COM/.depends || true
2137        rm NAMES_COM/.depends || true
2138        rm PERL2ARB/.depends || true
2139
2140comdepends: comtools clrdotdepends have_makedepend
2141        @echo "$(SEP) Partially build com interface"
2142        $(MAKE) PROBE_COM/PROBE_COM.depends NAMES_COM/NAMES_COM.depends
2143        $(MAKE) PROBE_COM/server.depends    NAMES_COM/server.depends
2144
2145depends: genheaders comdepends vectorize_checks have_makedepend
2146        @echo "$(SEP) Updating other dependencies"
2147        $(MAKE) $(subst NAMES_COM/server.depends,,$(subst PROBE_COM/server.depends,,$(SUBDIRS:.sub=.depends))) \
2148                HELP_SOURCE/HELP_SOURCE.depends \
2149                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.depends \
2150
2151        $(MAKE) libdepends
2152
2153depend: depends
2154
2155# ------------------------------------------------------------
2156# dependency generation tests for AISC code
2157#(all should work w/o creating wrong dependencies;
2158# neither in XXX_COM/Makefile nor in code using AISC interface)
2159dependstest1: silent_clean
2160        $(MAKE) depends
2161dependstest2: silent_clean
2162        $(MAKE) com
2163dependstest3: silent_clean
2164        $(MAKE) aw
2165dependstest4: silent_clean
2166        $(MAKE) pt
2167dependstest5: silent_clean
2168        $(MAKE) na
2169dependstest6: silent_clean
2170        $(MAKE) nt
2171dependstest7: silent_clean
2172        $(MAKE) all
2173# ------------------------------------------------------------
2174
2175vectorize_checks:
2176        $(MAKE) -C SOURCE_TOOLS -r vectorize_checks
2177
2178clean_checked_vect: lib/lib.clean
2179        SOURCE_TOOLS/clean_checked_vectorizations.sh
2180
2181# ------------------------------------------------------------
2182
2183AISC_MKPTPS/AISC_MKPTPS.dummy: links
2184
2185proto_tools: AISC_MKPTPS/AISC_MKPTPS.dummy
2186
2187proto: proto_tools
2188        @echo $(SEP) Updating prototypes
2189        $(MAKE) \
2190                ARBDB/ARBDB.proto \
2191                AISC_COM/AISC_COM.proto \
2192                ARB_GDE/ARB_GDE.proto \
2193                CORE/CORE.proto \
2194                CONVERTALN/CONVERTALN.proto \
2195                NTREE/NTREE.proto \
2196                MERGE/MERGE.proto \
2197                PROBE/PROBE.proto \
2198                SERVERCNTRL/SERVERCNTRL.proto \
2199                SL/SL.proto \
2200
2201#********************************************************************************
2202
2203valgrind_update: links
2204        @echo $(SEP) Updating for valgrind
2205        $(MAKE) -C SOURCE_TOOLS valgrind_update
2206
2207#********************************************************************************
2208
2209TAGFILE=TAGS
2210UTAGS=TAGS.$(ARBBID)
2211TAGFILE_TMP=$(UTAGS).tmp
2212
2213TAG_SOURCE_HEADERS=$(UTAGS).headers.tmp
2214TAG_SOURCE_CODE=$(UTAGS).codefiles.tmp
2215TAG_SOURCE_LISTS=$(TAG_SOURCE_HEADERS) $(TAG_SOURCE_CODE)
2216
2217ETAGS_IGNORE_LIST=SOURCE_TOOLS/etags_ignore.lst
2218
2219ETAGS=ctags -e -I @$(ETAGS_IGNORE_LIST) --sort=no --if0=no --extra=q
2220ETAGS_TYPES=--C-kinds=cgnsut --C++-kinds=cgnsut
2221ETAGS_FUN  =--C-kinds=fm     --C++-kinds=fm
2222ETAGS_REST =--C-kinds=dev    --C++-kinds=dev
2223
2224FILTER_TAGS_SOURCES= \
2225        $(SED) -e 's/^.\///g' | \
2226        grep -vi '^HEADERLIBS\|^GDE/\|/GEN[CH]/'
2227
2228$(TAG_SOURCE_HEADERS): links
2229        @find . \( -name '*.hxx' -o -name "*.h" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2230
2231$(TAG_SOURCE_CODE): links
2232        @find . \( -name '*.cxx' -o -name "*.c" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2233
2234$(UTAGS).1.tmp: $(TAG_SOURCE_HEADERS)
2235        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2236$(UTAGS).2.tmp: $(TAG_SOURCE_HEADERS)
2237        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2238$(UTAGS).3.tmp: $(TAG_SOURCE_HEADERS)
2239        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2240$(UTAGS).4.tmp: $(TAG_SOURCE_CODE)
2241        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2242$(UTAGS).5.tmp: $(TAG_SOURCE_CODE)
2243        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2244$(UTAGS).6.tmp: $(TAG_SOURCE_CODE)
2245        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2246
2247TAGS_ALL_PARTS=$(UTAGS).1.tmp $(UTAGS).2.tmp $(UTAGS).3.tmp $(UTAGS).4.tmp $(UTAGS).5.tmp $(UTAGS).6.tmp
2248
2249$(TAGFILE_TMP) : $(TAGS_ALL_PARTS)
2250        @cat $(TAGS_ALL_PARTS) > $@
2251        @rm $(TAGS_ALL_PARTS) $(TAG_SOURCE_LISTS)
2252
2253cleanOldTags:
2254        @find $(ARBHOME) -name 'TAGS.*.tmp' -ctime +2 -exec rm {} \;
2255
2256tags: $(TAGFILE_TMP) cleanOldTags
2257        @mv_if_diff $(TAGFILE_TMP) $(TAGFILE)
2258
2259#********************************************************************************
2260
2261LINKSTAMP=SOURCE_TOOLS/stamp.generate_all_links
2262
2263links: checks $(LINKSTAMP) arbmainwrapper
2264links_no_checks: $(LINKSTAMP) arbmainwrapper
2265
2266forcelinks:
2267        -rm $(LINKSTAMP)
2268        $(MAKE) links
2269
2270$(LINKSTAMP): SOURCE_TOOLS/generate_all_links.sh genheaders
2271        +SOURCE_TOOLS/generate_all_links.sh
2272        touch $(LINKSTAMP)
2273
2274clean_links:
2275#       avoid to delete linked pts, nas or arb_tcp.dat:
2276        find . -path './lib' -prune -o -type l -exec rm {} \;
2277#       removed obsolete file - refuses to disappear due to 'prune' above
2278        @rm -f lib/help/GDEHELP
2279        @rm -f $(LINKSTAMP) lib/inputMasks/format.readme
2280
2281redo_links: clean_links
2282        $(MAKE) links_no_checks
2283
2284#********************************************************************************
2285
2286header_libs:
2287        @(( \
2288                echo "$(SEP) Make HEADERLIBS"; \
2289                $(MAKE) -C HEADERLIBS all && \
2290                echo "$(SEP) Make HEADERLIBS [done]"; \
2291        ) > HEADERLIBS.log 2>&1 && (cat HEADERLIBS.log;rm HEADERLIBS.log)) || (cat HEADERLIBS.log;rm HEADERLIBS.log;false)
2292
2293#********************************************************************************
2294
2295gde:            GDE/GDE.dummy
2296GDE:            gde
2297agde:           ARB_GDE/ARB_GDE.dummy
2298tools:          TOOLS/TOOLS.dummy
2299convert:        $(CONVERT_ALN)
2300readseq:        READSEQ/READSEQ.dummy
2301
2302#***************************************************************************************
2303#                       Some user commands
2304#***************************************************************************************
2305
2306menus: binlink links
2307        @(( \
2308                echo "$(SEP) Make GDEHELP"; \
2309                $(MAKE) -C GDEHELP -r all && \
2310                echo "$(SEP) Make GDEHELP [done]"; \
2311        ) > GDEHELP.log 2>&1 && (cat GDEHELP.log;rm GDEHELP.log)) || (cat GDEHELP.log;rm GDEHELP.log;false)
2312
2313ifeq ($(DEBUG),1)
2314BIN_TARGET=develall
2315else
2316BIN_TARGET=all
2317endif
2318
2319
2320binlink:
2321        $(MAKE) -C bin $(BIN_TARGET)
2322
2323check_bin_dep: binlink
2324        SOURCE_TOOLS/check_bin_dependencies.pl
2325
2326fig_cure:
2327        SOURCE_TOOLS/sortfig.pl doit
2328
2329preplib:
2330        (cd lib;$(MAKE) all)
2331
2332# --------------------------------------------------------------------------------
2333# This section is quite tricky:
2334#
2335# make 'perl' is a BIG target, so when it has to be made, it has to be started
2336# as early as possible to reduce overall compile time. Since 'make' does not
2337# provide any priorities, i force it to build all 'perl'-prerequisites early, by
2338# adding artificial dependencies to these prerequisites
2339#
2340# That behavior is likely to be system-dependent.
2341# My goal was only to make it work on my current development system,
2342# where this saves about 20% of overall build time.
2343
2344ifeq ($(WITHPERL),1)
2345links_non_perl: PERLTOOLS/PERLTOOLS.dummy
2346perltools:      links_non_perl
2347perl:           realperl
2348else
2349links_non_perl: links
2350perl:           links
2351        $(MAKE) "WITHPERL=1" perl
2352endif
2353
2354# ---------------------------------------- perl
2355
2356realperl: perltools
2357        (( \
2358                echo "$(SEP) Make PERL2ARB" ; \
2359                $(TIME) $(MAKE) -C PERL2ARB -r -f Makefile.main \
2360                        "AUTODEPENDS=1" \
2361                        "dflags=$(dflags)" \
2362                        "cflags4perl=$(cflags) $(cxxflags) $(dflags)" \
2363                        "lflags4perl=$(lflags4perl)" \
2364                        "COMPILER_VERSION=$(COMPILER_VERSION)" \
2365                        all && \
2366                $(MAKE) -C PERL_SCRIPTS/test test && \
2367                echo "$(SEP) Make PERL2ARB [done]" ; \
2368        ) > PERL2ARB.log 2>&1 && (cat PERL2ARB.log;rm PERL2ARB.log)) || (cat PERL2ARB.log;rm PERL2ARB.log;false)
2369
2370perl_clean:
2371        @$(MAKE) -C PERL2ARB -r -f Makefile.main \
2372                "AUTODEPENDS=0" \
2373                clean
2374
2375PERL2ARB/PERL2ARB.clean:
2376        $(MAKE) perl_clean
2377        $(MAKE) -C PERL_SCRIPTS/test clean
2378
2379# ---------------------------------------- bindings to script languages
2380
2381bindings: lib/libCORE.so lib/libARBDB.so
2382        $(MAKE) -C BINDINGS all ARBDEPENDS="$(^:%=../%)" DFLAGS="$(dflags)"
2383
2384bindings_clean:
2385        $(MAKE) -C BINDINGS clean
2386
2387# ---------------------------------------- check resources
2388
2389check_res:
2390        $(ARBHOME)/SOURCE_TOOLS/check_resources.pl
2391
2392# ---------------------------------------- cleaning
2393
2394rmbak:
2395        @echo "[cleanup backup/core files]"
2396        @find . \(      -name '*%' \
2397                        -o -name '*.bak' \
2398                        -o -name '*~' \) \
2399                        -o \( -name 'core' -a \! -type d \) \
2400                -exec rm -v {} \; || \
2401        echo "Warning: target 'rmbak' reported problems when removing misc. backup files (ignored)"
2402        @echo "[cleanup done]"
2403
2404bin_reinit:
2405        $(MAKE) bin/bin.clean
2406        $(MAKE) -C "bin" all
2407
2408clean_directories:
2409        -rm -rf \
2410                $(ARBHOME)/PROBE_SET/bin \
2411                $(ARBHOME)/INCLUDE \
2412
2413libclean:
2414        -find $(ARBHOME) -type f \( -name '*.a' ! -type l \) -exec rm -f {} \;
2415        -find $(ARBHOME) -type f \( -name 'lib*.so' ! -type l \) -exec rm -f {} \;
2416
2417objclean:
2418        -find $(ARBHOME) -type f \( -name '*.o' ! -type l \) -exec rm -f {} \;
2419
2420# bin.clean and HELP_SOURCE.clean interfere
2421clean3:
2422        $(MAKE) bin/bin.clean
2423        $(MAKE) HELP_SOURCE/HELP_SOURCE.clean
2424
2425
2426# delete all binaries (similar to 'cleanlinked')
2427cleanRelinkable: libclean UNIT_TESTER/UNIT_TESTER.clean
2428        $(MAKE) -C bin cleanbinariesRelinkable
2429        $(MAKE) -C PROBE_SET cleanLinked
2430
2431
2432clean2: $(SUBDIRS:.sub=.clean) \
2433                clean3 \
2434                rmbak \
2435                libclean \
2436                objclean \
2437                lib/lib.clean \
2438                GDEHELP/GDEHELP.clean \
2439                HEADERLIBS/HEADERLIBS.clean \
2440                SOURCE_TOOLS/SOURCE_TOOLS.clean \
2441                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.clean \
2442                UNIT_TESTER/UNIT_TESTER.clean \
2443                TEMPLATES/TEMPLATES.clean \
2444                perl_clean \
2445
2446        rm -f *.last_gcc *.last_compiler config.makefile.bak
2447        $(MAKE) clean_directories
2448
2449# links are needed for cleanup
2450clean: redo_links motif_xpm_hack_clean
2451        $(MAKE) clean2
2452        $(MAKE) clean_cov_all clean_links
2453
2454silent_clean:
2455        $(MAKE) clean >/dev/null
2456
2457# 'relocated' is about 50% faster than 'rebuild'
2458reloc_clean: links
2459        @echo "---------------------------------------- Relocation cleanup"
2460        $(MAKE) \
2461                perl_clean \
2462                GDEHELP/GDEHELP.clean \
2463                HELP_SOURCE/genhelp/genhelp.clean \
2464                bin/bin.clean \
2465                libclean \
2466                objclean
2467
2468relocated: links
2469        $(MAKE) reloc_clean
2470        @echo "---------------------------------------- and remake"
2471        $(MAKE) build
2472
2473# -----------------------------------
2474# some stress tests
2475# (helpful to reveal race conditions with -j)
2476
2477rebuild4ever: rebuild
2478        $(MAKE) rebuild4ever
2479
2480build4ever: build
2481        $(MAKE) build4ever
2482
2483clean4ever: clean
2484        $(MAKE) clean4ever
2485
2486test4ever: ut
2487        $(MAKE) test4ever
2488
2489perl4ever: clean
2490        $(MAKE) links
2491        $(MAKE) perl
2492        $(MAKE) perl4ever
2493
2494help4ever: clean
2495        $(MAKE) help
2496        $(MAKE) help4ever
2497
2498# -----------------------------------
2499
2500cleanlinked: bin/bin.clean libclean
2501
2502relink: cleanlinked
2503        $(MAKE) all
2504
2505# --------------------------------------------------------------------------------
2506# source related targets
2507
2508CLOC=cloc
2509CLOCFLAGS=--no3 --quiet --progress-rate=0
2510CLOCARB=--exclude-dir=GDE .
2511CLOCEXT=GDE
2512CLOCCODE=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.code.def
2513CLOCREST=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.rest.def
2514CLOCFILT=tail --lines=+4
2515
2516cloc:
2517        @echo 'Arb code:'
2518        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCARB) | $(CLOCFILT)
2519        @echo 'Arb rest:'
2520        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCARB) | $(CLOCFILT)
2521        @echo 'External code:'
2522        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCEXT) | $(CLOCFILT)
2523        @echo 'External rest:'
2524        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCEXT) | $(CLOCFILT)
2525
2526
2527# patch generation
2528patch:
2529        SOURCE_TOOLS/arb_create_patch.sh arbPatch --svn
2530
2531# source tarball generation
2532save: sourcetarfile
2533
2534sourcetarfile: rmbak
2535        util/arb_save
2536
2537# test early whether save will work
2538savetest:
2539        @util/arb_srclst.pl >/dev/null
2540
2541testsave: savetest
2542
2543save2: rmbak
2544        util/arb_save ignore
2545
2546save_test: rmbak
2547        @echo "Testing source list.."
2548        @util/arb_srclst.pl > /dev/null
2549
2550save_test_no_error:
2551        @-$(MAKE) save_test
2552
2553# --------------------------------------------------------------------------------
2554# version management
2555
2556inc_candi:
2557        touch SOURCE_TOOLS/inc_candi.stamp
2558        $(MAKE) do_version_update
2559
2560inc_patch:
2561        touch SOURCE_TOOLS/inc_patch.stamp
2562        $(MAKE) do_version_update
2563
2564inc_minor:
2565        touch SOURCE_TOOLS/inc_minor.stamp
2566        $(MAKE) do_version_update
2567
2568inc_major:
2569        touch SOURCE_TOOLS/inc_major.stamp
2570        $(MAKE) do_version_update
2571
2572do_version_update:
2573        @echo Incrementing version information
2574        $(MAKE) savetest
2575        $(MAKE) genheaders # auto upgrades version early
2576
2577show_version:
2578        $(MAKE) genheaders # updates version info
2579        @echo "$(SEP) ARB version info"
2580        @grep ARB_VERSION TEMPLATES/arb_build.h
2581        @echo "$(SEP)"
2582
2583# --------------------------------------------------------------------------------
2584# special cleanups
2585
2586clean_opengl_changed: RNA3D/RNA3D.clean EDIT4/EDIT4.clean WINDOW/WINDOW.clean GL/GL.clean
2587
2588# --------------------------------------------------------------------------------
2589
2590arbapplications: nt pa e4 wetc pt na nal di ph ds wetc cma
2591
2592arb_external: convert tools gde readseq tg pst
2593
2594arb_no_perl: arbapplications help arb_external
2595
2596arb: motif_xpm_hack
2597        $(MAKE) "WITHPERL=1" perl arb_no_perl
2598
2599motif_xpm_hack:
2600        $(MAKE) -r -C "lib/motifHack" all
2601
2602motif_xpm_hack_clean:
2603        $(MAKE) -r -C "lib/motifHack" clean
2604
2605# --------------------------------------------------------------------------------
2606# special targets for SOURCE_TOOLS/remake_after_change.pl
2607
2608rac_arb_dist:           di
2609rac_arb_edit4:          e4
2610rac_arb_ntree:          nt
2611rac_arb_pars:           pa
2612rac_arb_phylo:          ph
2613rac_arb_wetc:           wetc
2614rac_arb_naligner:       nal
2615rac_arb_pt_server:      pt
2616rac_arb_db_server:      ds
2617rac_arb_name_server:    na
2618rac_arb_convert_aln:    convert
2619rac_arb_treegen:        tg
2620rac_arb_rnacma:         cma
2621rac_arb_help2xml:       help
2622
2623rac_arb_a2ps:           tools
2624rac_arb_consensus_tree: tools
2625rac_arb_dnarates:       tools
2626rac_arb_export_rates:   tools
2627rac_arb_export_tree:    tools
2628rac_arb_gene_probe:     tools
2629rac_arb_message:        tools
2630rac_arb_primer:         tools
2631rac_arb_probe:          tools
2632rac_arb_read_tree:      tools
2633
2634# --------------------------------------------------------------------------------
2635# unit testing
2636# @@@ work in progress
2637#
2638# goal is to automatically test all libraries/executables using TESTED_UNITS_AUTO
2639# currently not all test executables link w/o error.
2640# therefor units are organized in three sets:
2641#
2642#   TESTED_UNITS     = testable and contain tests
2643#   UNTESTED_UNITS   = testable, but no tests written yet
2644#   UNTESTABLE_UNITS = not testable
2645
2646# always define OPENGL units manually:
2647OPENGL_TESTS :=
2648ifeq ($(OPENGL),1)
2649#       this section defines RNA3D.test
2650OPENGL_TESTS += \
2651        $(subst .a,.test,$(RNA3D_LIB)) \
2652        GL/glAW/libglAW.test \
2653        GL/glpng/libglpng_arb.test \
2654
2655endif
2656
2657UNITS_NOT_AUTODETECTED = \
2658        HELP_SOURCE/HELP_SOURCE.tooltests
2659
2660TESTED_UNITS_AUTO = \
2661        $(OPENGL_TESTS) \
2662        $(TL_ARCHIVES:.a=.test) \
2663        $(TL_SHARED_ARCHIVES:.so=.test) \
2664        $(CL_ARCHIVES:.a=.test) \
2665        $(TL_TOOLS_COLLECTIONS:.toolColl=.tooltests) \
2666        $(UNITS_NOT_AUTODETECTED) \
2667
2668UNTESTED_UNITS = \
2669        $(OPENGL_TESTS) \
2670        EISPACK/EISPACK.test \
2671        GENOM/GENOM.test \
2672        ISLAND_HOPPING/ISLAND_HOPPING.test \
2673        NALIGNER/NALIGNER.test \
2674        NAMES/NAMES.test \
2675        PHYLO/PHYLO.test \
2676        PRIMER_DESIGN/PRIMER_DESIGN.test \
2677        READSEQ/READSEQ.tooltests \
2678        SECEDIT/SECEDIT.test \
2679        SEQ_QUALITY/SEQ_QUALITY.test \
2680        SERVERCNTRL/SERVERCNTRL.test \
2681        SL/ALIVIEW/ALIVIEW.test \
2682        SL/AP_TREE/AP_TREE.test \
2683        SL/ARB_SPEC/ARB_SPEC.test \
2684        SL/ARB_TREE/ARB_TREE.test \
2685        SL/AW_HELIX/AW_HELIX.test \
2686        SL/AW_NAME/AW_NAME.test \
2687        SL/CANVAS/CANVAS.test \
2688        SL/DB_SCANNER/DB_SCANNER.test \
2689        SL/DB_UI/DB_UI.test \
2690        SL/GUI_ALIVIEW/GUI_ALIVIEW.test \
2691        SL/GUI_TK/GUI_TK.test \
2692        SL/HELIX/HELIX.test \
2693        SL/MASKS/MASKS.test \
2694        SL/MAPKEY/MAPKEY.test \
2695        SL/QUERY/QUERY.test \
2696        SL/REFENTRIES/REFENTRIES.test \
2697        SL/SEQUENCE/SEQUENCE.test \
2698        SL/TREE_ADMIN/TREE_ADMIN.test \
2699        SL/TREE_WRITE/TREE_WRITE.test \
2700        SL/XFERGUI/XFERGUI.test \
2701        STAT/STAT.test \
2702        TREEGEN/TREEGEN.test \
2703        WETC/WETC.test \
2704        XML/XML.test \
2705
2706# untestable units
2707
2708UNTESTABLE_UNITS = \
2709        AISC/AISC.test \
2710        NAMES_COM/server.test \
2711        PROBE_COM/server.test \
2712
2713# --------------------
2714# put all units containing tests into the following 4 sections (see also TESTED_UNITS below)
2715
2716# recent development
2717UNITS_TESTED_FIRST = \
2718        SL/SPECSEL/SPECSEL.test \
2719        SL/MATRIX/MATRIX.test \
2720        AWTI/AWTI.test \
2721        SL/FILTSEQEXP/FILTSEQEXP.test \
2722        SL/GROUP_SEARCH/GROUP_SEARCH.test \
2723        SL/PVP/PVP.test \
2724        SL/SAICALC/SAICALC.test \
2725        SL/TRANSLATE/TRANSLATE.test \
2726        SL/XFERSET/XFERSET.test \
2727
2728# start units with long duration early
2729UNITS_RUNNING_LONG = \
2730        ARBDB/libARBDB.test \
2731        AWTC/AWTC.test \
2732        TOOLS/TOOLS.tooltests \
2733
2734# plain test-libaries that are not linked anywhere
2735TEST_SANDBOXES = \
2736        SL/CB/CB.test \
2737        SL/HEADERTESTS/HEADERTESTS.test \
2738
2739UNITS_TESTED = \
2740        AISC_MKPTPS/AISC_MKPTPS.tooltests \
2741        ARB_GDE/ARB_GDE.test \
2742        CONSENSUS_TREE/CONSENSUS_TREE.test \
2743        CONVERTALN/CONVERTALN.test \
2744        CORE/libCORE.test \
2745        DBSERVER/DBSERVER.test \
2746        DIST/DIST.test \
2747        EDIT4/EDIT4.test \
2748        GENOM_IMPORT/GENOM_IMPORT.test \
2749        HELP_SOURCE/HELP_SOURCE.tooltests \
2750        MERGE/MERGE.test \
2751        MULTI_PROBE/MULTI_PROBE.test \
2752        NTREE/NTREE.test \
2753        PARSIMONY/PARSIMONY.test \
2754        PERLTOOLS/PERLTOOLS.tooltests \
2755        PROBE/PROBE.test \
2756        PROBE_DESIGN/PROBE_DESIGN.test \
2757        PROBE_SET/PROBE_SET.tooltests \
2758        RNACMA/RNACMA.test \
2759        SL/ALILINK/ALILINK.test \
2760        SL/APP/APP.test \
2761        SL/CONSENSUS/CONSENSUS.test \
2762        SL/DB_QUERY/DB_QUERY.test \
2763        SL/FAST_ALIGNER/FAST_ALIGNER.test \
2764        SL/FILTER/FILTER.test \
2765        SL/INSDEL/INSDEL.test \
2766        SL/ITEM_SHADER/ITEM_SHADER.test \
2767        SL/ITEMS/ITEMS.test \
2768        SL/LOCATION/LOCATION.test \
2769        SL/MACROS/MACROS.test \
2770        SL/NDS/NDS.test \
2771        SL/NEIGHBOURJOIN/NEIGHBOURJOIN.test \
2772        SL/PRONUC/PRONUC.test \
2773        SL/PTCLEAN/PTCLEAN.test \
2774        SL/REGEXPR/REGEXPR.test \
2775        SL/SEQIO/SEQIO.test \
2776        SL/TREE_READ/TREE_READ.test \
2777        SL/TREEDISP/TREEDISP.test \
2778        WINDOW/libWINDOW.test \
2779
2780TESTED_UNITS = \
2781        $(UNITS_TESTED_FIRST) \
2782        $(UNITS_RUNNING_LONG) \
2783        $(TEST_SANDBOXES) \
2784        $(UNITS_TESTED) \
2785
2786# ----------------------------------------
2787
2788ifeq ($(DEVELOPER),RALF)
2789
2790DEFINED_TEST_UNITS = \
2791        $(TESTED_UNITS) \
2792        $(UNTESTED_UNITS) \
2793        $(UNTESTABLE_UNITS) \
2794
2795list_undefined_units:
2796        @UNIT_TESTER/list_undefined_units.pl $(DEFINED_TEST_UNITS) -- $(TESTED_UNITS_AUTO)
2797
2798else
2799
2800list_undefined_units:
2801
2802endif
2803
2804# ----------------------------------------
2805
2806TEST_LOG_DIR = UNIT_TESTER/logs
2807TEST_RUN_SUITE=$(MAKE) $(NODIR) -C UNIT_TESTER -f Makefile.suite -r
2808# -> UNIT_TESTER/Makefile.suite
2809TEST_MAKE_FLAGS=
2810TEST_POST_CLEAN=
2811ifeq ($(COVERAGE),1)
2812TEST_POST_CLEAN=$(MAKE) clean_cov
2813TEST_MAKE_FLAGS+=-j1
2814endif
2815
2816
2817%.test:
2818        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2819        ( \
2820            echo "take[1]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2821            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2822                "UNITDIR=$(@D)" \
2823                "UNITLIBNAME=$(@F:.test=)" \
2824                "COVERAGE=$(COVERAGE)" \
2825                "ARB_PID=$(ARB_PID)_$(@F)" \
2826                "DEVELOPER=$(DEVELOPER)" \
2827                runtest; \
2828            echo "take[1]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"; \
2829            $(TEST_POST_CLEAN) \
2830        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1; \
2831        UNIT_TESTER/log_result.pl $(TEST_LOG_DIR)/$(@F).log )
2832
2833%.notest:
2834        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2835        ( \
2836            echo "take[4]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2837            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2838                "UNITDIR=$(@D)" \
2839                "UNITLIBNAME=$(@F:.notest=)" \
2840                "COVERAGE=0" \
2841                "ARB_PID=$(ARB_PID)_$(@F)" \
2842                "DEVELOPER=$(DEVELOPER)" \
2843                check_no_test; \
2844            echo "take[4]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'" \
2845        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1 )
2846
2847
2848# tool test aliases (used to test one or multiple executable(s) in a single subdir):
2849%.tooltests:
2850        $(error please define an explicit tooltest alias for $@)
2851
2852AISC_MKPTPS/AISC_MKPTPS.tooltests : AISC_MKPTPS/mkptypes.test
2853        @echo "aliasing $@ -> $^"
2854PERLTOOLS/PERLTOOLS.tooltests : PERLTOOLS/arb_proto_2_xsub.test
2855        @echo "aliasing $@ -> $^"
2856PROBE_SET/PROBE_SET.tooltests : PROBE_SET/fb_test.test
2857        @echo "aliasing $@ -> $^"
2858HELP_SOURCE/HELP_SOURCE.tooltests : HELP_SOURCE/arb_help2xml.test
2859        @echo "aliasing $@ -> $^"
2860TOOLS/TOOLS.tooltests : TOOLS/arb_consensus_tree.test TOOLS/arb_probe.test TOOLS/arb_test.test
2861        @echo "aliasing $@ -> $^"
2862
2863# aliases for tools w/o tests:
2864READSEQ/READSEQ.tooltests:
2865        @echo "Note: no tests for $@"
2866
2867
2868test_base: $(UNIT_TESTER_LIB:.a=.dummy) $(subst .test,.dummy,$(TEST_SANDBOXES))
2869
2870clean_cov:
2871        find . \( -name "*.gcda" -o -name "*.gcov" -o -name "*.cov" \) -exec rm {} \;
2872
2873clean_cov_all: clean_cov
2874        find . \( -name "*.gcno" \) -exec rm {} \;
2875
2876cleanup_faked_arbpids:
2877        @rm ~/.arb_tmp/tmp/arb_pids_${USER}_${ARB_PID}_* || true
2878
2879cleanup_faked_arbpids_and_fail: cleanup_faked_arbpids
2880        @false
2881
2882NOTESTS_IN_UNTESTED = $(subst .test,.notest,$(UNTESTED_UNITS))
2883
2884run_tests_faked_arbpid:
2885        +@$(TEST_RUN_SUITE) init
2886        @echo "take[2]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2887        @$(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(TESTED_UNITS) $(NOTESTS_IN_UNTESTED) || $(MAKE) cleanup_faked_arbpids_and_fail
2888        @echo "take[2]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2889        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2890        @$(MAKE) clean_cov >/dev/null
2891        @$(MAKE) cleanup_faked_arbpids
2892
2893 # @@@ instead of only running UNIT, this should as well run all tests this unit depends on? according to 'needs_libs'
2894 # @@@ '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
2895
2896run_onetest_faked_arbpid:
2897        +@$(TEST_RUN_SUITE) init
2898        @echo "take[3]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2899        test -n "$(UNIT)" || (echo "Error: UNIT has to be defined for target 'run_onetest_faked_arbpid'!"; false)
2900        $(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(UNIT).test || $(MAKE) cleanup_faked_arbpids_and_fail
2901        @echo "take[3]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2902        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2903        @$(MAKE) clean_cov >/dev/null
2904        @$(MAKE) cleanup_faked_arbpids
2905
2906run_tests: test_base clean_cov
2907        $(MAKE) "ARB_PID=UT_$$$$" run_tests_faked_arbpid list_undefined_units
2908
2909run_oneunitstests: test_base
2910        $(MAKE) "ARB_PID=UT_$$$$" run_onetest_faked_arbpid
2911
2912
2913ut:
2914ifeq ($(UNIT_TESTS),1)
2915        @echo $(MAKE) run_tests
2916        @$(MAKE) run_tests
2917else
2918        @echo "Not compiled with unit tests"
2919endif
2920
2921
2922aut:
2923        +@$(TEST_RUN_SUITE) unskip
2924        $(MAKE) ut
2925
2926# --------------------------------------------------------------------------------
2927
2928TIMELOG=$(ARBHOME)/arb_time.log
2929TIMEARGS=--append --output=$(TIMELOG) --format=" * %E(%S+%U) %P [%C]"
2930TIMECMD=$(TIME) $(TIMEARGS)
2931
2932time_one:
2933ifeq ($(ONE_TIMED_TARGET),)
2934        @echo "Error: You have to pass ONE_TIMED_TARGET to $@"
2935        false
2936else
2937        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET)"
2938        @$(TIMECMD) $(MAKE) $(ONE_TIMED_TARGET)
2939        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET) [done]"
2940endif
2941
2942timed_target:
2943ifeq ($(TIMED_TARGET),)
2944        @echo "Error: You have to pass TIMED_TARGET to $@"
2945        false
2946else
2947        @echo "Build time:" > $(TIMELOG)
2948        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2949        @cat $(TIMELOG)
2950        @rm $(TIMELOG)
2951endif
2952
2953timed_target_tested:
2954ifeq ($(TIMED_TARGET),)
2955        @echo "Error: You have to pass TIMED_TARGET to $@"
2956        false
2957else
2958        @echo "Build time:" > $(TIMELOG)
2959        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2960        $(MAKE) "ONE_TIMED_TARGET=ut" time_one
2961        @cat $(TIMELOG)
2962        @rm $(TIMELOG)
2963endif
2964
2965clean_timed_target:
2966ifeq ($(TIMED_TARGET),)
2967        @echo "Error: You have to pass TIMED_TARGET to $@"
2968        false
2969else
2970        @echo "Build time:" > $(TIMELOG)
2971        $(MAKE) "ONE_TIMED_TARGET=clean" time_one
2972        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2973        @cat $(TIMELOG)
2974        @rm $(TIMELOG)
2975endif
2976
2977# --------------------------------------------------------------------------------
2978
2979CHECKOUT_MODIFIED=0# set to 1 to temporarily skip test for modifications (do not check in if set to 1)
2980
2981check_svn_does_not_contain_generated:
2982ifeq ($(CHECKOUT_MODIFIED),0)
2983        @echo "Testing that build does not modify files in SVN"
2984        @test 0 = `svn status | wc -l` || ( \
2985                echo "The checkout is not/no longer clean:"; \
2986                svn status; \
2987                echo "- if this fails instantly, your checkout is not clean"; \
2988                echo "- if this fails after other targets, these targets modify checked in data"; \
2989                echo "  (a common cause may be that depends are not up to date)"; \
2990                false)
2991else
2992        grep -Hn 'CHECKOUT_MODIFIED' Makefile
2993endif
2994
2995check_svn_ignores_generated:
2996        @test 0 = `svn status | grep '^\?' | wc -l` || ( \
2997                echo "There are svn-unignored files:"; \
2998                svn status | grep '^\?'; \
2999                echo "(all generated files should be svn-ignored)"; \
3000                false)
3001
3002check_svn_state: check_svn_does_not_contain_generated
3003        $(MAKE) check_svn_ignores_generated
3004        $(MAKE) savetest
3005
3006things_that_always_should_work: depends proto
3007
3008post_commit_check:
3009        @echo "---------------------------------------- [Initial]"
3010        $(MAKE) check_svn_state
3011
3012        $(MAKE) clean
3013        @echo "---------------------------------------- [After 'make clean']"
3014        $(MAKE) check_svn_state
3015
3016        $(MAKE) things_that_always_should_work
3017        @echo "---------------------------------------- [After 'make things_that_always_should_work']"
3018        $(MAKE) check_svn_state
3019
3020        $(MAKE) all
3021        @echo "---------------------------------------- [After 'make all']"
3022        $(MAKE) check_svn_state
3023
3024        $(MAKE) things_that_always_should_work
3025        @echo "---------------------------------------- [Final]"
3026        $(MAKE) check_svn_state
3027
3028# --------------------------------------------------------------------------------
3029# sanitize arb_ntree; also works for clients (arb_edit4, ...) started from there.
3030
3031sanitize: all
3032        ( \
3033                export "LSAN_OPTIONS=max_leaks=30:suppressions=$(ARBHOME)/SOURCE_TOOLS/arb.leaksan.supp"; \
3034                echo "sake[1]: Entering directory \`$(ARBHOME)'"; \
3035                $(ARBHOME)/bin/arb_ntree --execute _logged ~/data/test.arb 2>&1 ; \
3036                echo "sake[1]: Leaving directory \`$(ARBHOME)'" \
3037        ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
3038
3039# --------------------------------------------------------------------------------
3040# build and test one unit:
3041
3042build_oneunit:
3043        $(MAKE) "WITHPERL=1" $(UNIT).dummy
3044
3045oneunit:
3046ifndef UNIT
3047        @echo "Please define UNIT, e.g. using"
3048        @echo "      make \"UNIT=ARBDB/libARBDB\"       oneunit"
3049        @echo "      make \"UNIT=SL/TREEDISP/TREEDISP\" oneunit"
3050        @echo "(Note: 1st is a shared library, 2nd isn't)"
3051        false
3052else
3053        @echo "Build time" > $(TIMELOG)
3054        @echo "$(SEP) $(MAKE) build_oneunit"
3055        @$(TIMECMD) $(MAKE) build_oneunit
3056 ifeq ($(UNIT_TESTS),1)
3057        @echo "$(SEP) $(MAKE) run_oneunitstests"
3058        @$(TIMECMD) $(MAKE) run_oneunitstests
3059 endif
3060        @cat $(TIMELOG)
3061        @rm $(TIMELOG)
3062endif
3063
3064# --------------------------------------------------------------------------------
3065# Main targets:
3066
3067tarfile: rebuild
3068        $(MAKE) prepare_libdir
3069        util/arb_compress
3070
3071tarfile_quick: all
3072        $(MAKE) prepare_libdir
3073        util/arb_compress
3074
3075# -----------------------------------
3076
3077build: arb
3078        $(MAKE) check_bin_dep preplib compile_compatibility fig_cure
3079
3080all:
3081        @echo "Build time" > $(TIMELOG)
3082#       $(MAKE) clean_checked_vect # uncomment to rebuild sources where expected vectorization gets tested
3083        @echo "$(SEP) $(MAKE) all"
3084        @$(TIMECMD) $(MAKE) build
3085        @echo $(SEP)
3086        @echo "made 'all' with success."
3087        @echo "to start arb enter 'arb'"
3088ifeq ($(UNIT_TESTS),1)
3089        @echo "$(SEP) $(MAKE) run_tests"
3090        @$(TIMECMD) $(MAKE) run_tests
3091endif
3092        @echo "$(SEP) $(MAKE) all [done]"
3093ifeq ($(DEBUG),1)
3094        @$(MAKE) save_test_no_error >/dev/null # just show hints
3095endif
3096        @cat $(TIMELOG)
3097        @rm $(TIMELOG)
3098
3099rebuild: clean
3100        $(MAKE) all
3101
3102# --------------------------------------------------------------------------------
3103# special targets showing obvious error at bottom
3104# (intended to be used from automated builds)
3105
3106BUILD_LOG=build.log
3107SHELL=bash
3108REDIRECT_KEEP_EXITCODE = tee $(BUILD_LOG) ; exit "$${PIPESTATUS[0]}"
3109EXTRACT_ERROR_SUMMARY  = (./SOURCE_TOOLS/short_error_summary.pl $(BUILD_LOG); false)
3110
3111ALL:
3112        @(($(MAKE) all 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3113
3114REBUILD:
3115        @(($(MAKE) rebuild 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3116
3117TARFILE:
3118        @(($(MAKE) tarfile 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3119
3120TARFILE_QUICK:
3121        @(($(MAKE) tarfile_quick 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3122
Note: See TracBrowser for help on using the repository browser.