source: trunk/Makefile

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