source: tags/ms_r17q1/Makefile

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