source: tags/ms_ra2q34/Makefile

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