source: trunk/Makefile

Last change on this file was 19916, checked in by westram, 7 hours ago
  • fix compile with clang 6 under linux
    • parts of TEST_naninf also fails using clang under linux.
    • parse real clang version from detailed version info
      • AFAIK this effectively already happens under OSX (since change r12860).
    • also set USE_OPENMP=0 for clang under linux.
    • fix undefined code: variable length arrays (VLAs) cannot be initialized at declaration.
    • use -std=gnu++17 for clang.
    • str_iequal + count_spaces fail to build as constexpr under clang.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 89.3 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 ($(USE_CLANG),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# the following standards also work with clang 6.0.0 (under linux):
994# -std=gnu++17 -std=gnu++14 -std=gnu++11 -std=gnu++0x
995 cxxflags += -std=gnu++17
996else
997 # standard mostly supported by gcc version (according to https://gcc.gnu.org/projects/cxx-status.html)
998 # C++20 with gcc>=12
999 # C++23 with gcc>=15 (or 16 for reflection)
1000
1001 ifeq ('$(USE_GCC_80_OR_HIGHER)','yes')
1002   # C++17 mostly supported by gcc>=8
1003   cxxflags += -std=gnu++17 # see also TEMPLATES/cxxforward.h@USE_Cxx17
1004 else
1005  ifeq ('$(USE_GCC_60_OR_HIGHER)','yes')
1006   cxxflags += -std=gnu++14 # see also TEMPLATES/cxxforward.h@USE_Cxx14
1007  else
1008   ifeq ('$(USE_GCC_47_OR_HIGHER)','yes')
1009    cxxflags += -std=gnu++11 # see also TEMPLATES/cxxforward.h@USE_Cxx11
1010   else
1011    # gcc versions between 4.3 (lowest supported) and <4.7
1012    cxxflags += -std=gnu++0x
1013   endif # 47
1014  endif # 60
1015 endif # 80
1016endif # USE_CLANG
1017
1018LINK_STATIC_LIB := $(AR) -csq# link static lib
1019LINK_EXECUTABLE := $(A_CXX) $(blflags) -o# link executable (c++)
1020
1021ifeq ($(LINK_STATIC),1)
1022 SHARED_LIB_SUFFIX = a# static lib suffix
1023 LINK_SHARED_LIB := $(LINK_STATIC_LIB)
1024else
1025 SHARED_LIB_SUFFIX = so# shared lib suffix
1026 LINK_SHARED_LIB := $(A_CXX) $(llflags) -shared -o# link shared lib
1027endif
1028
1029ifeq ($(DARWIN),1)
1030 lflags4perl:=
1031else
1032 lflags4perl:=$(cross_lflags) -shared
1033endif
1034
1035# delete variables unused below
1036blflags:=
1037llflags:=
1038
1039# other used tools
1040MAKEDEPEND_PLAIN = makedepend
1041MAKEDEPEND = $(FORCEMASK);$(MAKEDEPEND_PLAIN)
1042
1043SEPNODATE:=--------------------------------------------------------------------------------
1044SEP=[`date +%M:%S.%N`] ------------------------------------------------
1045# to analyse timings run
1046# make -j9 clean; make -j9 all  | grep '^\[' | sort
1047# make -j9 "TIMED_TARGET=perl" clean_timed_target | grep '^\[' | sort
1048
1049# ------------------------------------------------------------ DYNLIBDEFS
1050# various dynamic library definitions for linking executables:
1051#
1052# SYSLIBS:    system libraries needed by database lib
1053# ARBDB_LIB:  database lib
1054# DBSYS_LIBS: executable using database (but no GUI)
1055# GUI_LIBS:   executable using database and GUI (arb gui uses database)
1056#
1057# Note: definitions exported to sub-makefiles are described in SOURCE_TOOLS/parent_make.txt
1058
1059CORE_LIB=-lCORE
1060ARBDB_LIB=-lARBDB $(CORE_LIB)
1061DBSYS_LIBS = $(ARBDB_LIB) $(SYSLIBS)
1062
1063GUI_LIBS_PREFIX:=
1064ifeq ($(DARWIN),1)
1065# this seem to be added at wrong place, since opengl is only needed to link EDIT4
1066 GUI_LIBS_PREFIX:=-framework GLUT -framework OpenGL
1067endif
1068
1069GUI_LIBS=$(GUI_LIBS_PREFIX) $(DBSYS_LIBS) -lWINDOW $(XLIBS)
1070
1071LIBPATH = -L$(ARBHOME)/lib
1072
1073DEST_LIB = lib
1074DEST_BIN = bin
1075
1076CC_INCLUDES  := -I. -I$(ARBHOME)/INCLUDE $(XINCLUDES) $(ARB_GLIB_INCLUDE) $(ARB_RPC_INCLUDE)
1077CXX_INCLUDES := $(CC_INCLUDES)
1078MAKEDEPENDFLAGS := -- -DARB_OPENGL -DUNIT_TESTS -D__cplusplus -I. -Y$(ARBHOME)/INCLUDE
1079
1080# ---------------------------------------
1081# wrap main()
1082
1083use_ARB_main=$(ARBHOME)/SOURCE_TOOLS/arb_main_cpp.o
1084use_ARB_main_C=$(ARBHOME)/SOURCE_TOOLS/arb_main_c.o
1085
1086# -----------------------------------------
1087# unique build-id
1088# - different for different calls of make
1089# - constant in recursive calls
1090
1091ifndef ARBBID
1092 ARBBID:=$(shell SOURCE_TOOLS/uniqueID.sh)
1093endif
1094
1095# -----------------------------------------
1096#     export variables to submakefiles
1097
1098include SOURCE_TOOLS/export2sub
1099
1100# do not define (exported) variables below this point
1101
1102# -------------------------
1103#     Main arb targets:
1104# -------------------------
1105
1106first_target:
1107                $(MAKE) checks
1108                @echo $(SEPNODATE)
1109                @echo 'Main targets:'
1110                @echo ''
1111                @echo ' all         - Compile ARB + TOOLs + and copy shared libs + link foreign software'
1112                @echo '               (That is most likely the target you want)'
1113                @echo ''
1114                @echo ' clean       - remove generated files ("SUBDIR/SUBDIR.clean" to clean only SUBDIR)'
1115                @echo ' rebuild     - clean + all'
1116                @echo ' cleanlinked - remove all binaries'
1117                @echo ' relink      - cleanlinked + all (=relink all from objects)'
1118                @echo ''
1119                @echo 'Targets for automated builds:'
1120                @echo ''
1121                @echo ' ALL, REBUILD, TARFILE + TARFILE_QUICK '
1122                @echo '             - same as all, rebuild, tarfile + tarfile_quick'
1123                @echo '             - if errors occur, they are extracted and listed at tail of output'
1124                @echo ''
1125                @echo $(SEPNODATE)
1126                @echo ''
1127                @echo 'Development targets:'
1128                @echo ''
1129                @echo ' depends               - create or update dependencies ("SUBDIR/SUBDIR.depends" to update only SUBDIR)'
1130                @echo ' proto                 - create or update prototypes ("SUBDIR/SUBDIR.proto" to update only SUBDIR)'
1131                @echo ' tags                  - create tags for xemacs'
1132                @echo ' show                  - show available shortcuts (AKA subtargets)'
1133                @echo ' up                    - shortcut for depends+proto+tags'
1134ifeq ($(UNIT_TESTS),1)
1135                @echo ' ut                    - only run tests'
1136                @echo ' "UNIT=..." oneunit    - build one unit and run tests (see also UNIT_TESTER/Makefile.setup.local)'
1137endif
1138ifneq ($(SANITIZE),0)
1139                @echo ' sanitize              - all + run arb_ntree with sanitizer (test.arb + execute _logged)'
1140endif
1141                @echo ' modified              - rebuild files modified in svn checkout (does touch)'
1142                @echo ' touch                 - touch files modified in svn checkout'
1143                @echo ''
1144                @echo 'Some often used sub targets:'
1145                @echo ''
1146                @echo ' arb                   - Just compile ARB (but none of the integrated tools)'
1147                @echo ' menus                 - create lib/gde/arb.menu from GDEHELP/ARB_GDEmenus.source'
1148                @echo ' perl                  - Compile the PERL XSUBS into lib/ARB.so  and create links in lib to perl'
1149                @echo ' binlink               - Create all links in the bin directory'
1150                @echo ''
1151                @echo 'Internal maintenance:'
1152                @echo ''
1153                @echo ' relinfo               - show help on release targets'
1154                @echo ' tarfile               - make rebuild and create arb version tarfile ("tarfile_quick" to skip rebuild)'
1155                @echo ' save                  - save all basic ARB sources into arbsrc_DATE ("savetest" to check filelist)'
1156                @echo ' patch                 - save svn diff to patchfile'
1157                @echo ' source_doc            - create doxygen documentation'
1158                @echo ' relocated             - rebuild partly (use when you have relocated ARBHOME)'
1159                @echo ' check_res             - check resource usage'
1160                @echo ' dep_graph             - Build dependency graphs'
1161                @echo ' clean_cov             - Clean coverage results'
1162                @echo ''
1163                @echo ' clean_opengl_changed  - clean after changing OPENGL setting in config.Makefile'
1164                @echo ' clean_checked_vect    - clean units containing vectorization checks'
1165                @echo ' cleanRelinkable       - similar to cleanlinked (but skips raxml8 to avoid rebuild)'
1166                @echo ''
1167                @echo ' post_commit_check     - Checks whether'
1168                @echo '                         * main make targets work,'
1169                @echo '                         * dependencies and prototypes are up to date,'
1170                @echo '                         * SVN-controlled files remain unaffected by called targets and'
1171                @echo '                         * all generated files are ignored.'
1172                @echo '                       (has to be called in a clean SVN checkout)'
1173                @echo $(SEPNODATE)
1174                @echo ''
1175
1176relinfo:
1177                @echo ''
1178                @echo $(SEPNODATE)
1179                @echo 'Release targets:'
1180                @echo ''
1181                @echo ' inc_candi     - increase RC candidate-number  (only possible in "rc" branch, not needed for RC1)'
1182                @echo ' inc_patch     - increase release patchlevel   (only possible in "stable" branch)'
1183                @echo ' inc_minor     - increase minor version number (only possible in "trunk")'
1184                @echo ' inc_major     - increase MAJOR version number (only possible in "trunk")'
1185                @echo ''
1186                @echo ' show_version  - show version tag'
1187                @echo ''
1188                @echo $(SEPNODATE)
1189                @echo ''
1190
1191# auto-generate config.makefile:
1192
1193config.makefile : config.makefile.template
1194                @echo --------------------------------------------------------------------------------
1195ifeq ($(CONFIG_MAKEFILE_FOUND),)
1196                @cp $< $@
1197                @echo '$(ARBHOME)/$@:1: has been generated.'
1198                @echo 'Please edit $@ to configure your system!'
1199                @echo --------------------------------------------------------------------------------
1200                @false
1201else
1202                @echo '$(ARBHOME)/$<:1: is more recent than'
1203                @echo '$(ARBHOME)/$@:1:'
1204                @ls -al config.makefile*
1205                @echo --------------------------------------------------------------------------------
1206                @echo "Updating $@ (if this fails, check manually)"
1207                SOURCE_TOOLS/update_config_makefile.pl
1208                @echo "Sucessfully updated $@"
1209                @echo --------------------------------------------------------------------------------
1210                @ls -al config.makefile*
1211                @echo --------------------------------------------------------------------------------
1212                @echo "Diff to your old config.makefile:"
1213                @echo --------------------------------------------------------------------------------
1214                -diff $@.bak $@
1215                @echo --------------------------------------------------------------------------------
1216endif
1217
1218# check if everything is configured correctly
1219
1220check_DEVELOPER:
1221ifndef DEVELOPER
1222                @echo 'config.makefile:1: DEVELOPER not defined'
1223                @false
1224endif
1225
1226check_DEBUG:
1227ifndef dflags
1228                @echo 'config.makefile:1: DEBUG has to be defined. Valid values are 0 and 1'
1229                @false
1230endif
1231
1232check_ARB_64:
1233ifndef ARB_64
1234                @echo 'config.makefile:1: ARB_64 has to be defined. Valid values are 0 and 1'
1235                @false
1236endif
1237
1238# ---------------------------------------- check gcc version
1239
1240COMPILER_BROKEN:=0
1241
1242ifeq ('$(COMPILER_VERSION_ALLOWED)', '4.6.4')
1243COMPILER_BROKEN:=1
1244endif
1245ifeq ('$(COMPILER_VERSION_ALLOWED)', '4.8.0')
1246COMPILER_BROKEN:=1
1247endif
1248
1249check_same_GCC_VERSION:
1250                $(ARBHOME)/SOURCE_TOOLS/check_same_compiler_version.pl $(COMPILER_NAME) $(COMPILER_VERSION_ALLOWED)
1251
1252check_GCC_VERSION:
1253                @echo 'Compiler version check:'
1254# see .@ALLOWED_gcc_VERSIONS
1255ifeq ('$(COMPILER_VERSION_ALLOWED)', '')
1256                @echo "  - Your compiler is '$(COMPILER_NAME)' version '$(COMPILER_VERSION)'"
1257                @echo '    This version is not in the list of supported $(COMPILER_NAME)-versions:'
1258                @$(foreach version,$(ALLOWED_COMPILER_VERSIONS),echo '    * $(version)';)
1259                @echo '  - You may either ..'
1260                @echo '    - add your version to ALLOWED_$(COMPILER_NAME)_VERSIONS in the Makefile and try it out or'
1261                @echo '    - switch to one of the allowed versions (see arb_README_gcc.txt for installing'
1262                @echo '      a different version of gcc)'
1263                $(error Unsupported compiler '$(COMPILER_NAME)' version '$(COMPILER_VERSION)')
1264else
1265 ifeq ($(COMPILER_BROKEN),1)
1266                $(error compilation refused for $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)'. Refer to http://bugs.arb-home.de/wiki/GccVersionInfo for details.)
1267 else
1268                @echo "  - Supported $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)' detected - fine!"
1269                @echo ''
1270                $(MAKE) check_same_GCC_VERSION
1271 endif
1272endif
1273
1274#---------------------- check ARBHOME
1275
1276# use arb_INSTALL.txt to determine whether ARBHOME points to correct directory
1277ARB_INSTALL_FOUND=$(wildcard $(ARBHOME)/arb_INSTALL.txt)
1278
1279check_ARBHOME:
1280ifeq ($(strip $(ARB_INSTALL_FOUND)),)
1281                @echo ------------------------------------------------------------
1282                @echo "ARBHOME is set to '$(ARBHOME)'"
1283                @echo "The environment variable ARBHOME has to point to the top arb source directory."
1284                @echo "If you use bash enter:"
1285                @echo "          export ARBHOME='`pwd`'"
1286                @echo ------------------------------------------------------------
1287                @false
1288endif
1289
1290ARB_PATH_SET=$(findstring $(ARBHOME)/bin,$(PATH))
1291
1292check_PATH: check_ARBHOME
1293ifeq ($(strip $(ARB_PATH_SET)),)
1294                @echo ------------------------------------------------------------
1295                @echo "The environment variable PATH has to contain $(ARBHOME)/bin"
1296                @echo "If you use bash enter:"
1297                @echo '                 export PATH=$$ARBHOME/bin:$$PATH'
1298                @echo ------------------------------------------------------------
1299                @false
1300endif
1301
1302check_TOOLS:
1303        @util/arb_check_build_env.pl \
1304                "$(A_CC)" \
1305                "$(A_CXX)" \
1306                "$(LINK_SHARED_LIB)" \
1307
1308have_makedepend:
1309        @util/arb_check_build_env.pl --check-only "$(MAKEDEPEND_PLAIN)"
1310
1311check_ENVIRONMENT : check_PATH check_TOOLS
1312                @echo "-------------------- Environment [start]"
1313                @echo "ARBHOME='$(ARBHOME)'"
1314                @echo "PATH='$(PATH)'"
1315                @echo "LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)'"
1316                @echo "-------------------- Environment [end]"
1317
1318check_tabs: check_setup
1319ifeq ($(DEBUG),1)
1320        @SOURCE_TOOLS/tabBrake.pl
1321endif
1322
1323force_tab_check:
1324        @touch -t 198001010000 SOURCE_TOOLS/stamp.tabBrake
1325        @$(MAKE) check_tabs
1326
1327
1328# ---------------------
1329
1330check_setup: check_ENVIRONMENT check_DEBUG check_ARB_64 check_DEVELOPER check_GCC_VERSION
1331                @echo Your setup seems to be ok.
1332
1333checks: check_setup check_tabs
1334        @rm -f SOURCE_TOOLS/postcompile.sav
1335
1336
1337# end test section ------------------------------
1338
1339# ---------------------------------------
1340# List of standard top level directories
1341#
1342# sub-makefiles have to define the targets
1343# - 'depends' and
1344# - 'clean'
1345#
1346# when adding new libraries/subdirs here, also add a dependency vs 'links' or 'links_non_perl' in .@DD_links_non_perl
1347
1348TL_ARCHIVES = \
1349                        AISC/AISC.a \
1350                        ARB_GDE/ARB_GDE.a \
1351                        AWTC/AWTC.a \
1352                        AWTI/AWTI.a \
1353                        CONSENSUS_TREE/CONSENSUS_TREE.a \
1354                        CONVERTALN/CONVERTALN.a \
1355                        DBSERVER/DBSERVER.a \
1356                        DIST/DIST.a \
1357                        EDIT4/EDIT4.a \
1358                        EISPACK/EISPACK.a \
1359                        GENOM/GENOM.a \
1360                        GENOM_IMPORT/GENOM_IMPORT.a \
1361                        ISLAND_HOPPING/ISLAND_HOPPING.a \
1362                        MERGE/MERGE.a \
1363                        MULTI_PROBE/MULTI_PROBE.a \
1364                        NALIGNER/NALIGNER.a \
1365                        NAMES/NAMES.a \
1366                        NAMES_COM/server.a \
1367                        NTREE/NTREE.a \
1368                        PARSIMONY/PARSIMONY.a \
1369                        PHYLO/PHYLO.a \
1370                        PRIMER_DESIGN/PRIMER_DESIGN.a \
1371                        PROBE/PROBE.a \
1372                        PROBE_COM/server.a \
1373                        PROBE_DESIGN/PROBE_DESIGN.a \
1374                        $(RNA3D_LIB) \
1375                        RNACMA/RNACMA.a \
1376                        SECEDIT/SECEDIT.a \
1377                        SEQ_QUALITY/SEQ_QUALITY.a \
1378                        SERVERCNTRL/SERVERCNTRL.a \
1379                        STAT/STAT.a \
1380                        TREEGEN/TREEGEN.a \
1381                        WETC/WETC.a \
1382                        XML/XML.a \
1383
1384TL_SHARED_ARCHIVES = \
1385                        ARBDB/libARBDB.so \
1386                        CORE/libCORE.so \
1387                        WINDOW/libWINDOW.so \
1388
1389TL_ARCHIV_COLLECTIONS = \
1390                        SL/SL.archColl \
1391
1392TL_TOOLS_COLLECTIONS = \
1393                        AISC_MKPTPS/AISC_MKPTPS.toolColl \
1394                        TOOLS/TOOLS.toolColl \
1395                        PERLTOOLS/PERLTOOLS.toolColl \
1396                        PROBE_SET/PROBE_SET.toolColl \
1397                        READSEQ/READSEQ.toolColl \
1398
1399RECURSIVE_SUBS = \
1400                        GDE/GDE.sub \
1401                        UNIT_TESTER/UNIT_TESTER.sub \
1402
1403SUBDIRS = \
1404        $(RECURSIVE_SUBS) \
1405        $(TL_ARCHIVES:.a=.sub) \
1406        $(TL_SHARED_ARCHIVES:.so=.sub) \
1407        $(TL_ARCHIV_COLLECTIONS:.archColl=.sub) \
1408        $(TL_TOOLS_COLLECTIONS:.toolColl=.sub) \
1409
1410# sub directories inside TL_ARCHIV_COLLECTIONS
1411CL_ARCH_DIRS = $(foreach coll,$(TL_ARCHIV_COLLECTIONS),$(shell find $(dir $(coll)) -maxdepth 1 -mindepth 1 -type d))
1412
1413# archives inside CL_ARCH_DIRS:
1414CL_ARCHIVES = $(foreach adir,$(CL_ARCH_DIRS),$(dir $(adir))$(notdir $(adir))/$(notdir $(adir)).a)
1415
1416# -----------------------
1417#     library packets
1418
1419ARCHS_CLIENT_PROBE = PROBE_COM/client.a
1420ARCHS_CLIENT_NAMES = NAMES_COM/client.a
1421
1422ARCHS_MAKEBIN = AISC_MKPTPS/AISC_MKPTPS.a AISC/AISC.a
1423
1424# communication libs need aisc and aisc_mkpts:
1425
1426AISC/AISC.dummy: proto_tools
1427
1428comtools: AISC/AISC.dummy
1429
1430ARCHS_SEQUENCE = \
1431                SL/SEQUENCE/SEQUENCE.a \
1432                SL/ALIVIEW/ALIVIEW.a \
1433                SL/PRONUC/PRONUC.a \
1434
1435ARCHS_TREE = \
1436                SL/ARB_TREE/ARB_TREE.a \
1437                SL/FILTER/FILTER.a \
1438                $(ARCHS_SEQUENCE) \
1439
1440# parsimony tree (used by NTREE, PARSIMONY, STAT(->EDIT4), DIST(obsolete!))
1441ARCHS_AP_TREE = \
1442                SL/AP_TREE/AP_TREE.a \
1443                $(ARCHS_TREE) \
1444
1445# --------------------------------------------------------------------------------
1446# dependencies for linking shared libs
1447
1448link_core:      core
1449link_db:        db link_core
1450link_aw:        aw link_db
1451
1452#***************************************************************************************
1453#               Individual_Programs_Section
1454#***************************************************************************************
1455
1456arbmainwrapper:
1457        $(MAKE) -C SOURCE_TOOLS -r mainwrapper
1458
1459
1460#***********************************    arb_ntree **************************************
1461NTREE = bin/arb_ntree
1462ARCHS_NTREE = \
1463                NTREE/NTREE.a \
1464                ARB_GDE/ARB_GDE.a \
1465                SL/SPECSEL/SPECSEL.a \
1466                SL/GROUP_SEARCH/GROUP_SEARCH.a \
1467                SL/SAICALC/SAICALC.a \
1468                SL/DB_UI/DB_UI.a \
1469                SL/ARB_SPEC/ARB_SPEC.a \
1470                SL/MASKS/MASKS.a \
1471                AWTC/AWTC.a \
1472                AWTI/AWTI.a \
1473                CONSENSUS_TREE/CONSENSUS_TREE.a \
1474                GENOM_IMPORT/GENOM_IMPORT.a \
1475                GENOM/GENOM.a \
1476                MERGE/MERGE.a \
1477                MULTI_PROBE/MULTI_PROBE.a \
1478                PRIMER_DESIGN/PRIMER_DESIGN.a \
1479                PROBE_DESIGN/PROBE_DESIGN.a \
1480                SEQ_QUALITY/SEQ_QUALITY.a \
1481                SERVERCNTRL/SERVERCNTRL.a \
1482                SL/ALILINK/ALILINK.a \
1483                SL/AW_NAME/AW_NAME.a \
1484                SL/APP/APP.a \
1485                SL/CONSENSUS/CONSENSUS.a \
1486                SL/CANVAS/CANVAS.a \
1487                SL/DB_SCANNER/DB_SCANNER.a \
1488                SL/DB_QUERY/DB_QUERY.a \
1489                SL/QUERY/QUERY.a \
1490                SL/SEQIO/SEQIO.a \
1491                STAT/STAT.a \
1492                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1493                SL/GUI_TK/GUI_TK.a \
1494                SL/HELIX/HELIX.a \
1495                SL/REGEXPR/REGEXPR.a \
1496                SL/REFENTRIES/REFENTRIES.a \
1497                SL/NDS/NDS.a \
1498                SL/ITEM_SHADER/ITEM_SHADER.a \
1499                SL/ITEMS/ITEMS.a \
1500                SL/INSDEL/INSDEL.a \
1501                SL/LOCATION/LOCATION.a \
1502                SL/MACROS/MACROS.a \
1503                SL/PVP/PVP.a \
1504                SL/TRANSLATE/TRANSLATE.a \
1505                SL/TREEDISP/TREEDISP.a \
1506                SL/TREE_ADMIN/TREE_ADMIN.a \
1507                SL/TREE_READ/TREE_READ.a \
1508                SL/TREE_WRITE/TREE_WRITE.a \
1509                SL/XFERGUI/XFERGUI.a \
1510                SL/XFERSET/XFERSET.a \
1511                XML/XML.a \
1512                $(ARCHS_AP_TREE) \
1513
1514ARCHS_NTREE_ALL = $(ARCHS_NTREE) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) $(XMLLIBS)
1515
1516$(NTREE): $(ARCHS_NTREE:.a=.dummy) link_aw
1517        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NTREE_ALL) || ( \
1518                echo "$(SEP) Link $@"; \
1519                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL)" ; \
1520                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NTREE_ALL) && \
1521                echo "$(SEP) Link $@ [done]"; \
1522                )
1523
1524#***********************************    arb_edit4 **************************************
1525EDIT4 = bin/arb_edit4
1526
1527ARCHS_EDIT4 := \
1528                EDIT4/EDIT4.a \
1529                ARB_GDE/ARB_GDE.a \
1530                SL/FAST_ALIGNER/FAST_ALIGNER.a \
1531                AWTC/AWTC.a \
1532                ISLAND_HOPPING/ISLAND_HOPPING.a \
1533                SECEDIT/SECEDIT.a \
1534                SERVERCNTRL/SERVERCNTRL.a \
1535                SL/APP/APP.a \
1536                SL/GUI_TK/GUI_TK.a \
1537                SL/ARB_SPEC/ARB_SPEC.a \
1538                SL/AW_HELIX/AW_HELIX.a \
1539                SL/AW_NAME/AW_NAME.a \
1540                SL/CONSENSUS/CONSENSUS.a \
1541                SL/CANVAS/CANVAS.a \
1542                SL/ITEMS/ITEMS.a \
1543                STAT/STAT.a \
1544                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1545                SL/HELIX/HELIX.a \
1546                SL/TRANSLATE/TRANSLATE.a \
1547                SL/MACROS/MACROS.a \
1548                SL/MAPKEY/MAPKEY.a \
1549                SL/NDS/NDS.a \
1550                $(ARCHS_AP_TREE) \
1551                XML/XML.a \
1552
1553ifeq ($(OPENGL),1)
1554ARCHS_EDIT4 += RNA3D/RNA3D.a
1555endif
1556
1557ARCHS_EDIT4_ALL = $(ARCHS_EDIT4) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) $(LIBS_EDIT4)
1558
1559LIBS_EDIT4 := $(GL_LIBS)
1560
1561$(EDIT4): $(ARCHS_EDIT4:.a=.dummy) link_aw
1562        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_EDIT4_ALL) || ( \
1563                echo "$(SEP) Link $@"; \
1564                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL)" ; \
1565                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_EDIT4_ALL) && \
1566                echo "$(SEP) Link $@ [done]"; \
1567                )
1568
1569#***********************************    arb_rnacma **************************************
1570RNACMA = bin/arb_rnacma
1571ARCHS_RNACMA = \
1572                RNACMA/RNACMA.a \
1573
1574ARCHS_RNACMA_ALL = $(ARCHS_RNACMA) $(DBSYS_LIBS)
1575
1576$(RNACMA) : $(ARCHS_RNACMA:.a=.dummy) link_db
1577        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_RNACMA_ALL) || ( \
1578                echo "$(SEP) Link $@"; \
1579                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL)"; \
1580                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_RNACMA_ALL) && \
1581                echo "$(SEP) Link $@ [done]"; \
1582                )
1583
1584#***********************************    arb_wetc **************************************
1585WETC = bin/arb_wetc
1586ARCHS_WETC = \
1587                WETC/WETC.a \
1588                SL/APP/APP.a \
1589                SL/MACROS/MACROS.a \
1590                SL/GUI_TK/GUI_TK.a \
1591                SL/HELIX/HELIX.a \
1592                SL/FILTER/FILTER.a \
1593                XML/XML.a \
1594
1595ARCHS_WETC_ALL = $(ARCHS_WETC) $(GUI_LIBS)
1596
1597$(WETC): $(ARCHS_WETC:.a=.dummy) link_aw
1598        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_WETC_ALL) || ( \
1599                echo "$(SEP) Link $@"; \
1600                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL)" ; \
1601                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_WETC_ALL) && \
1602                echo "$(SEP) Link $@ [done]"; \
1603                )
1604
1605#***********************************    arb_dist **************************************
1606DIST = bin/arb_dist
1607ARCHS_DIST = \
1608                DIST/DIST.a \
1609                CONSENSUS_TREE/CONSENSUS_TREE.a \
1610                EISPACK/EISPACK.a \
1611                SERVERCNTRL/SERVERCNTRL.a \
1612                SL/APP/APP.a \
1613                SL/GUI_TK/GUI_TK.a \
1614                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1615                SL/HELIX/HELIX.a \
1616                SL/MATRIX/MATRIX.a \
1617                SL/MACROS/MACROS.a \
1618                SL/NDS/NDS.a \
1619                SL/ITEMS/ITEMS.a \
1620                SL/ARB_SPEC/ARB_SPEC.a \
1621                SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a \
1622                XML/XML.a \
1623                $(ARCHS_AP_TREE) \
1624
1625ARCHS_DIST_ALL = $(ARCHS_DIST) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS)
1626
1627$(DIST): $(ARCHS_DIST:.a=.dummy) link_aw
1628        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DIST_ALL) || ( \
1629                echo "$(SEP) Link $@"; \
1630                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL)" ; \
1631                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DIST_ALL) && \
1632                echo "$(SEP) Link $@ [done]"; \
1633                )
1634
1635#***********************************    arb_pars **************************************
1636PARSIMONY = bin/arb_pars
1637ARCHS_PARSIMONY = \
1638                PARSIMONY/PARSIMONY.a \
1639                SERVERCNTRL/SERVERCNTRL.a \
1640                SL/APP/APP.a \
1641                SL/GUI_TK/GUI_TK.a \
1642                SL/AW_NAME/AW_NAME.a \
1643                SL/CANVAS/CANVAS.a \
1644                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1645                SL/HELIX/HELIX.a \
1646                SL/MACROS/MACROS.a \
1647                SL/NDS/NDS.a \
1648                SL/ITEMS/ITEMS.a \
1649                SL/TRANSLATE/TRANSLATE.a \
1650                SL/TREEDISP/TREEDISP.a \
1651                XML/XML.a \
1652                $(ARCHS_AP_TREE) \
1653
1654ARCHS_PARSIMONY_ALL = $(ARCHS_PARSIMONY) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS)
1655
1656$(PARSIMONY): $(ARCHS_PARSIMONY:.a=.dummy) link_aw
1657        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PARSIMONY_ALL) || ( \
1658                echo "$(SEP) Link $@"; \
1659                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL)" ; \
1660                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PARSIMONY_ALL) && \
1661                echo "$(SEP) Link $@ [done]"; \
1662                )
1663
1664#*********************************** arb_convert_aln **************************************
1665CONVERT_ALN = bin/arb_convert_aln
1666ARCHS_CONVERT_ALN =     \
1667                CONVERTALN/CONVERTALN.a \
1668
1669ARCHS_CONVERT_ALN_ALL = $(ARCHS_CONVERT_ALN) $(DBSYS_LIBS)
1670
1671$(CONVERT_ALN) : $(ARCHS_CONVERT_ALN:.a=.dummy) link_db
1672        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_CONVERT_ALN_ALL) || ( \
1673                echo "$(SEP) Link $@"; \
1674                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL)"; \
1675                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_CONVERT_ALN_ALL) && \
1676                echo "$(SEP) Link $@ [done]"; \
1677                )
1678
1679#*********************************** arb_treegen **************************************
1680
1681TREEGEN = bin/arb_treegen
1682ARCHS_TREEGEN = \
1683                TREEGEN/TREEGEN.a \
1684
1685ARCHS_TREEGEN_ALL = $(ARCHS_TREEGEN)
1686
1687$(TREEGEN) :  $(ARCHS_TREEGEN:.a=.dummy)
1688        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main_C) $(ARCHS_TREEGEN_ALL) || ( \
1689                echo "$(SEP) Link $@"; \
1690                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL)" ; \
1691                $(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(ARCHS_TREEGEN_ALL) && \
1692                echo "$(SEP) Link $@ [done]"; \
1693                )
1694
1695#***********************************    arb_naligner **************************************
1696NALIGNER = bin/arb_naligner
1697ARCHS_NALIGNER = \
1698                NALIGNER/NALIGNER.a \
1699                SERVERCNTRL/SERVERCNTRL.a \
1700                SL/HELIX/HELIX.a \
1701
1702ARCHS_NALIGNER_ALL = $(ARCHS_NALIGNER) $(ARCHS_CLIENT_PROBE) $(DBSYS_LIBS)
1703
1704$(NALIGNER): $(ARCHS_NALIGNER:.a=.dummy) link_db
1705        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NALIGNER_ALL) || ( \
1706                echo "$(SEP) Link $@"; \
1707                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL)" ; \
1708                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NALIGNER_ALL) && \
1709                echo "$(SEP) Link $@ [done]"; \
1710                )
1711
1712#***********************************    arb_phylo **************************************
1713PHYLO = bin/arb_phylo
1714ARCHS_PHYLO = \
1715                PHYLO/PHYLO.a \
1716                SL/APP/APP.a \
1717                SL/GUI_TK/GUI_TK.a \
1718                SL/HELIX/HELIX.a \
1719                SL/FILTER/FILTER.a \
1720                SL/MACROS/MACROS.a \
1721                XML/XML.a \
1722
1723ARCHS_PHYLO_ALL = $(ARCHS_PHYLO) $(GUI_LIBS)
1724
1725$(PHYLO): $(ARCHS_PHYLO:.a=.dummy) link_aw
1726        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_PHYLO_ALL) || ( \
1727                echo "$(SEP) Link $@"; \
1728                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL)" ; \
1729                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PHYLO_ALL) && \
1730                echo "$(SEP) Link $@ [done]"; \
1731                )
1732
1733#***************************************************************************************
1734#                                       SERVER SECTION
1735#***************************************************************************************
1736
1737#***********************************    arb_db_server **************************************
1738DBSERVER = bin/arb_db_server
1739ARCHS_DBSERVER = \
1740                DBSERVER/DBSERVER.a \
1741                SERVERCNTRL/SERVERCNTRL.a \
1742
1743ARCHS_DBSERVER_ALL = $(ARCHS_DBSERVER) $(ARBDB_LIB) $(ARCHS_CLIENT_PROBE) $(SYSLIBS)
1744
1745$(DBSERVER): $(ARCHS_DBSERVER:.a=.dummy) link_db
1746        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_DBSERVER_ALL) || ( \
1747                echo "$(SEP) Link $@"; \
1748                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL)" ; \
1749                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_DBSERVER_ALL) && \
1750                echo "$(SEP) Link $@ [done]"; \
1751                )
1752
1753#***********************************    arb_pt_server **************************************
1754PROBE = bin/arb_pt_server
1755
1756ARCHS_PROBE_DEPEND = \
1757                PROBE/PROBE.a \
1758                SL/PTCLEAN/PTCLEAN.a \
1759                SERVERCNTRL/SERVERCNTRL.a \
1760                SL/HELIX/HELIX.a \
1761
1762ARCHS_PROBE_ALL = $(ARCHS_PROBE_DEPEND) $(ARCHS_CLIENT_PROBE) $(ARBDB_LIB) $(SYSLIBS)
1763
1764$(PROBE): $(ARCHS_PROBE_DEPEND:.a=.dummy) link_db
1765        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) config.makefile $(ARCHS_PROBE_ALL) || ( \
1766                echo "$(SEP) Link $@"; \
1767                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL)" ; \
1768                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_PROBE_ALL) && \
1769                echo "$(SEP) Link $@ [done]"; \
1770                )
1771
1772#***********************************    arb_name_server **************************************
1773NAMES = bin/arb_name_server
1774ARCHS_NAMES = \
1775                NAMES/NAMES.a \
1776                SERVERCNTRL/SERVERCNTRL.a \
1777
1778ARCHS_NAMES_ALL = $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) NAMES_COM/server.a $(SYSLIBS)
1779
1780$(NAMES): $(ARCHS_NAMES:.a=.dummy) link_db
1781        @SOURCE_TOOLS/binuptodate.pl $@ $(use_ARB_main) $(ARCHS_NAMES_ALL) || ( \
1782                echo "$(SEP) Link $@"; \
1783                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL)" ; \
1784                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(ARCHS_NAMES_ALL) && \
1785                echo "$(SEP) Link $@ [done]"; \
1786                )
1787
1788#***********************************    SHARED LIBRARIES SECTION  **************************************
1789
1790prepare_libdir: addlibs
1791
1792addlibs:
1793        (perl $(ARBHOME)/SOURCE_TOOLS/provide_libs.pl \
1794                                "arbhome=$(ARBHOME)" \
1795                                "opengl=$(OPENGL)" \
1796                                "link_static=$(LINK_STATIC)" \
1797        )
1798
1799#***************************************************************************************
1800#                       Recursive calls to sub-makefiles
1801#***************************************************************************************
1802
1803%.depends: have_makedepend
1804        @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile
1805        @$(MAKE) -C $(@D) -r \
1806                "AUTODEPENDS=1" \
1807                "MAIN=nothing" \
1808                "cflags=noCflagsHere_use_MAKEDEPENDFLAGS" \
1809                "cxxflags=noCxxflagsHere_use_MAKEDEPENDFLAGS" \
1810                depends
1811        @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null
1812        @cat $(@D)/Makefile \
1813                | SOURCE_TOOLS/fix_depends.pl "(from main)" \
1814                >$(@D)/Makefile.2
1815        @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile
1816        @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed
1817
1818%.proto:
1819        @($(MAKE) -C $(@D) \
1820                "AUTODEPENDS=0" \
1821                "MAIN=nothing" \
1822                "cflags=noCflags" \
1823                "cxxflags=noCxxflags" \
1824                proto 2>&1 ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
1825
1826%.clean:
1827        @$(MAKE) -C $(@D) \
1828                "AUTODEPENDS=0" \
1829                "MAIN=nothing" \
1830                "cflags=noCflags" \
1831                "cxxflags=noCxxflags" \
1832                clean
1833
1834
1835# stop wrong targets:
1836target_is_missing_lib_prefix:
1837        @echo "Error: Denied to build shared library target with missing 'lib'-prefix"
1838        false
1839
1840ARBDB/ARBDB.dummy:   target_is_missing_lib_prefix
1841CORE/CORE.dummy:     target_is_missing_lib_prefix
1842AWT/AWT.dummy:       target_is_missing_lib_prefix
1843WINDOW/WINDOW.dummy: target_is_missing_lib_prefix
1844
1845# rule to generate main target (normally a library):
1846# @@@ check effect of setting LANG=C below
1847%.dummy:
1848        @( export ID=$$$$; LANG=C; \
1849        (( \
1850            echo "$(SEP) Make $(@D)"; \
1851            $(MAKE) -C $(@D) -r \
1852                "AUTODEPENDS=1" \
1853                "MAIN=$(@F:.dummy=.a)" \
1854                "cflags=$(cflags) -DIN_ARB_$(subst /,_,$(@D))" \
1855                && \
1856            echo "$(SEP) Make $(@D) [done]"; \
1857        ) >$(@D).$$ID.log 2>&1 && (cat $(@D).$$ID.log;rm $(@D).$$ID.log)) || (cat $(@D).$$ID.log;rm $(@D).$$ID.log;false))
1858
1859# Additional dependencies for subtargets:
1860
1861PROBE_COM/PROBE_COM.dummy : comtools
1862NAMES_COM/NAMES_COM.dummy : comtools
1863
1864com: PROBE_COM/PROBE_COM.dummy NAMES_COM/NAMES_COM.dummy
1865
1866# stop wrong more targets:
1867PROBE_COM/server.dummy:
1868        @echo Unwanted request to make target $<
1869        false
1870
1871PROBE_COM/client.dummy:
1872        @echo Unwanted request to make target $<
1873        false
1874
1875NAMES_COM/server.dummy:
1876        @echo Unwanted request to make target $<
1877        false
1878
1879NAMES_COM/client.dummy:
1880        @echo Unwanted request to make target $<
1881        false
1882
1883
1884ARBDB/libARBDB.dummy:                   links
1885CORE/libCORE.dummy:                     links
1886
1887PERLTOOLS/PERLTOOLS.dummy:              core db
1888
1889# all subdirs perl not depends on go here (ADD_links_non_perl)
1890AWTI/AWTI.dummy:                        links_non_perl
1891CONSENSUS_TREE/CONSENSUS_TREE.dummy:    links_non_perl
1892CONVERTALN/CONVERTALN.dummy:            links_non_perl
1893DBSERVER/DBSERVER.dummy:                links_non_perl
1894DIST/DIST.dummy:                        links_non_perl
1895EDIT4/EDIT4.dummy:                      links_non_perl com
1896EISPACK/EISPACK.dummy:                  links_non_perl
1897GDE/GDE.dummy:                          links_non_perl
1898GENOM/GENOM.dummy:                      links_non_perl
1899GENOM_IMPORT/GENOM_IMPORT.dummy:        links_non_perl
1900ISLAND_HOPPING/ISLAND_HOPPING.dummy:    links_non_perl
1901MERGE/MERGE.dummy:                      links_non_perl
1902NTREE/NTREE.dummy:                      links_non_perl
1903PARSIMONY/PARSIMONY.dummy:              links_non_perl
1904PHYLO/PHYLO.dummy:                      links_non_perl
1905PRIMER_DESIGN/PRIMER_DESIGN.dummy:      links_non_perl
1906PROBE_SET/PROBE_SET.dummy:              links_non_perl link_db
1907READSEQ/READSEQ.dummy:                  links_non_perl
1908RNACMA/RNACMA.dummy:                    links_non_perl header_libs
1909SECEDIT/SECEDIT.dummy:                  links_non_perl
1910SEQ_QUALITY/SEQ_QUALITY.dummy:          links_non_perl
1911SERVERCNTRL/SERVERCNTRL.dummy:          links_non_perl com
1912SL/ALILINK/ALILINK.dummy:               links_non_perl
1913SL/ALIVIEW/ALIVIEW.dummy:               links_non_perl
1914SL/AP_TREE/AP_TREE.dummy:               links_non_perl
1915SL/APP/APP.dummy:                       links_non_perl
1916SL/ARB_SPEC/ARB_SPEC.dummy:             links_non_perl
1917SL/ARB_TREE/ARB_TREE.dummy:             links_non_perl
1918SL/AW_HELIX/AW_HELIX.dummy:             links_non_perl
1919SL/CONSENSUS/CONSENSUS.dummy:           links_non_perl
1920SL/CANVAS/CANVAS.dummy:                 links_non_perl
1921SL/DB_QUERY/DB_QUERY.dummy:             links_non_perl
1922SL/DB_SCANNER/DB_SCANNER.dummy:         links_non_perl
1923SL/DB_UI/DB_UI.dummy:                   links_non_perl
1924SL/FAST_ALIGNER/FAST_ALIGNER.dummy:     links_non_perl
1925SL/FILTER/FILTER.dummy:                 links_non_perl
1926SL/FILTSEQEXP/FILTSEQEXP.dummy:         links_non_perl
1927SL/GROUP_SEARCH/GROUP_SEARCH.dummy:     links_non_perl
1928SL/GUI_ALIVIEW/GUI_ALIVIEW.dummy:       links_non_perl
1929SL/GUI_TK/GUI_TK.dummy:                 links_non_perl
1930SL/HEADERTESTS/HEADERTESTS.dummy:       links_non_perl
1931SL/HELIX/HELIX.dummy:                   links_non_perl
1932SL/INSDEL/INSDEL.dummy:                 links_non_perl
1933SL/ITEM_SHADER/ITEM_SHADER.dummy:       links_non_perl
1934SL/ITEMS/ITEMS.dummy:                   links_non_perl
1935SL/LOCATION/LOCATION.dummy:             links_non_perl
1936SL/MACROS/MACROS.dummy:                 links_non_perl
1937SL/MASKS/MASKS.dummy:                   links_non_perl
1938SL/MATRIX/MATRIX.dummy:                 links_non_perl
1939SL/MAPKEY/MAPKEY.dummy:                 links_non_perl
1940SL/NDS/NDS.dummy:                       links_non_perl
1941SL/NEIGHBOURJOIN/NEIGHBOURJOIN.dummy:   links_non_perl
1942SL/PRONUC/PRONUC.dummy:                 links_non_perl
1943SL/PTCLEAN/PTCLEAN.dummy:               links_non_perl link_db
1944SL/PVP/PVP.dummy:                       links_non_perl
1945SL/QUERY/QUERY.dummy:                   links_non_perl link_db
1946SL/REFENTRIES/REFENTRIES.dummy:         links_non_perl
1947SL/REGEXPR/REGEXPR.dummy:               links_non_perl
1948SL/SAICALC/SAICALC.dummy:               links_non_perl
1949SL/SPECSEL/SPECSEL.dummy:               links_non_perl
1950SL/SEQIO/SEQIO.dummy:                   links_non_perl
1951SL/SEQUENCE/SEQUENCE.dummy:             links_non_perl
1952SL/TRANSLATE/TRANSLATE.dummy:           links_non_perl
1953SL/TREE_ADMIN/TREE_ADMIN.dummy:         links_non_perl
1954SL/TREE_READ/TREE_READ.dummy:           links_non_perl
1955SL/TREE_WRITE/TREE_WRITE.dummy:         links_non_perl
1956SL/TREEDISP/TREEDISP.dummy:             links_non_perl
1957SL/XFERGUI/XFERGUI.dummy:               links_non_perl
1958SL/XFERSET/XFERSET.dummy:               links_non_perl
1959STAT/STAT.dummy:                        links_non_perl
1960TREEGEN/TREEGEN.dummy:                  links_non_perl
1961WETC/WETC.dummy:                        links_non_perl
1962WINDOW/libWINDOW.dummy:                 links_non_perl
1963XML/XML.dummy:                          links_non_perl
1964
1965ifeq ($(OPENGL),1)
1966GL/glAW/glAW.dummy: links_non_perl
1967GL/glpng/glpng.dummy: links_non_perl
1968GL/GL.dummy: GL/glAW/glAW.dummy GL/glpng/glpng.dummy
1969RNA3D/RNA3D.dummy: links_non_perl gl
1970endif
1971
1972UNIT_TESTER/UNIT_TESTER.dummy:          link_db \
1973        SERVERCNTRL/SERVERCNTRL.dummy \
1974
1975# see also TOOLS/Makefile@TOOLSLIBDEPENDS
1976TOOLS/TOOLS.dummy : links_non_perl link_db \
1977        CONSENSUS_TREE/CONSENSUS_TREE.dummy \
1978        SERVERCNTRL/SERVERCNTRL.dummy \
1979        SL/FILTER/FILTER.dummy \
1980        SL/FILTSEQEXP/FILTSEQEXP.dummy \
1981        SL/INSDEL/INSDEL.dummy \
1982        SL/REGEXPR/REGEXPR.dummy \
1983        SL/SEQIO/SEQIO.dummy \
1984        SL/TREE_READ/TREE_READ.dummy \
1985        SL/TREE_WRITE/TREE_WRITE.dummy \
1986        XML/XML.dummy \
1987
1988AWTC/AWTC.dummy :                       com
1989
1990NAMES/NAMES.dummy :                     com
1991SL/AW_NAME/AW_NAME.dummy :              com
1992
1993PROBE/PROBE.dummy :                     com
1994MULTI_PROBE/MULTI_PROBE.dummy :         com
1995PROBE_DESIGN/PROBE_DESIGN.dummy :       com
1996NALIGNER/NALIGNER.dummy :               com
1997
1998ARB_GDE/ARB_GDE.dummy :                 proto_tools menus
1999
2000compile_compatibility: SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.dummy
2001
2002#***************************************************************************************
2003#                       Short aliases to make targets
2004#***************************************************************************************
2005
2006show:
2007                @echo $(SEP)
2008                @echo 'Aliases for often needed targets:'
2009                @echo ''
2010                @echo ' executables:'
2011                @echo ''
2012                @echo '  nt     arb_ntree'
2013                @echo '  e4     arb_edit4 (includes secedit)'
2014                @echo '  di     arb_dist'
2015                @echo '  ph     arb_phylo'
2016                @echo '  pa     arb_parsimony'
2017                @echo '  tg     arb_treegen'
2018                @echo '  ds     arb_dbserver'
2019                @echo '  pt     arb_pt_server'
2020                @echo '  na     arb_name_server'
2021                @echo ''
2022                @echo ' libraries:'
2023                @echo ''
2024                @echo '  com    communication libraries'
2025                @echo '  db     ARB database'
2026                @echo '  aw     GUI lib'
2027                @echo '  awt    GUI toolkit'
2028                @echo '  awtc   general purpose library'
2029                @echo '  awti   import/export library'
2030                @echo '  mp     multi probe library'
2031                @echo '  ge     genome library'
2032                @echo '  pd     probe design lib'
2033                @echo '  prd    primer design lib'
2034                @echo ''
2035                @echo ' other targets:'
2036                @echo ''
2037                @echo '  help   recompile help files'
2038                @echo '  tools  make small tools used by arb'
2039                @echo ''
2040                @echo ' foreign targets:'
2041                @echo ''
2042                @echo '  gde    GDE'
2043                @echo '  agde   ARB_GDE'
2044                @echo ''
2045                @echo 'for other targets inspect $(ARBHOME)/Makefile'
2046                @echo ''
2047                @echo $(SEP)
2048
2049source_doc:
2050        @echo "Remove some links (doxygen crashes otherwise):"
2051        find . \( -name "AISC" -o -name "C" -o -name "GDEHELP" \) -type l -exec rm {} \;
2052        doxygen 2>&1 1>/dev/null
2053        $(MAKE) forcelinks
2054
2055dep_graph:
2056        @echo "Building some dependency graphs"
2057        SOURCE_TOOLS/dependency_graphs.pl
2058
2059help:   HELP_SOURCE/HELP_SOURCE.dummy
2060
2061HELP_SOURCE/HELP_SOURCE.dummy: link_core xml menus
2062
2063db:     ARBDB/libARBDB.dummy
2064core:   CORE/libCORE.dummy
2065aw:     WINDOW/libWINDOW.dummy
2066awtc:   AWTC/AWTC.dummy
2067awti:   AWTI/AWTI.dummy
2068
2069mp:     MULTI_PROBE/MULTI_PROBE.dummy
2070mg:     MERGE/MERGE.dummy
2071ge:     GENOM/GENOM.dummy
2072prd:    PRIMER_DESIGN/PRIMER_DESIGN.dummy
2073
2074nt:     menus $(NTREE)
2075
2076nal:    $(NALIGNER)
2077
2078di:     $(DIST)
2079ph:     $(PHYLO)
2080pa:     $(PARSIMONY)
2081tg:     $(TREEGEN)
2082
2083ifeq ($(OPENGL),1)
20843d:     RNA3D/RNA3D.dummy
2085gl:     GL/GL.dummy
2086else
2087noopengl:
2088        @echo "invalid target for OPENGL=0"
20893d: noopengl
2090gl: noopengl
2091endif
2092
2093SL/SL.dummy: com
2094
2095ds:     $(DBSERVER)
2096pt:     $(PROBE)
2097pst:    PROBE_SET/PROBE_SET.dummy
2098pd:     PROBE_DESIGN/PROBE_DESIGN.dummy
2099na:     $(NAMES)
2100sq:     SEQ_QUALITY/SEQ_QUALITY.dummy
2101cma:    $(RNACMA)
2102
2103sec:    SECEDIT/SECEDIT.dummy
2104
2105e4:     $(EDIT4) readseq menus
2106
2107gi:     GENOM_IMPORT/GENOM_IMPORT.dummy
2108wetc:   $(WETC)
2109
2110xml:    XML/XML.dummy
2111stat:   STAT/STAT.dummy $(NTREE) $(EDIT4)
2112fa:     SL/FAST_ALIGNER/FAST_ALIGNER.dummy
2113
2114#********************************************************************************
2115
2116up_by_remake: depends proto vectorize_checks
2117
2118up: up_by_remake tags valgrind_update
2119
2120#********************************************************************************
2121
2122touch:
2123        SOURCE_TOOLS/touch_modified.pl
2124
2125modified: touch
2126        $(MAKE) all
2127
2128#********************************************************************************
2129
2130libdepends:
2131        $(MAKE) -C "SOURCE_TOOLS" \
2132                "RNA3D_LIB=$(RNA3D_LIB_4_DEPENDS)" \
2133                libdepends
2134
2135#********************************************************************************
2136
2137# create generated headers:
2138genheaders: TEMPLATES/TEMPLATES.dummy
2139
2140clrdotdepends:
2141        rm PROBE_COM/.depends || true
2142        rm NAMES_COM/.depends || true
2143        rm PERL2ARB/.depends || true
2144
2145comdepends: comtools clrdotdepends have_makedepend
2146        @echo "$(SEP) Partially build com interface"
2147        $(MAKE) PROBE_COM/PROBE_COM.depends NAMES_COM/NAMES_COM.depends
2148        $(MAKE) PROBE_COM/server.depends    NAMES_COM/server.depends
2149
2150depends: genheaders comdepends vectorize_checks have_makedepend
2151        @echo "$(SEP) Updating other dependencies"
2152        $(MAKE) $(subst NAMES_COM/server.depends,,$(subst PROBE_COM/server.depends,,$(SUBDIRS:.sub=.depends))) \
2153                HELP_SOURCE/HELP_SOURCE.depends \
2154                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.depends \
2155
2156        $(MAKE) libdepends
2157
2158depend: depends
2159
2160# ------------------------------------------------------------
2161# dependency generation tests for AISC code
2162#(all should work w/o creating wrong dependencies;
2163# neither in XXX_COM/Makefile nor in code using AISC interface)
2164dependstest1: silent_clean
2165        $(MAKE) depends
2166dependstest2: silent_clean
2167        $(MAKE) com
2168dependstest3: silent_clean
2169        $(MAKE) aw
2170dependstest4: silent_clean
2171        $(MAKE) pt
2172dependstest5: silent_clean
2173        $(MAKE) na
2174dependstest6: silent_clean
2175        $(MAKE) nt
2176dependstest7: silent_clean
2177        $(MAKE) all
2178# ------------------------------------------------------------
2179
2180vectorize_checks:
2181        $(MAKE) -C SOURCE_TOOLS -r vectorize_checks
2182
2183clean_checked_vect: lib/lib.clean
2184        SOURCE_TOOLS/clean_checked_vectorizations.sh
2185
2186# ------------------------------------------------------------
2187
2188AISC_MKPTPS/AISC_MKPTPS.dummy: links
2189
2190proto_tools: AISC_MKPTPS/AISC_MKPTPS.dummy
2191
2192proto: proto_tools
2193        @echo $(SEP) Updating prototypes
2194        $(MAKE) \
2195                ARBDB/ARBDB.proto \
2196                AISC_COM/AISC_COM.proto \
2197                ARB_GDE/ARB_GDE.proto \
2198                CORE/CORE.proto \
2199                CONVERTALN/CONVERTALN.proto \
2200                NTREE/NTREE.proto \
2201                MERGE/MERGE.proto \
2202                PROBE/PROBE.proto \
2203                SERVERCNTRL/SERVERCNTRL.proto \
2204                SL/SL.proto \
2205
2206#********************************************************************************
2207
2208valgrind_update: links
2209        @echo $(SEP) Updating for valgrind
2210        $(MAKE) -C SOURCE_TOOLS valgrind_update
2211
2212#********************************************************************************
2213
2214TAGFILE=TAGS
2215UTAGS=TAGS.$(ARBBID)
2216TAGFILE_TMP=$(UTAGS).tmp
2217
2218TAG_SOURCE_HEADERS=$(UTAGS).headers.tmp
2219TAG_SOURCE_CODE=$(UTAGS).codefiles.tmp
2220TAG_SOURCE_LISTS=$(TAG_SOURCE_HEADERS) $(TAG_SOURCE_CODE)
2221
2222ETAGS_IGNORE_LIST=SOURCE_TOOLS/etags_ignore.lst
2223
2224ETAGS=ctags -e -I @$(ETAGS_IGNORE_LIST) --sort=no --if0=no --extra=q
2225ETAGS_TYPES=--C-kinds=cgnsut --C++-kinds=cgnsut
2226ETAGS_FUN  =--C-kinds=fm     --C++-kinds=fm
2227ETAGS_REST =--C-kinds=dev    --C++-kinds=dev
2228
2229FILTER_TAGS_SOURCES= \
2230        $(SED) -e 's/^.\///g' | \
2231        grep -vi '^HEADERLIBS\|^GDE/\|/GEN[CH]/'
2232
2233$(TAG_SOURCE_HEADERS): links
2234        @find . \( -name '*.hxx' -o -name "*.h" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2235
2236$(TAG_SOURCE_CODE): links
2237        @find . \( -name '*.cxx' -o -name "*.c" \) -type f | $(FILTER_TAGS_SOURCES) > $@
2238
2239$(UTAGS).1.tmp: $(TAG_SOURCE_HEADERS)
2240        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2241$(UTAGS).2.tmp: $(TAG_SOURCE_HEADERS)
2242        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2243$(UTAGS).3.tmp: $(TAG_SOURCE_HEADERS)
2244        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2245$(UTAGS).4.tmp: $(TAG_SOURCE_CODE)
2246        @$(ETAGS) -f $@ $(ETAGS_TYPES) -L $<
2247$(UTAGS).5.tmp: $(TAG_SOURCE_CODE)
2248        @$(ETAGS) -f $@ $(ETAGS_FUN) -L $<
2249$(UTAGS).6.tmp: $(TAG_SOURCE_CODE)
2250        @$(ETAGS) -f $@ $(ETAGS_REST) -L $<
2251
2252TAGS_ALL_PARTS=$(UTAGS).1.tmp $(UTAGS).2.tmp $(UTAGS).3.tmp $(UTAGS).4.tmp $(UTAGS).5.tmp $(UTAGS).6.tmp
2253
2254$(TAGFILE_TMP) : $(TAGS_ALL_PARTS)
2255        @cat $(TAGS_ALL_PARTS) > $@
2256        @rm $(TAGS_ALL_PARTS) $(TAG_SOURCE_LISTS)
2257
2258cleanOldTags:
2259        @find $(ARBHOME) -name 'TAGS.*.tmp' -ctime +2 -exec rm {} \;
2260
2261tags: $(TAGFILE_TMP) cleanOldTags
2262        @mv_if_diff $(TAGFILE_TMP) $(TAGFILE)
2263
2264#********************************************************************************
2265
2266LINKSTAMP=SOURCE_TOOLS/stamp.generate_all_links
2267
2268links: checks $(LINKSTAMP) arbmainwrapper
2269links_no_checks: $(LINKSTAMP) arbmainwrapper
2270
2271forcelinks:
2272        -rm $(LINKSTAMP)
2273        $(MAKE) links
2274
2275$(LINKSTAMP): SOURCE_TOOLS/generate_all_links.sh genheaders
2276        +SOURCE_TOOLS/generate_all_links.sh
2277        touch $(LINKSTAMP)
2278
2279clean_links:
2280#       avoid to delete linked pts, nas or arb_tcp.dat:
2281        find . -path './lib' -prune -o -type l -exec rm {} \;
2282#       removed obsolete file - refuses to disappear due to 'prune' above
2283        @rm -f lib/help/GDEHELP
2284        @rm -f $(LINKSTAMP) lib/inputMasks/format.readme
2285
2286redo_links: clean_links
2287        $(MAKE) links_no_checks
2288
2289#********************************************************************************
2290
2291header_libs:
2292        @(( \
2293                echo "$(SEP) Make HEADERLIBS"; \
2294                $(MAKE) -C HEADERLIBS all && \
2295                echo "$(SEP) Make HEADERLIBS [done]"; \
2296        ) > HEADERLIBS.log 2>&1 && (cat HEADERLIBS.log;rm HEADERLIBS.log)) || (cat HEADERLIBS.log;rm HEADERLIBS.log;false)
2297
2298#********************************************************************************
2299
2300gde:            GDE/GDE.dummy
2301GDE:            gde
2302agde:           ARB_GDE/ARB_GDE.dummy
2303tools:          TOOLS/TOOLS.dummy
2304convert:        $(CONVERT_ALN)
2305readseq:        READSEQ/READSEQ.dummy
2306
2307#***************************************************************************************
2308#                       Some user commands
2309#***************************************************************************************
2310
2311menus: binlink links
2312        @(( \
2313                echo "$(SEP) Make GDEHELP"; \
2314                $(MAKE) -C GDEHELP -r all && \
2315                echo "$(SEP) Make GDEHELP [done]"; \
2316        ) > GDEHELP.log 2>&1 && (cat GDEHELP.log;rm GDEHELP.log)) || (cat GDEHELP.log;rm GDEHELP.log;false)
2317
2318ifeq ($(DEBUG),1)
2319BIN_TARGET=develall
2320else
2321BIN_TARGET=all
2322endif
2323
2324
2325binlink:
2326        $(MAKE) -C bin $(BIN_TARGET)
2327
2328check_bin_dep: binlink
2329        SOURCE_TOOLS/check_bin_dependencies.pl
2330
2331fig_cure:
2332        SOURCE_TOOLS/sortfig.pl doit
2333
2334preplib:
2335        (cd lib;$(MAKE) all)
2336
2337# --------------------------------------------------------------------------------
2338# This section is quite tricky:
2339#
2340# make 'perl' is a BIG target, so when it has to be made, it has to be started
2341# as early as possible to reduce overall compile time. Since 'make' does not
2342# provide any priorities, i force it to build all 'perl'-prerequisites early, by
2343# adding artificial dependencies to these prerequisites
2344#
2345# That behavior is likely to be system-dependent.
2346# My goal was only to make it work on my current development system,
2347# where this saves about 20% of overall build time.
2348
2349ifeq ($(WITHPERL),1)
2350links_non_perl: PERLTOOLS/PERLTOOLS.dummy
2351perltools:      links_non_perl
2352perl:           realperl
2353else
2354links_non_perl: links
2355perl:           links
2356        $(MAKE) "WITHPERL=1" perl
2357endif
2358
2359# ---------------------------------------- perl
2360
2361realperl: perltools
2362        (( \
2363                echo "$(SEP) Make PERL2ARB" ; \
2364                $(TIME) $(MAKE) -C PERL2ARB -r -f Makefile.main \
2365                        "AUTODEPENDS=1" \
2366                        "dflags=$(dflags)" \
2367                        "cflags4perl=$(cflags) $(cxxflags) $(dflags)" \
2368                        "lflags4perl=$(lflags4perl)" \
2369                        "COMPILER_VERSION=$(COMPILER_VERSION)" \
2370                        all && \
2371                $(MAKE) -C PERL_SCRIPTS/test test && \
2372                echo "$(SEP) Make PERL2ARB [done]" ; \
2373        ) > PERL2ARB.log 2>&1 && (cat PERL2ARB.log;rm PERL2ARB.log)) || (cat PERL2ARB.log;rm PERL2ARB.log;false)
2374
2375perl_clean:
2376        @$(MAKE) -C PERL2ARB -r -f Makefile.main \
2377                "AUTODEPENDS=0" \
2378                clean
2379
2380PERL2ARB/PERL2ARB.clean:
2381        $(MAKE) perl_clean
2382        $(MAKE) -C PERL_SCRIPTS/test clean
2383
2384# ---------------------------------------- bindings to script languages
2385
2386bindings: lib/libCORE.so lib/libARBDB.so
2387        $(MAKE) -C BINDINGS all ARBDEPENDS="$(^:%=../%)" DFLAGS="$(dflags)"
2388
2389bindings_clean:
2390        $(MAKE) -C BINDINGS clean
2391
2392# ---------------------------------------- check resources
2393
2394check_res:
2395        $(ARBHOME)/SOURCE_TOOLS/check_resources.pl
2396
2397# ---------------------------------------- cleaning
2398
2399rmbak:
2400        @echo "[cleanup backup/core files]"
2401        @find . \(      -name '*%' \
2402                        -o -name '*.bak' \
2403                        -o -name '*~' \) \
2404                        -o \( -name 'core' -a \! -type d \) \
2405                -exec rm -v {} \; || \
2406        echo "Warning: target 'rmbak' reported problems when removing misc. backup files (ignored)"
2407        @echo "[cleanup done]"
2408
2409bin_reinit:
2410        $(MAKE) bin/bin.clean
2411        $(MAKE) -C "bin" all
2412
2413clean_directories:
2414        -rm -rf \
2415                $(ARBHOME)/PROBE_SET/bin \
2416                $(ARBHOME)/INCLUDE \
2417
2418libclean:
2419        -find $(ARBHOME) -type f \( -name '*.a' ! -type l \) -exec rm -f {} \;
2420        -find $(ARBHOME) -type f \( -name 'lib*.so' ! -type l \) -exec rm -f {} \;
2421
2422objclean:
2423        -find $(ARBHOME) -type f \( -name '*.o' ! -type l \) -exec rm -f {} \;
2424
2425# bin.clean and HELP_SOURCE.clean interfere
2426clean3:
2427        $(MAKE) bin/bin.clean
2428        $(MAKE) HELP_SOURCE/HELP_SOURCE.clean
2429
2430
2431# delete all binaries (similar to 'cleanlinked')
2432cleanRelinkable: libclean UNIT_TESTER/UNIT_TESTER.clean
2433        $(MAKE) -C bin cleanbinariesRelinkable
2434        $(MAKE) -C PROBE_SET cleanLinked
2435
2436
2437clean2: $(SUBDIRS:.sub=.clean) \
2438                clean3 \
2439                rmbak \
2440                libclean \
2441                objclean \
2442                lib/lib.clean \
2443                GDEHELP/GDEHELP.clean \
2444                HEADERLIBS/HEADERLIBS.clean \
2445                SOURCE_TOOLS/SOURCE_TOOLS.clean \
2446                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.clean \
2447                UNIT_TESTER/UNIT_TESTER.clean \
2448                TEMPLATES/TEMPLATES.clean \
2449                perl_clean \
2450
2451        rm -f *.last_gcc *.last_compiler config.makefile.bak
2452        $(MAKE) clean_directories
2453
2454# links are needed for cleanup
2455clean: redo_links motif_xpm_hack_clean
2456        $(MAKE) clean2
2457        $(MAKE) clean_cov_all clean_links
2458
2459silent_clean:
2460        $(MAKE) clean >/dev/null
2461
2462# 'relocated' is about 50% faster than 'rebuild'
2463reloc_clean: links
2464        @echo "---------------------------------------- Relocation cleanup"
2465        $(MAKE) \
2466                perl_clean \
2467                GDEHELP/GDEHELP.clean \
2468                HELP_SOURCE/genhelp/genhelp.clean \
2469                bin/bin.clean \
2470                libclean \
2471                objclean
2472
2473relocated: links
2474        $(MAKE) reloc_clean
2475        @echo "---------------------------------------- and remake"
2476        $(MAKE) build
2477
2478# -----------------------------------
2479# some stress tests
2480# (helpful to reveal race conditions with -j)
2481
2482rebuild4ever: rebuild
2483        $(MAKE) rebuild4ever
2484
2485build4ever: build
2486        $(MAKE) build4ever
2487
2488clean4ever: clean
2489        $(MAKE) clean4ever
2490
2491test4ever: ut
2492        $(MAKE) test4ever
2493
2494perl4ever: clean
2495        $(MAKE) links
2496        $(MAKE) perl
2497        $(MAKE) perl4ever
2498
2499help4ever: clean
2500        $(MAKE) help
2501        $(MAKE) help4ever
2502
2503# -----------------------------------
2504
2505cleanlinked: bin/bin.clean libclean
2506
2507relink: cleanlinked
2508        $(MAKE) all
2509
2510# --------------------------------------------------------------------------------
2511# source related targets
2512
2513CLOC=cloc
2514CLOCFLAGS=--no3 --quiet --progress-rate=0
2515CLOCARB=--exclude-dir=GDE .
2516CLOCEXT=GDE
2517CLOCCODE=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.code.def
2518CLOCREST=--force-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.rest.def
2519CLOCFILT=tail --lines=+4
2520
2521cloc:
2522        @echo 'Arb code:'
2523        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCARB) | $(CLOCFILT)
2524        @echo 'Arb rest:'
2525        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCARB) | $(CLOCFILT)
2526        @echo 'External code:'
2527        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCEXT) | $(CLOCFILT)
2528        @echo 'External rest:'
2529        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCEXT) | $(CLOCFILT)
2530
2531
2532# patch generation
2533patch:
2534        SOURCE_TOOLS/arb_create_patch.sh arbPatch --svn
2535
2536# source tarball generation
2537save: sourcetarfile
2538
2539sourcetarfile: rmbak
2540        util/arb_save
2541
2542# test early whether save will work
2543savetest:
2544        @util/arb_srclst.pl >/dev/null
2545
2546testsave: savetest
2547
2548save2: rmbak
2549        util/arb_save ignore
2550
2551save_test: rmbak
2552        @echo "Testing source list.."
2553        @util/arb_srclst.pl > /dev/null
2554
2555save_test_no_error:
2556        @-$(MAKE) save_test
2557
2558# --------------------------------------------------------------------------------
2559# version management
2560
2561inc_candi:
2562        touch SOURCE_TOOLS/inc_candi.stamp
2563        $(MAKE) do_version_update
2564
2565inc_patch:
2566        touch SOURCE_TOOLS/inc_patch.stamp
2567        $(MAKE) do_version_update
2568
2569inc_minor:
2570        touch SOURCE_TOOLS/inc_minor.stamp
2571        $(MAKE) do_version_update
2572
2573inc_major:
2574        touch SOURCE_TOOLS/inc_major.stamp
2575        $(MAKE) do_version_update
2576
2577do_version_update:
2578        @echo Incrementing version information
2579        $(MAKE) savetest
2580        $(MAKE) genheaders # auto upgrades version early
2581
2582show_version:
2583        $(MAKE) genheaders # updates version info
2584        @echo "$(SEP) ARB version info"
2585        @grep ARB_VERSION TEMPLATES/arb_build.h
2586        @echo "$(SEP)"
2587
2588# --------------------------------------------------------------------------------
2589# special cleanups
2590
2591clean_opengl_changed: RNA3D/RNA3D.clean EDIT4/EDIT4.clean WINDOW/WINDOW.clean GL/GL.clean
2592
2593# --------------------------------------------------------------------------------
2594
2595arbapplications: nt pa e4 wetc pt na nal di ph ds wetc cma
2596
2597arb_external: convert tools gde readseq tg pst
2598
2599arb_no_perl: arbapplications help arb_external
2600
2601arb: motif_xpm_hack
2602        $(MAKE) "WITHPERL=1" perl arb_no_perl
2603
2604motif_xpm_hack:
2605        $(MAKE) -r -C "lib/motifHack" all
2606
2607motif_xpm_hack_clean:
2608        $(MAKE) -r -C "lib/motifHack" clean
2609
2610# --------------------------------------------------------------------------------
2611# special targets for SOURCE_TOOLS/remake_after_change.pl
2612
2613rac_arb_dist:           di
2614rac_arb_edit4:          e4
2615rac_arb_ntree:          nt
2616rac_arb_pars:           pa
2617rac_arb_phylo:          ph
2618rac_arb_wetc:           wetc
2619rac_arb_naligner:       nal
2620rac_arb_pt_server:      pt
2621rac_arb_db_server:      ds
2622rac_arb_name_server:    na
2623rac_arb_convert_aln:    convert
2624rac_arb_treegen:        tg
2625rac_arb_rnacma:         cma
2626rac_arb_help2xml:       help
2627
2628rac_arb_a2ps:           tools
2629rac_arb_consensus_tree: tools
2630rac_arb_dnarates:       tools
2631rac_arb_export_rates:   tools
2632rac_arb_export_tree:    tools
2633rac_arb_gene_probe:     tools
2634rac_arb_message:        tools
2635rac_arb_primer:         tools
2636rac_arb_probe:          tools
2637rac_arb_read_tree:      tools
2638
2639# --------------------------------------------------------------------------------
2640# unit testing
2641# @@@ work in progress
2642#
2643# goal is to automatically test all libraries/executables using TESTED_UNITS_AUTO
2644# currently not all test executables link w/o error.
2645# therefor units are organized in three sets:
2646#
2647#   TESTED_UNITS     = testable and contain tests
2648#   UNTESTED_UNITS   = testable, but no tests written yet
2649#   UNTESTABLE_UNITS = not testable
2650
2651# always define OPENGL units manually:
2652OPENGL_TESTS :=
2653ifeq ($(OPENGL),1)
2654#       this section defines RNA3D.test
2655OPENGL_TESTS += \
2656        $(subst .a,.test,$(RNA3D_LIB)) \
2657        GL/glAW/libglAW.test \
2658        GL/glpng/libglpng_arb.test \
2659
2660endif
2661
2662UNITS_NOT_AUTODETECTED = \
2663        HELP_SOURCE/HELP_SOURCE.tooltests
2664
2665TESTED_UNITS_AUTO = \
2666        $(OPENGL_TESTS) \
2667        $(TL_ARCHIVES:.a=.test) \
2668        $(TL_SHARED_ARCHIVES:.so=.test) \
2669        $(CL_ARCHIVES:.a=.test) \
2670        $(TL_TOOLS_COLLECTIONS:.toolColl=.tooltests) \
2671        $(UNITS_NOT_AUTODETECTED) \
2672
2673UNTESTED_UNITS = \
2674        $(OPENGL_TESTS) \
2675        EISPACK/EISPACK.test \
2676        GENOM/GENOM.test \
2677        ISLAND_HOPPING/ISLAND_HOPPING.test \
2678        NALIGNER/NALIGNER.test \
2679        NAMES/NAMES.test \
2680        PHYLO/PHYLO.test \
2681        PRIMER_DESIGN/PRIMER_DESIGN.test \
2682        READSEQ/READSEQ.tooltests \
2683        SECEDIT/SECEDIT.test \
2684        SEQ_QUALITY/SEQ_QUALITY.test \
2685        SERVERCNTRL/SERVERCNTRL.test \
2686        SL/ALIVIEW/ALIVIEW.test \
2687        SL/AP_TREE/AP_TREE.test \
2688        SL/ARB_SPEC/ARB_SPEC.test \
2689        SL/ARB_TREE/ARB_TREE.test \
2690        SL/AW_HELIX/AW_HELIX.test \
2691        SL/AW_NAME/AW_NAME.test \
2692        SL/CANVAS/CANVAS.test \
2693        SL/DB_SCANNER/DB_SCANNER.test \
2694        SL/DB_UI/DB_UI.test \
2695        SL/GUI_ALIVIEW/GUI_ALIVIEW.test \
2696        SL/GUI_TK/GUI_TK.test \
2697        SL/HELIX/HELIX.test \
2698        SL/MASKS/MASKS.test \
2699        SL/MAPKEY/MAPKEY.test \
2700        SL/QUERY/QUERY.test \
2701        SL/REFENTRIES/REFENTRIES.test \
2702        SL/SEQUENCE/SEQUENCE.test \
2703        SL/TREE_ADMIN/TREE_ADMIN.test \
2704        SL/TREE_WRITE/TREE_WRITE.test \
2705        SL/XFERGUI/XFERGUI.test \
2706        STAT/STAT.test \
2707        TREEGEN/TREEGEN.test \
2708        WETC/WETC.test \
2709        XML/XML.test \
2710
2711# untestable units
2712
2713UNTESTABLE_UNITS = \
2714        AISC/AISC.test \
2715        NAMES_COM/server.test \
2716        PROBE_COM/server.test \
2717
2718# --------------------
2719# put all units containing tests into the following 4 sections (see also TESTED_UNITS below)
2720
2721# recent development
2722UNITS_TESTED_FIRST = \
2723        SL/SPECSEL/SPECSEL.test \
2724        SL/MATRIX/MATRIX.test \
2725        AWTI/AWTI.test \
2726        SL/FILTSEQEXP/FILTSEQEXP.test \
2727        SL/GROUP_SEARCH/GROUP_SEARCH.test \
2728        SL/PVP/PVP.test \
2729        SL/SAICALC/SAICALC.test \
2730        SL/TRANSLATE/TRANSLATE.test \
2731        SL/XFERSET/XFERSET.test \
2732
2733# start units with long duration early
2734UNITS_RUNNING_LONG = \
2735        ARBDB/libARBDB.test \
2736        AWTC/AWTC.test \
2737        TOOLS/TOOLS.tooltests \
2738
2739# plain test-libaries that are not linked anywhere
2740TEST_SANDBOXES = \
2741        SL/CB/CB.test \
2742        SL/HEADERTESTS/HEADERTESTS.test \
2743
2744UNITS_TESTED = \
2745        AISC_MKPTPS/AISC_MKPTPS.tooltests \
2746        ARB_GDE/ARB_GDE.test \
2747        CONSENSUS_TREE/CONSENSUS_TREE.test \
2748        CONVERTALN/CONVERTALN.test \
2749        CORE/libCORE.test \
2750        DBSERVER/DBSERVER.test \
2751        DIST/DIST.test \
2752        EDIT4/EDIT4.test \
2753        GENOM_IMPORT/GENOM_IMPORT.test \
2754        HELP_SOURCE/HELP_SOURCE.tooltests \
2755        MERGE/MERGE.test \
2756        MULTI_PROBE/MULTI_PROBE.test \
2757        NTREE/NTREE.test \
2758        PARSIMONY/PARSIMONY.test \
2759        PERLTOOLS/PERLTOOLS.tooltests \
2760        PROBE/PROBE.test \
2761        PROBE_DESIGN/PROBE_DESIGN.test \
2762        PROBE_SET/PROBE_SET.tooltests \
2763        RNACMA/RNACMA.test \
2764        SL/ALILINK/ALILINK.test \
2765        SL/APP/APP.test \
2766        SL/CONSENSUS/CONSENSUS.test \
2767        SL/DB_QUERY/DB_QUERY.test \
2768        SL/FAST_ALIGNER/FAST_ALIGNER.test \
2769        SL/FILTER/FILTER.test \
2770        SL/INSDEL/INSDEL.test \
2771        SL/ITEM_SHADER/ITEM_SHADER.test \
2772        SL/ITEMS/ITEMS.test \
2773        SL/LOCATION/LOCATION.test \
2774        SL/MACROS/MACROS.test \
2775        SL/NDS/NDS.test \
2776        SL/NEIGHBOURJOIN/NEIGHBOURJOIN.test \
2777        SL/PRONUC/PRONUC.test \
2778        SL/PTCLEAN/PTCLEAN.test \
2779        SL/REGEXPR/REGEXPR.test \
2780        SL/SEQIO/SEQIO.test \
2781        SL/TREE_READ/TREE_READ.test \
2782        SL/TREEDISP/TREEDISP.test \
2783        WINDOW/libWINDOW.test \
2784
2785TESTED_UNITS = \
2786        $(UNITS_TESTED_FIRST) \
2787        $(UNITS_RUNNING_LONG) \
2788        $(TEST_SANDBOXES) \
2789        $(UNITS_TESTED) \
2790
2791# ----------------------------------------
2792
2793ifeq ($(DEVELOPER),RALF)
2794
2795DEFINED_TEST_UNITS = \
2796        $(TESTED_UNITS) \
2797        $(UNTESTED_UNITS) \
2798        $(UNTESTABLE_UNITS) \
2799
2800list_undefined_units:
2801        @UNIT_TESTER/list_undefined_units.pl $(DEFINED_TEST_UNITS) -- $(TESTED_UNITS_AUTO)
2802
2803else
2804
2805list_undefined_units:
2806
2807endif
2808
2809# ----------------------------------------
2810
2811TEST_LOG_DIR = UNIT_TESTER/logs
2812TEST_RUN_SUITE=$(MAKE) $(NODIR) -C UNIT_TESTER -f Makefile.suite -r
2813# -> UNIT_TESTER/Makefile.suite
2814TEST_MAKE_FLAGS=
2815TEST_POST_CLEAN=
2816ifeq ($(COVERAGE),1)
2817TEST_POST_CLEAN=$(MAKE) clean_cov
2818TEST_MAKE_FLAGS+=-j1
2819endif
2820
2821
2822%.test:
2823        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2824        ( \
2825            echo "take[1]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2826            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2827                "UNITDIR=$(@D)" \
2828                "UNITLIBNAME=$(@F:.test=)" \
2829                "COVERAGE=$(COVERAGE)" \
2830                "ARB_PID=$(ARB_PID)_$(@F)" \
2831                "DEVELOPER=$(DEVELOPER)" \
2832                runtest; \
2833            echo "take[1]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"; \
2834            $(TEST_POST_CLEAN) \
2835        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1; \
2836        UNIT_TESTER/log_result.pl $(TEST_LOG_DIR)/$(@F).log )
2837
2838%.notest:
2839        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2840        ( \
2841            echo "take[4]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2842            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2843                "UNITDIR=$(@D)" \
2844                "UNITLIBNAME=$(@F:.notest=)" \
2845                "COVERAGE=0" \
2846                "ARB_PID=$(ARB_PID)_$(@F)" \
2847                "DEVELOPER=$(DEVELOPER)" \
2848                check_no_test; \
2849            echo "take[4]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'" \
2850        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1 )
2851
2852
2853# tool test aliases (used to test one or multiple executable(s) in a single subdir):
2854%.tooltests:
2855        $(error please define an explicit tooltest alias for $@)
2856
2857AISC_MKPTPS/AISC_MKPTPS.tooltests : AISC_MKPTPS/mkptypes.test
2858        @echo "aliasing $@ -> $^"
2859PERLTOOLS/PERLTOOLS.tooltests : PERLTOOLS/arb_proto_2_xsub.test
2860        @echo "aliasing $@ -> $^"
2861PROBE_SET/PROBE_SET.tooltests : PROBE_SET/fb_test.test
2862        @echo "aliasing $@ -> $^"
2863HELP_SOURCE/HELP_SOURCE.tooltests : HELP_SOURCE/arb_help2xml.test
2864        @echo "aliasing $@ -> $^"
2865TOOLS/TOOLS.tooltests : TOOLS/arb_consensus_tree.test TOOLS/arb_probe.test TOOLS/arb_test.test
2866        @echo "aliasing $@ -> $^"
2867
2868# aliases for tools w/o tests:
2869READSEQ/READSEQ.tooltests:
2870        @echo "Note: no tests for $@"
2871
2872
2873test_base: $(UNIT_TESTER_LIB:.a=.dummy) $(subst .test,.dummy,$(TEST_SANDBOXES))
2874
2875clean_cov:
2876        find . \( -name "*.gcda" -o -name "*.gcov" -o -name "*.cov" \) -exec rm {} \;
2877
2878clean_cov_all: clean_cov
2879        find . \( -name "*.gcno" \) -exec rm {} \;
2880
2881cleanup_faked_arbpids:
2882        @rm ~/.arb_tmp/tmp/arb_pids_${USER}_${ARB_PID}_* || true
2883
2884cleanup_faked_arbpids_and_fail: cleanup_faked_arbpids
2885        @false
2886
2887NOTESTS_IN_UNTESTED = $(subst .test,.notest,$(UNTESTED_UNITS))
2888
2889run_tests_faked_arbpid:
2890        +@$(TEST_RUN_SUITE) init
2891        @echo "take[2]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2892        @$(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(TESTED_UNITS) $(NOTESTS_IN_UNTESTED) || $(MAKE) cleanup_faked_arbpids_and_fail
2893        @echo "take[2]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2894        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2895        @$(MAKE) clean_cov >/dev/null
2896        @$(MAKE) cleanup_faked_arbpids
2897
2898 # @@@ instead of only running UNIT, this should as well run all tests this unit depends on? according to 'needs_libs'
2899 # @@@ '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
2900
2901run_onetest_faked_arbpid:
2902        +@$(TEST_RUN_SUITE) init
2903        @echo "take[3]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2904        @test -n "$(UNIT)" || (echo "Error: UNIT has to be defined for target 'run_onetest_faked_arbpid'!"; false)
2905        $(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(UNIT).test || $(MAKE) cleanup_faked_arbpids_and_fail
2906        @echo "take[3]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2907        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2908        @$(MAKE) clean_cov >/dev/null
2909        @$(MAKE) cleanup_faked_arbpids
2910
2911run_tests: test_base clean_cov
2912        $(MAKE) "ARB_PID=UT_$$$$" run_tests_faked_arbpid list_undefined_units
2913
2914run_oneunitstests: test_base
2915        $(MAKE) "ARB_PID=UT_$$$$" run_onetest_faked_arbpid
2916
2917
2918ut:
2919ifeq ($(UNIT_TESTS),1)
2920        @echo $(MAKE) run_tests
2921        @$(MAKE) run_tests
2922else
2923        @echo "Not compiled with unit tests"
2924endif
2925
2926
2927aut:
2928        +@$(TEST_RUN_SUITE) unskip
2929        $(MAKE) ut
2930
2931# --------------------------------------------------------------------------------
2932
2933TIMELOG=$(ARBHOME)/arb_time.log
2934TIMEARGS=--append --output=$(TIMELOG) --format=" * %E(%S+%U) %P [%C]"
2935TIMECMD=$(TIME) $(TIMEARGS)
2936
2937time_one:
2938ifeq ($(ONE_TIMED_TARGET),)
2939        @echo "Error: You have to pass ONE_TIMED_TARGET to $@"
2940        false
2941else
2942        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET)"
2943        @$(TIMECMD) $(MAKE) $(ONE_TIMED_TARGET)
2944        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET) [done]"
2945endif
2946
2947timed_target:
2948ifeq ($(TIMED_TARGET),)
2949        @echo "Error: You have to pass TIMED_TARGET to $@"
2950        false
2951else
2952        @echo "Build time:" > $(TIMELOG)
2953        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2954        @cat $(TIMELOG)
2955        @rm $(TIMELOG)
2956endif
2957
2958timed_target_tested:
2959ifeq ($(TIMED_TARGET),)
2960        @echo "Error: You have to pass TIMED_TARGET to $@"
2961        false
2962else
2963        @echo "Build time:" > $(TIMELOG)
2964        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2965        $(MAKE) "ONE_TIMED_TARGET=ut" time_one
2966        @cat $(TIMELOG)
2967        @rm $(TIMELOG)
2968endif
2969
2970clean_timed_target:
2971ifeq ($(TIMED_TARGET),)
2972        @echo "Error: You have to pass TIMED_TARGET to $@"
2973        false
2974else
2975        @echo "Build time:" > $(TIMELOG)
2976        $(MAKE) "ONE_TIMED_TARGET=clean" time_one
2977        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2978        @cat $(TIMELOG)
2979        @rm $(TIMELOG)
2980endif
2981
2982# --------------------------------------------------------------------------------
2983
2984CHECKOUT_MODIFIED=0# set to 1 to temporarily skip test for modifications (do not check in if set to 1)
2985
2986check_svn_does_not_contain_generated:
2987ifeq ($(CHECKOUT_MODIFIED),0)
2988        @echo "Testing that build does not modify files in SVN"
2989        @test 0 = `svn status | wc -l` || ( \
2990                echo "The checkout is not/no longer clean:"; \
2991                svn status; \
2992                echo "- if this fails instantly, your checkout is not clean"; \
2993                echo "- if this fails after other targets, these targets modify checked in data"; \
2994                echo "  (a common cause may be that depends are not up to date)"; \
2995                false)
2996else
2997        grep -Hn 'CHECKOUT_MODIFIED' Makefile
2998endif
2999
3000check_svn_ignores_generated:
3001        @test 0 = `svn status | grep '^\?' | wc -l` || ( \
3002                echo "There are svn-unignored files:"; \
3003                svn status | grep '^\?'; \
3004                echo "(all generated files should be svn-ignored)"; \
3005                false)
3006
3007check_svn_state: check_svn_does_not_contain_generated
3008        $(MAKE) check_svn_ignores_generated
3009        $(MAKE) savetest
3010
3011things_that_always_should_work: depends proto
3012
3013post_commit_check:
3014        @echo "---------------------------------------- [Initial]"
3015        $(MAKE) check_svn_state
3016
3017        $(MAKE) clean
3018        @echo "---------------------------------------- [After 'make clean']"
3019        $(MAKE) check_svn_state
3020
3021        $(MAKE) things_that_always_should_work
3022        @echo "---------------------------------------- [After 'make things_that_always_should_work']"
3023        $(MAKE) check_svn_state
3024
3025        $(MAKE) all
3026        @echo "---------------------------------------- [After 'make all']"
3027        $(MAKE) check_svn_state
3028
3029        $(MAKE) things_that_always_should_work
3030        @echo "---------------------------------------- [Final]"
3031        $(MAKE) check_svn_state
3032
3033# --------------------------------------------------------------------------------
3034# sanitize arb_ntree; also works for clients (arb_edit4, ...) started from there.
3035
3036sanitize: all
3037        ( \
3038                export "LSAN_OPTIONS=max_leaks=30:suppressions=$(ARBHOME)/SOURCE_TOOLS/arb.leaksan.supp"; \
3039                echo "sake[1]: Entering directory \`$(ARBHOME)'"; \
3040                $(ARBHOME)/bin/arb_ntree --execute _logged ~/data/test.arb 2>&1 ; \
3041                echo "sake[1]: Leaving directory \`$(ARBHOME)'" \
3042        ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
3043
3044# --------------------------------------------------------------------------------
3045# build and test one unit:
3046
3047build_oneunit:
3048        $(MAKE) "WITHPERL=1" $(UNIT).dummy
3049
3050oneunit:
3051ifndef UNIT
3052        @echo "Please define UNIT, e.g. using"
3053        @echo "      make \"UNIT=ARBDB/libARBDB\"       oneunit"
3054        @echo "      make \"UNIT=SL/TREEDISP/TREEDISP\" oneunit"
3055        @echo "(Note: 1st is a shared library, 2nd isn't)"
3056        false
3057else
3058        @echo "Build time" > $(TIMELOG)
3059        @echo "$(SEP) $(MAKE) build_oneunit"
3060        @$(TIMECMD) $(MAKE) build_oneunit
3061 ifeq ($(UNIT_TESTS),1)
3062        @echo "$(SEP) $(MAKE) run_oneunitstests"
3063        @$(TIMECMD) $(MAKE) run_oneunitstests
3064 endif
3065        @cat $(TIMELOG)
3066        @rm $(TIMELOG)
3067endif
3068
3069# --------------------------------------------------------------------------------
3070# Main targets:
3071
3072tarfile: rebuild
3073        $(MAKE) prepare_libdir
3074        util/arb_compress
3075
3076tarfile_quick: all
3077        $(MAKE) prepare_libdir
3078        util/arb_compress
3079
3080# -----------------------------------
3081
3082build: arb
3083        $(MAKE) check_bin_dep preplib compile_compatibility fig_cure
3084
3085all:
3086        @echo "Build time" > $(TIMELOG)
3087#       $(MAKE) clean_checked_vect # uncomment to rebuild sources where expected vectorization gets tested
3088        @echo "$(SEP) $(MAKE) all"
3089        @$(TIMECMD) $(MAKE) build
3090        @echo $(SEP)
3091        @echo "made 'all' with success."
3092        @echo "to start arb enter 'arb'"
3093ifeq ($(UNIT_TESTS),1)
3094        @echo "$(SEP) $(MAKE) run_tests"
3095        @$(TIMECMD) $(MAKE) run_tests
3096endif
3097        @echo "$(SEP) $(MAKE) all [done]"
3098ifeq ($(DEBUG),1)
3099        @$(MAKE) save_test_no_error >/dev/null # just show hints
3100endif
3101        @cat $(TIMELOG)
3102        @rm $(TIMELOG)
3103
3104rebuild: clean
3105        $(MAKE) all
3106
3107# --------------------------------------------------------------------------------
3108# special targets showing obvious error at bottom
3109# (intended to be used from automated builds)
3110
3111BUILD_LOG=build.log
3112SHELL=bash
3113REDIRECT_KEEP_EXITCODE = tee $(BUILD_LOG) ; exit "$${PIPESTATUS[0]}"
3114EXTRACT_ERROR_SUMMARY  = (./SOURCE_TOOLS/short_error_summary.pl $(BUILD_LOG); false)
3115
3116REEXTRACT:
3117        @echo "Note: Re-extracting errors from $(BUILD_LOG):"
3118        @$(EXTRACT_ERROR_SUMMARY)
3119
3120ALL:
3121        @(($(MAKE) all 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3122
3123REBUILD:
3124        @(($(MAKE) rebuild 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3125
3126TARFILE:
3127        @(($(MAKE) tarfile 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3128
3129TARFILE_QUICK:
3130        @(($(MAKE) tarfile_quick 2>&1) | $(REDIRECT_KEEP_EXITCODE)) || $(EXTRACT_ERROR_SUMMARY)
3131
Note: See TracBrowser for help on using the repository browser.