source: branches/gcc/Makefile

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