source: branches/stable/Makefile

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