source: branches/gcc/Makefile

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