source: tags/ms_r16q2/Makefile

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