source: branches/gcc/Makefile

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