source: branches/help/Makefile

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