source: tags/ms_r16q3/Makefile

Last change on this file was 15228, checked in by westram, 8 years ago
  • tested arb with gcc 6.2.0
    • also disabled vectorization (produces broken code; see #700)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 73.9 KB
Line 
1# =============================================================== #
2#                                                                 #
3#   File      : Makefile                                          #
4#                                                                 #
5#   Institute of Microbiology (Technical University Munich)       #
6#   http://www.arb-home.de/                                       #
7#                                                                 #
8# =============================================================== #
9
10# -----------------------------------------------------
11# The ARB Makefile is aware of the following defines:
12#
13# CC                    C compiler (should be defined by OS)
14# CXX                   C++ compiler (should be defined by OS)
15#
16# 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 4.9.4 \
113  5.1.0 5.2.0 5.3.0 5.3.1 5.4.0 \
114  6.1.0 6.2.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
675BROKEN_VECTORIZATION:=0
676ifeq ('$(COMPILER_VERSION)','6.1.0')
677        BROKEN_VECTORIZATION:=1
678endif
679ifeq ('$(COMPILER_VERSION)','6.2.0')
680        BROKEN_VECTORIZATION:=1
681endif
682
683ifeq ('$(BROKEN_VECTORIZATION)','1')
684# see http://bugs.arb-home.de/ticket/700
685        cflags += -fno-tree-loop-vectorize
686        DISABLE_VECTORIZE_CHECK:=1
687endif
688
689ifeq ($(DEBUG),0)
690 ifeq ($(USE_GCC_49_OR_HIGHER),yes)
691  ifeq ($(DISABLE_VECTORIZE_CHECK),0)
692#       cflags += -fopt-info
693        cflags += -fopt-info-vec
694
695#       Shows reasons for unsuccessful vectorization:
696#       cflags += -fopt-info-vec-missed
697
698        POST_COMPILE += --check-loop-optimization
699  endif
700 else
701  ifeq ($(USE_GCC_48_OR_HIGHER),yes)
702# no automatic vectorization-check for gcc<4.9.0
703# -> uncomment the next 2 lines and grep the spam it will produce for 'vectorized.*loops'
704#       cflags += -fopt-info -fopt-info-vec-missed
705#       POST_COMPILE += --original
706  endif
707 endif
708endif
709
710#---------------------- stop early on broken flags/compiler combination
711
712ifeq ($(DEBUG),0)
713 ifeq ($(SANITIZE_ANY),1)
714  ifeq ('$(COMPILER_VERSION)','4.9.1')
715   $(error compiling DEBUG=0 + SANITIZE!=0 crashes with gcc $(COMPILER_VERSION) (gcc 4.9.2 works))
716  endif
717 endif
718endif
719
720#---------------------- differences between linking executables and shared libs:
721
722# executables:
723ifeq ($(DARWIN),1)
724blflags:=$(clflags)
725else
726blflags:=$(clflags) -Wl,--no-undefined
727endif
728
729# shared libraries
730llflags:=$(clflags)
731
732# dont use clflags below
733clflags:=
734
735# -------------------------------------------------------------------------
736#       Don't put any machine/version/etc conditionals below!
737#       (instead define variables above)
738# -------------------------------------------------------------------------
739
740cflags += -W -Wall $(dflags) $(extended_warnings)
741cxxflags := $(extended_cpp_warnings)
742
743# add CFLAGS + CPPFLAGS from environment for DEBIAN build
744ifeq ($(DEBIAN),1)
745        cflags := $(CFLAGS) $(cflags)
746        cxxflags += $(CPPFLAGS)
747endif
748
749ifeq ('$(USE_GCC_47_OR_HIGHER)','yes')
750cxxflags += -std=gnu++11# see also TEMPLATES/cxxforward.h@USE_Cxx11
751else
752# only use for gcc versions between 4.3 and <4.7 (4.7++ adds -Wc++11-compat above)
753HAVE_GNUPP0X=`SOURCE_TOOLS/requireVersion.pl 4.3 $(COMPILER_VERSION)`
754 ifeq ($(HAVE_GNUPP0X),1)
755# ensure compatibility with upcoming C++ standard
756cxxflags += -std=gnu++0x
757 endif
758endif
759
760LINK_STATIC_LIB := ar -csq# link static lib
761LINK_EXECUTABLE := $(A_CXX) $(blflags) -o# link executable (c++)
762
763ifeq ($(LINK_STATIC),1)
764SHARED_LIB_SUFFIX = a# static lib suffix
765LINK_SHARED_LIB := $(LINK_STATIC_LIB)
766else
767SHARED_LIB_SUFFIX = so# shared lib suffix
768LINK_SHARED_LIB := $(A_CXX) $(llflags) -shared $(GCOVFLAGS) -o# link shared lib
769endif
770
771ifeq ($(DARWIN),1)
772lflags4perl:=
773else
774lflags4perl:=$(cross_lflags) -shared
775endif
776
777# delete variables unused below
778blflags:=
779llflags:=
780
781# other used tools
782MAKEDEPEND_PLAIN = makedepend
783MAKEDEPEND = $(FORCEMASK);$(MAKEDEPEND_PLAIN)
784
785#SEP:=--------------------------------------------------------------------------------
786SEP=[`date +%M:%S.%N`] ------------------------------------------------
787# to analyse timings run
788# make -j9 clean; make -j9 all  | grep '^\[' | sort
789# make -j9 "TIMED_TARGET=perl" clean_timed_target | grep '^\[' | sort
790
791CORE_LIB=-lCORE
792ARBDB_LIB=-lARBDB $(CORE_LIB)
793LIBS = $(ARBDB_LIB) $(SYSLIBS)
794
795GUI_LIBS_PREFIX:=
796ifeq ($(DARWIN),1)
797#       this seem to be added at wrong place, since opengl is only needed to link EDIT4
798        GUI_LIBS_PREFIX:=-framework GLUT -framework OpenGL
799endif
800
801GUI_LIBS=$(GUI_LIBS_PREFIX) $(LIBS) -lAWT -lWINDOW
802GUI_LIBS+=$(XLIBS)
803
804LIBPATH = -L$(ARBHOME)/lib
805
806DEST_LIB = lib
807DEST_BIN = bin
808
809CC_INCLUDES  := -I. -I$(ARBHOME)/INCLUDE $(XINCLUDES) $(ARB_GLIB_INCLUDE)
810CXX_INCLUDES := $(CC_INCLUDES)
811MAKEDEPENDFLAGS := -- -DARB_OPENGL -DUNIT_TESTS -D__cplusplus -I. -Y$(ARBHOME)/INCLUDE
812
813# -------------------------------
814#     old PTSERVER or PTPAN?
815
816ifeq ($(PTPAN),1)
817# PTPAN only libs
818ARCHS_PT_SERVER = \
819        ptpan/PROBE.a
820else
821ifeq ($(PTPAN),2)
822# special mode to compile both servers (developers only!)
823ARCHS_PT_SERVER = \
824        ptpan/PROBE.a \
825        PROBE/PROBE.a
826ARCHS_PT_SERVER_LINK = PROBE/PROBE.a# default to old ptserver
827else
828# PT-server only libs
829ARCHS_PT_SERVER = \
830        PROBE/PROBE.a
831endif
832endif
833
834ifndef ARCHS_PT_SERVER_LINK
835ARCHS_PT_SERVER_LINK = $(ARCHS_PT_SERVER)
836endif
837
838# ---------------------------------------
839# wrap main()
840
841use_ARB_main=$(ARBHOME)/SOURCE_TOOLS/arb_main_cpp.o
842use_ARB_main_C=$(ARBHOME)/SOURCE_TOOLS/arb_main_c.o
843
844# -----------------------------------------
845#     export variables to submakefiles
846
847include SOURCE_TOOLS/export2sub
848
849# do not define (exported) variables below this point
850
851# -------------------------
852#     Main arb targets:
853# -------------------------
854
855first_target:
856                $(MAKE) checks
857                @echo $(SEP)
858                @echo 'Main targets:'
859                @echo ''
860                @echo ' all         - Compile ARB + TOOLs + and copy shared libs + link foreign software'
861                @echo '               (That is most likely the target you want)'
862                @echo ''
863                @echo ' clean       - remove generated files ("SUBDIR/SUBDIR.clean" to clean only SUBDIR)'
864                @echo ' rebuild     - clean + all'
865                @echo ' cleanlinked - remove all binaries'
866                @echo ' relink      - cleanlinked + all (=relink all from objects)'
867                @echo ''
868                @echo 'Some often used sub targets (make all makes them all):'
869                @echo ''
870                @echo ' arb         - Just compile ARB (but none of the integrated tools)'
871                @echo ' menus       - create lib/gde/arb.menu from GDEHELP/ARB_GDEmenus.source'
872                @echo ' perl        - Compile the PERL XSUBS into lib/ARB.so  and create links in lib to perl'
873                @echo ' binlink     - Create all links in the bin directory'
874                @echo ''
875                @echo 'Development targets:'
876                @echo ''
877                @echo ' depends      - create or update dependencies ("SUBDIR/SUBDIR.depends" to update only SUBDIR)'
878                @echo ' proto        - create or update prototypes ("SUBDIR/SUBDIR.proto" to update only SUBDIR)'
879                @echo ' tags         - create tags for xemacs'
880                @echo ' show         - show available shortcuts (AKA subtargets)'
881                @echo ' up           - shortcut for depends+proto+tags'
882ifeq ($(UNIT_TESTS),1)
883                @echo ' ut           - only run tests'
884endif
885ifneq ($(SANITIZE),0)
886                @echo ' sanitize     - all + run arb_ntree with sanitizer (test.arb + execute _logged)'
887endif
888                @echo ' modified     - rebuild files modified in svn checkout (does touch)'
889                @echo ' touch        - touch files modified in svn checkout'
890                @echo ''
891                @echo 'Internal maintenance:'
892                @echo ''
893                @echo ' relinfo     - show help on release targets'
894                @echo ' tarfile     - make rebuild and create arb version tarfile ("tarfile_quick" to skip rebuild)'
895                @echo ' save        - save all basic ARB sources into arbsrc_DATE ("savetest" to check filelist)'
896                @echo ' patch       - save svn diff to patchfile'
897                @echo ' source_doc  - create doxygen documentation'
898                @echo ' relocated   - rebuild partly (use when you have relocated ARBHOME)'
899                @echo ' check_res   - check resource usage'
900                @echo ' dep_graph   - Build dependency graphs'
901                @echo ' clean_cov   - Clean coverage results'
902                @echo ''
903                @echo ' post_commit_check - Checks whether'
904                @echo '                     * main make targets work,'
905                @echo '                     * dependencies and prototypes are up to date,'
906                @echo '                     * SVN-controlled files remain unaffected by called targets and'
907                @echo '                     * all generated files are ignored.'
908                @echo '                     (has to be called in a clean SVN checkout)'
909                @echo $(SEP)
910                @echo ''
911
912relinfo:
913                @echo ''
914                @echo $(SEP)
915                @echo 'Release targets:'
916                @echo ''
917                @echo ' inc_candi     - increase RC candidate-number  (only possible in "rc" branch, not needed for RC1)'
918                @echo ' inc_patch     - increase release patchlevel   (only possible in "stable" branch)'
919                @echo ' inc_minor     - increase minor version number (only possible in "trunk")'
920                @echo ' inc_major     - increase MAJOR version number (only possible in "trunk")'
921                @echo ''
922                @echo ' show_version  - show version tag'
923                @echo ''
924                @echo $(SEP)
925                @echo ''
926
927# auto-generate config.makefile:
928
929CONFIG_MAKEFILE_FOUND=$(wildcard config.makefile)
930
931config.makefile : config.makefile.template
932                @echo --------------------------------------------------------------------------------
933ifeq ($(strip $(CONFIG_MAKEFILE_FOUND)),)
934                @cp $< $@
935                @echo '$(ARBHOME)/$@:1: has been generated.'
936                @echo 'Please edit $@ to configure your system!'
937                @echo --------------------------------------------------------------------------------
938                @false
939else
940                @echo '$(ARBHOME)/$<:1: is more recent than'
941                @echo '$(ARBHOME)/$@:1:'
942                @ls -al config.makefile*
943                @echo --------------------------------------------------------------------------------
944                @echo "Updating $@ (if this fails, check manually)"
945                SOURCE_TOOLS/update_config_makefile.pl
946                @echo "Sucessfully updated $@"
947                @echo --------------------------------------------------------------------------------
948                @ls -al config.makefile*
949                @echo --------------------------------------------------------------------------------
950                @echo "Diff to your old config.makefile:"
951                @echo --------------------------------------------------------------------------------
952                -diff $@.bak $@
953                @echo --------------------------------------------------------------------------------
954endif
955
956# check if everything is configured correctly
957
958check_DEVELOPER:
959ifndef DEVELOPER
960                @echo 'config.makefile:1: DEVELOPER not defined'
961                @false
962endif
963
964check_DEBUG:
965ifndef dflags
966                @echo 'config.makefile:1: DEBUG has to be defined. Valid values are 0 and 1'
967                @false
968endif
969
970check_ARB_64:
971ifndef ARB_64
972                @echo 'config.makefile:1: ARB_64 has to be defined. Valid values are 0 and 1'
973                @false
974endif
975
976# ---------------------------------------- check gcc version
977
978COMPILER_BROKEN:=0
979
980# gcc 4.8.0 produces invalid code (see #617)
981ifeq ('$(COMPILER_VERSION_ALLOWED)', '4.8.0')
982COMPILER_BROKEN:=1
983endif
984
985check_same_GCC_VERSION:
986                $(ARBHOME)/SOURCE_TOOLS/check_same_compiler_version.pl $(COMPILER_NAME) $(COMPILER_VERSION_ALLOWED)
987
988check_GCC_VERSION:
989                @echo 'Compiler version check:'
990# see .@ALLOWED_gcc_VERSIONS
991ifeq ('$(COMPILER_VERSION_ALLOWED)', '')
992                @echo "  - Your compiler is '$(COMPILER_NAME)' version '$(COMPILER_VERSION)'"
993                @echo '    This version is not in the list of supported $(COMPILER_NAME)-versions:'
994                @$(foreach version,$(ALLOWED_COMPILER_VERSIONS),echo '    * $(version)';)
995                @echo '  - You may either ..'
996                @echo '    - add your version to ALLOWED_$(COMPILER_NAME)_VERSIONS in the Makefile and try it out or'
997                @echo '    - switch to one of the allowed versions (see arb_README_gcc.txt for installing'
998                @echo '      a different version of gcc)'
999                $(error Unsupported compiler '$(COMPILER_NAME)' version '$(COMPILER_VERSION)')
1000else
1001ifeq ($(COMPILER_BROKEN),1)
1002                $(error $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)' would build a broken ARB version. Compilation refused)
1003else
1004                @echo "  - Supported $(COMPILER_NAME) version '$(COMPILER_VERSION_ALLOWED)' detected - fine!"
1005                @echo ''
1006                $(MAKE) check_same_GCC_VERSION
1007endif
1008endif
1009
1010#---------------------- check ARBHOME
1011
1012# use arb_INSTALL.txt to determine whether ARBHOME points to correct directory
1013ARB_INSTALL_FOUND=$(wildcard $(ARBHOME)/arb_INSTALL.txt)
1014
1015check_ARBHOME:
1016ifeq ($(strip $(ARB_INSTALL_FOUND)),)
1017                @echo ------------------------------------------------------------
1018                @echo "ARBHOME is set to '$(ARBHOME)'"
1019                @echo "The environment variable ARBHOME has to point to the top arb source directory."
1020                @echo "If you use bash enter:"
1021                @echo "          export ARBHOME='`pwd`'"
1022                @echo ------------------------------------------------------------
1023                @false
1024endif
1025
1026ARB_PATH_SET=$(findstring $(ARBHOME)/bin,$(PATH))
1027
1028check_PATH: check_ARBHOME
1029ifeq ($(strip $(ARB_PATH_SET)),)
1030                @echo ------------------------------------------------------------
1031                @echo "The environment variable PATH has to contain $(ARBHOME)/bin"
1032                @echo "If you use bash enter:"
1033                @echo '                 export PATH=$$ARBHOME/bin:$$PATH'
1034                @echo ------------------------------------------------------------
1035                @false
1036endif
1037
1038check_TOOLS:
1039        @util/arb_check_build_env.pl \
1040                "$(A_CC)" \
1041                "$(A_CXX)" \
1042                "$(MAKEDEPEND_PLAIN)" \
1043                "$(LINK_SHARED_LIB)" \
1044                "$(LINK_SHARED_LIB)" \
1045
1046check_ENVIRONMENT : check_PATH check_TOOLS
1047                @echo "-------------------- Environment [start]"
1048                @echo "ARBHOME='$(ARBHOME)'"
1049                @echo "PATH='$(PATH)'"
1050                @echo "LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)'"
1051                @echo "-------------------- Environment [end]"
1052
1053check_tabs: check_setup
1054ifeq ($(DEBUG),1)
1055        @SOURCE_TOOLS/tabBrake.pl
1056endif
1057
1058force_tab_check:
1059        @touch -t 198001010000 SOURCE_TOOLS/stamp.tabBrake
1060        @$(MAKE) check_tabs
1061
1062
1063# ---------------------
1064
1065check_setup: check_ENVIRONMENT check_DEBUG check_ARB_64 check_DEVELOPER check_GCC_VERSION
1066                @echo Your setup seems to be ok.
1067
1068checks: check_setup check_tabs
1069        @rm -f SOURCE_TOOLS/postcompile.sav
1070
1071
1072# end test section ------------------------------
1073
1074# ---------------------------------------
1075# List of standard top level directories
1076#
1077# sub-makefiles have to define the targets
1078# - 'depends' and
1079# - 'clean'
1080#
1081# when adding new libs here, also add a dependency vs 'links' or 'links_non_perl' in .@DD_links_non_perl
1082
1083ARCHS = \
1084                        $(ARCHS_PT_SERVER) \
1085                        AISC/AISC.a \
1086                        AISC_MKPTPS/AISC_MKPTPS.a \
1087                        ARBDB/libARBDB.a \
1088                        CORE/libCORE.a \
1089                        ARB_GDE/ARB_GDE.a \
1090                        AWT/libAWT.a \
1091                        AWTC/AWTC.a \
1092                        AWTI/AWTI.a \
1093                        CONSENSUS_TREE/CONSENSUS_TREE.a \
1094                        CONVERTALN/CONVERTALN.a \
1095                        DBSERVER/DBSERVER.a \
1096                        DIST/DIST.a \
1097                        EDIT4/EDIT4.a \
1098                        EISPACK/EISPACK.a \
1099                        GDE/GDE.a \
1100                        GENOM/GENOM.a \
1101                        GENOM_IMPORT/GENOM_IMPORT.a \
1102                        GL/GL.a \
1103                        ISLAND_HOPPING/ISLAND_HOPPING.a \
1104                        MERGE/MERGE.a \
1105                        MULTI_PROBE/MULTI_PROBE.a \
1106                        NALIGNER/NALIGNER.a \
1107                        NAMES/NAMES.a \
1108                        NAMES_COM/server.a \
1109                        NTREE/NTREE.a \
1110                        PARSIMONY/PARSIMONY.a \
1111                        PERLTOOLS/PERLTOOLS.a \
1112                        PHYLO/PHYLO.a \
1113                        PRIMER_DESIGN/PRIMER_DESIGN.a \
1114                        PROBE_COM/server.a \
1115                        PROBE_DESIGN/PROBE_DESIGN.a \
1116                        PROBE_SET/PROBE_SET.a \
1117                        READSEQ/READSEQ.a \
1118                        RNA3D/RNA3D.a \
1119                        RNACMA/RNACMA.a \
1120                        SECEDIT/SECEDIT.a \
1121                        SEQ_QUALITY/SEQ_QUALITY.a \
1122                        SERVERCNTRL/SERVERCNTRL.a \
1123                        SL/SL.a \
1124                        STAT/STAT.a \
1125                        TOOLS/TOOLS.a \
1126                        TREEGEN/TREEGEN.a \
1127                        UNIT_TESTER/UNIT_TESTER.a \
1128                        WETC/WETC.a \
1129                        WINDOW/libWINDOW.a \
1130                        XML/XML.a \
1131
1132# -----------------------
1133#     library packets
1134
1135ARCHS_CLIENT_PROBE = PROBE_COM/client.a
1136ARCHS_CLIENT_NAMES = NAMES_COM/client.a
1137
1138ARCHS_MAKEBIN = AISC_MKPTPS/AISC_MKPTPS.a AISC/AISC.a
1139
1140# communication libs need aisc and aisc_mkpts:
1141
1142AISC/AISC.dummy: proto_tools
1143
1144comtools: AISC/AISC.dummy
1145
1146ARCHS_SEQUENCE = \
1147                SL/SEQUENCE/SEQUENCE.a \
1148                SL/ALIVIEW/ALIVIEW.a \
1149                SL/PRONUC/PRONUC.a \
1150
1151ARCHS_TREE = \
1152                SL/ARB_TREE/ARB_TREE.a \
1153                SL/FILTER/FILTER.a \
1154                $(ARCHS_SEQUENCE) \
1155
1156# parsimony tree (used by NTREE, PARSIMONY, STAT(->EDIT4), DIST(obsolete!))
1157ARCHS_AP_TREE = \
1158                SL/AP_TREE/AP_TREE.a \
1159                $(ARCHS_TREE) \
1160
1161# --------------------------------------------------------------------------------
1162# dependencies for linking shared libs
1163
1164link_core:      core
1165link_db:        db link_core
1166link_aw:        aw link_db
1167link_awt:       awt link_aw
1168
1169#***************************************************************************************
1170#               Individual_Programs_Section
1171#***************************************************************************************
1172
1173arbmainwrapper:
1174        $(MAKE) -C SOURCE_TOOLS -r mainwrapper
1175
1176
1177#***********************************    arb_ntree **************************************
1178NTREE = bin/arb_ntree
1179ARCHS_NTREE = \
1180                NTREE/NTREE.a \
1181                $(ARCHS_AP_TREE) \
1182                ARB_GDE/ARB_GDE.a \
1183                SL/DB_UI/DB_UI.a \
1184                AWTC/AWTC.a \
1185                AWTI/AWTI.a \
1186                CONSENSUS_TREE/CONSENSUS_TREE.a \
1187                GENOM_IMPORT/GENOM_IMPORT.a \
1188                GENOM/GENOM.a \
1189                MERGE/MERGE.a \
1190                MULTI_PROBE/MULTI_PROBE.a \
1191                PRIMER_DESIGN/PRIMER_DESIGN.a \
1192                PROBE_DESIGN/PROBE_DESIGN.a \
1193                SEQ_QUALITY/SEQ_QUALITY.a \
1194                SERVERCNTRL/SERVERCNTRL.a \
1195                SL/ALILINK/ALILINK.a \
1196                SL/AW_NAME/AW_NAME.a \
1197                SL/CONSENSUS/CONSENSUS.a \
1198                SL/DB_SCANNER/DB_SCANNER.a \
1199                SL/DB_QUERY/DB_QUERY.a \
1200                SL/SEQIO/SEQIO.a \
1201                STAT/STAT.a \
1202                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1203                SL/HELIX/HELIX.a \
1204                SL/REGEXPR/REGEXPR.a \
1205                SL/REFENTRIES/REFENTRIES.a \
1206                SL/NDS/NDS.a \
1207                SL/ITEM_SHADER/ITEM_SHADER.a \
1208                SL/ITEMS/ITEMS.a \
1209                SL/INSDEL/INSDEL.a \
1210                SL/LOCATION/LOCATION.a \
1211                SL/MACROS/MACROS.a \
1212                SL/TRANSLATE/TRANSLATE.a \
1213                SL/TREEDISP/TREEDISP.a \
1214                SL/TREE_ADMIN/TREE_ADMIN.a \
1215                SL/TREE_READ/TREE_READ.a \
1216                SL/TREE_WRITE/TREE_WRITE.a \
1217                XML/XML.a \
1218
1219$(NTREE): $(ARCHS_NTREE:.a=.dummy) link_awt
1220        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_NTREE) $(GUI_LIBS) $(use_ARB_main) || ( \
1221                echo "$(SEP) Link $@"; \
1222                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NTREE) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) $(XMLLIBS)" ; \
1223                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NTREE) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) $(XMLLIBS) && \
1224                echo "$(SEP) Link $@ [done]"; \
1225                )
1226
1227#***********************************    arb_edit4 **************************************
1228EDIT4 = bin/arb_edit4
1229
1230ARCHS_EDIT4 := \
1231                EDIT4/EDIT4.a \
1232                ARB_GDE/ARB_GDE.a \
1233                SL/FAST_ALIGNER/FAST_ALIGNER.a \
1234                AWTC/AWTC.a \
1235                ISLAND_HOPPING/ISLAND_HOPPING.a \
1236                SECEDIT/SECEDIT.a \
1237                SERVERCNTRL/SERVERCNTRL.a \
1238                SL/AW_HELIX/AW_HELIX.a \
1239                SL/AW_NAME/AW_NAME.a \
1240                SL/CONSENSUS/CONSENSUS.a \
1241                SL/ITEMS/ITEMS.a \
1242                STAT/STAT.a \
1243                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1244                SL/HELIX/HELIX.a \
1245                SL/TRANSLATE/TRANSLATE.a \
1246                SL/MACROS/MACROS.a \
1247                SL/NDS/NDS.a \
1248                $(ARCHS_AP_TREE) \
1249                XML/XML.a \
1250
1251ifeq ($(OPENGL),1)
1252ARCHS_EDIT4 += RNA3D/RNA3D.a
1253endif
1254
1255LIBS_EDIT4 := $(GL_LIBS)
1256
1257$(EDIT4): $(ARCHS_EDIT4:.a=.dummy) link_awt
1258        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_EDIT4) $(GUI_LIBS) $(use_ARB_main) || ( \
1259                echo "$(SEP) Link $@"; \
1260                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_EDIT4) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) $(LIBS_EDIT4)" ; \
1261                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_EDIT4) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) $(LIBS_EDIT4) && \
1262                echo "$(SEP) Link $@ [done]"; \
1263                )
1264
1265#***********************************    arb_rnacma **************************************
1266RNACMA = bin/arb_rnacma
1267ARCHS_RNACMA = \
1268                RNACMA/RNACMA.a \
1269
1270$(RNACMA) : $(ARCHS_RNACMA:.a=.dummy) link_db
1271        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_RNACMA) || ( \
1272                echo "$(SEP) Link $@"; \
1273                echo "$(LINK_EXECUTABLE) $@ $(LIBPATH) $(ARCHS_RNACMA) $(LIBS) $(EXECLIBS)"; \
1274                $(LINK_EXECUTABLE) $@ $(LIBPATH) $(ARCHS_RNACMA) $(LIBS) $(EXECLIBS) && \
1275                echo "$(SEP) Link $@ [done]"; \
1276                )
1277
1278#***********************************    arb_wetc **************************************
1279WETC = bin/arb_wetc
1280ARCHS_WETC = \
1281                WETC/WETC.a \
1282                SL/HELIX/HELIX.a \
1283                SL/FILTER/FILTER.a \
1284                XML/XML.a \
1285
1286$(WETC): $(ARCHS_WETC:.a=.dummy) link_awt
1287        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_WETC) $(GUI_LIBS) $(use_ARB_main) || ( \
1288                echo "$(SEP) Link $@"; \
1289                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_WETC) $(GUI_LIBS)" ; \
1290                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_WETC) $(GUI_LIBS) && \
1291                echo "$(SEP) Link $@ [done]"; \
1292                )
1293
1294#***********************************    arb_dist **************************************
1295DIST = bin/arb_dist
1296ARCHS_DIST = \
1297                DIST/DIST.a \
1298                CONSENSUS_TREE/CONSENSUS_TREE.a \
1299                EISPACK/EISPACK.a \
1300                SERVERCNTRL/SERVERCNTRL.a \
1301                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1302                SL/HELIX/HELIX.a \
1303                SL/MATRIX/MATRIX.a \
1304                SL/MACROS/MACROS.a \
1305                SL/NDS/NDS.a \
1306                SL/ITEMS/ITEMS.a \
1307                SL/NEIGHBOURJOIN/NEIGHBOURJOIN.a \
1308                XML/XML.a \
1309                $(ARCHS_AP_TREE) \
1310
1311$(DIST): $(ARCHS_DIST:.a=.dummy) link_awt
1312        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_DIST) $(GUI_LIBS) $(use_ARB_main) || ( \
1313                echo "$(SEP) Link $@"; \
1314                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_DIST) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS)" ; \
1315                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_DIST) $(ARCHS_CLIENT_PROBE) $(GUI_LIBS) && \
1316                echo "$(SEP) Link $@ [done]"; \
1317                )
1318
1319#***********************************    arb_pars **************************************
1320PARSIMONY = bin/arb_pars
1321ARCHS_PARSIMONY = \
1322                PARSIMONY/PARSIMONY.a \
1323                SERVERCNTRL/SERVERCNTRL.a \
1324                SL/AW_NAME/AW_NAME.a \
1325                SL/GUI_ALIVIEW/GUI_ALIVIEW.a \
1326                SL/HELIX/HELIX.a \
1327                SL/MACROS/MACROS.a \
1328                SL/NDS/NDS.a \
1329                SL/ITEMS/ITEMS.a \
1330                SL/TRANSLATE/TRANSLATE.a \
1331                SL/TREEDISP/TREEDISP.a \
1332                XML/XML.a \
1333                $(ARCHS_AP_TREE) \
1334
1335$(PARSIMONY): $(ARCHS_PARSIMONY:.a=.dummy) link_awt
1336        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_PARSIMONY) $(GUI_LIBS) $(use_ARB_main) || ( \
1337                echo "$(SEP) Link $@"; \
1338                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PARSIMONY) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS)" ; \
1339                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PARSIMONY) $(ARCHS_CLIENT_NAMES) $(GUI_LIBS) && \
1340                echo "$(SEP) Link $@ [done]"; \
1341                )
1342
1343#*********************************** arb_convert_aln **************************************
1344CONVERT_ALN = bin/arb_convert_aln
1345ARCHS_CONVERT_ALN =     \
1346                CONVERTALN/CONVERTALN.a \
1347
1348$(CONVERT_ALN) : $(ARCHS_CONVERT_ALN:.a=.dummy) link_db
1349        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_CONVERT_ALN) $(use_ARB_main) || ( \
1350                echo "$(SEP) Link $@"; \
1351                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_CONVERT_ALN) $(LIBS)"; \
1352                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_CONVERT_ALN) $(LIBS) && \
1353                echo "$(SEP) Link $@ [done]"; \
1354                )
1355
1356#*********************************** arb_treegen **************************************
1357
1358TREEGEN = bin/arb_treegen
1359ARCHS_TREEGEN = \
1360                TREEGEN/TREEGEN.a \
1361
1362$(TREEGEN) :  $(ARCHS_TREEGEN:.a=.dummy)
1363        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_TREEGEN) $(use_ARB_main_C) || ( \
1364                echo "$(SEP) Link $@"; \
1365                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(EXECLIBS) $(ARCHS_TREEGEN)" ; \
1366                $(LINK_EXECUTABLE) $@ $(use_ARB_main_C) $(LIBPATH) $(EXECLIBS) $(ARCHS_TREEGEN) && \
1367                echo "$(SEP) Link $@ [done]"; \
1368                )
1369
1370#***********************************    arb_naligner **************************************
1371NALIGNER = bin/arb_naligner
1372ARCHS_NALIGNER = \
1373                NALIGNER/NALIGNER.a \
1374                SERVERCNTRL/SERVERCNTRL.a \
1375                SL/HELIX/HELIX.a \
1376
1377$(NALIGNER): $(ARCHS_NALIGNER:.a=.dummy) link_db
1378        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_NALIGNER) $(use_ARB_main) || ( \
1379                echo "$(SEP) Link $@"; \
1380                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NALIGNER) $(ARCHS_CLIENT_PROBE) $(LIBS)" ; \
1381                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NALIGNER) $(ARCHS_CLIENT_PROBE) $(LIBS) && \
1382                echo "$(SEP) Link $@ [done]"; \
1383                )
1384
1385#***********************************    arb_phylo **************************************
1386PHYLO = bin/arb_phylo
1387ARCHS_PHYLO = \
1388                PHYLO/PHYLO.a \
1389                SL/HELIX/HELIX.a \
1390                SL/FILTER/FILTER.a \
1391                SL/MACROS/MACROS.a \
1392                XML/XML.a \
1393
1394$(PHYLO): $(ARCHS_PHYLO:.a=.dummy) link_awt
1395        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_PHYLO) $(GUI_LIBS) $(use_ARB_main) || ( \
1396                echo "$(SEP) Link $@"; \
1397                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PHYLO) $(GUI_LIBS)" ; \
1398                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PHYLO) $(GUI_LIBS) && \
1399                echo "$(SEP) Link $@ [done]"; \
1400                )
1401
1402#***************************************************************************************
1403#                                       SERVER SECTION
1404#***************************************************************************************
1405
1406#***********************************    arb_db_server **************************************
1407DBSERVER = bin/arb_db_server
1408ARCHS_DBSERVER = \
1409                DBSERVER/DBSERVER.a \
1410                SERVERCNTRL/SERVERCNTRL.a \
1411
1412$(DBSERVER): $(ARCHS_DBSERVER:.a=.dummy) link_db
1413        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_DBSERVER) $(ARBDB_LIB) $(use_ARB_main) || ( \
1414                echo "$(SEP) Link $@"; \
1415                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_DBSERVER) $(ARBDB_LIB) $(ARCHS_CLIENT_PROBE) $(SYSLIBS)" ; \
1416                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_DBSERVER) $(ARBDB_LIB) $(ARCHS_CLIENT_PROBE) $(SYSLIBS) && \
1417                echo "$(SEP) Link $@ [done]"; \
1418                )
1419
1420#***********************************    arb_pt_server **************************************
1421PROBE = bin/arb_pt_server
1422ARCHS_PROBE_COMMON = \
1423                SL/PTCLEAN/PTCLEAN.a \
1424                SERVERCNTRL/SERVERCNTRL.a \
1425                SL/HELIX/HELIX.a \
1426
1427ARCHS_PROBE_LINK = \
1428                $(ARCHS_PT_SERVER_LINK) \
1429                $(ARCHS_PROBE_COMMON) \
1430
1431ARCHS_PROBE_DEPEND = \
1432                $(ARCHS_PT_SERVER) \
1433                $(ARCHS_PROBE_COMMON) \
1434
1435$(PROBE): $(ARCHS_PROBE_DEPEND:.a=.dummy) link_db
1436        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_PROBE_LINK) $(ARBDB_LIB) $(ARCHS_SERVER_PROBE) config.makefile $(use_ARB_main) || ( \
1437                echo "$(SEP) Link $@"; \
1438                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PROBE_LINK) $(ARCHS_CLIENT_PROBE) $(ARBDB_LIB) $(SYSLIBS)" ; \
1439                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_PROBE_LINK) $(ARCHS_CLIENT_PROBE) $(ARBDB_LIB) $(SYSLIBS) && \
1440                echo "$(SEP) Link $@ [done]"; \
1441                )
1442
1443#***********************************    arb_name_server **************************************
1444NAMES = bin/arb_name_server
1445ARCHS_NAMES = \
1446                NAMES/NAMES.a \
1447                SERVERCNTRL/SERVERCNTRL.a \
1448
1449$(NAMES): $(ARCHS_NAMES:.a=.dummy) link_db
1450        @SOURCE_TOOLS/binuptodate.pl $@ $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) $(use_ARB_main) || ( \
1451                echo "$(SEP) Link $@"; \
1452                echo "$(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) NAMES_COM/server.a $(SYSLIBS)" ; \
1453                $(LINK_EXECUTABLE) $@ $(use_ARB_main) $(LIBPATH) $(EXECLIBS) $(ARCHS_NAMES) $(ARBDB_LIB) $(ARCHS_CLIENT_NAMES) NAMES_COM/server.a $(SYSLIBS) && \
1454                echo "$(SEP) Link $@ [done]"; \
1455                )
1456
1457#***********************************    SHARED LIBRARIES SECTION  **************************************
1458
1459prepare_libdir: addlibs
1460
1461addlibs:
1462        (perl $(ARBHOME)/SOURCE_TOOLS/provide_libs.pl \
1463                                "arbhome=$(ARBHOME)" \
1464                                "opengl=$(OPENGL)" \
1465                                "link_static=$(LINK_STATIC)" \
1466        )
1467
1468#***************************************************************************************
1469#                       Recursive calls to sub-makefiles
1470#***************************************************************************************
1471
1472%.depends:
1473        @cp -p $(@D)/Makefile $(@D)/Makefile.old # save old Makefile
1474        @$(MAKE) -C $(@D) -r \
1475                "AUTODEPENDS=1" \
1476                "MAIN=nothing" \
1477                "cflags=noCflagsHere_use_MAKEDEPENDFLAGS" \
1478                "cxxflags=noCxxflagsHere_use_MAKEDEPENDFLAGS" \
1479                depends
1480        @grep "^# DO NOT DELETE" $(@D)/Makefile >/dev/null
1481        @cat $(@D)/Makefile \
1482                | SOURCE_TOOLS/fix_depends.pl "(from main)" \
1483                >$(@D)/Makefile.2
1484        @mv $(@D)/Makefile.old $(@D)/Makefile # restore old Makefile
1485        @$(ARBHOME)/SOURCE_TOOLS/mv_if_diff $(@D)/Makefile.2 $(@D)/Makefile # update Makefile if changed
1486
1487%.proto:
1488        @($(MAKE) -C $(@D) \
1489                "AUTODEPENDS=0" \
1490                "MAIN=nothing" \
1491                "cflags=noCflags" \
1492                "cxxflags=noCxxflags" \
1493                proto 2>&1 ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
1494
1495%.clean:
1496        @$(MAKE) -C $(@D) \
1497                "AUTODEPENDS=0" \
1498                "MAIN=nothing" \
1499                "cflags=noCflags" \
1500                "cxxflags=noCxxflags" \
1501                clean
1502
1503
1504# stop wrong targets
1505target_is_missing_lib_prefix:
1506        @echo "Error: Denied to build shared library target with missing 'lib'-prefix"
1507        false
1508
1509ARBDB/ARBDB.dummy:   target_is_missing_lib_prefix
1510CORE/CORE.dummy:     target_is_missing_lib_prefix
1511AWT/AWT.dummy:       target_is_missing_lib_prefix
1512WINDOW/WINDOW.dummy: target_is_missing_lib_prefix
1513
1514# rule to generate main target (normally a library):
1515# @@@ check effect of setting LANG=C below
1516%.dummy:
1517        @( export ID=$$$$; LANG=C; \
1518        (( \
1519            echo "$(SEP) Make $(@D)"; \
1520            $(MAKE) -C $(@D) -r \
1521                "AUTODEPENDS=1" \
1522                "MAIN=$(@F:.dummy=.a)" \
1523                "cflags=$(cflags) -DIN_ARB_$(subst /,_,$(@D))" \
1524                && \
1525            echo "$(SEP) Make $(@D) [done]"; \
1526        ) >$(@D).$$ID.log 2>&1 && (cat $(@D).$$ID.log;rm $(@D).$$ID.log)) || (cat $(@D).$$ID.log;rm $(@D).$$ID.log;false))
1527
1528# Additional dependencies for subtargets:
1529
1530PROBE_COM/PROBE_COM.dummy : comtools
1531NAMES_COM/NAMES_COM.dummy : comtools
1532
1533com: PROBE_COM/PROBE_COM.dummy NAMES_COM/NAMES_COM.dummy
1534
1535PROBE_COM/server.dummy:
1536        @echo Unwanted request to make target $<
1537        false
1538
1539PROBE_COM/client.dummy:
1540        @echo Unwanted request to make target $<
1541        false
1542
1543NAMES_COM/server.dummy:
1544        @echo Unwanted request to make target $<
1545        false
1546
1547NAMES_COM/client.dummy:
1548        @echo Unwanted request to make target $<
1549        false
1550
1551
1552ARBDB/libARBDB.dummy:                   links
1553CORE/libCORE.dummy:                     links
1554
1555PERLTOOLS/PERLTOOLS.dummy:              core db
1556
1557# all subdirs perl not depends on go here (ADD_links_non_perl)
1558AWT/libAWT.dummy:                       links_non_perl
1559AWTI/AWTI.dummy:                        links_non_perl
1560CONSENSUS_TREE/CONSENSUS_TREE.dummy:    links_non_perl
1561CONVERTALN/CONVERTALN.dummy:            links_non_perl
1562DBSERVER/DBSERVER.dummy:                links_non_perl
1563DIST/DIST.dummy:                        links_non_perl
1564EDIT4/EDIT4.dummy:                      links_non_perl com
1565EISPACK/EISPACK.dummy:                  links_non_perl
1566GDE/GDE.dummy:                          links_non_perl
1567GENOM/GENOM.dummy:                      links_non_perl
1568GENOM_IMPORT/GENOM_IMPORT.dummy:        links_non_perl
1569ISLAND_HOPPING/ISLAND_HOPPING.dummy:    links_non_perl
1570MERGE/MERGE.dummy:                      links_non_perl
1571NTREE/NTREE.dummy:                      links_non_perl
1572PARSIMONY/PARSIMONY.dummy:              links_non_perl
1573PHYLO/PHYLO.dummy:                      links_non_perl
1574PRIMER_DESIGN/PRIMER_DESIGN.dummy:      links_non_perl
1575PROBE_SET/PROBE_SET.dummy:              links_non_perl link_db
1576READSEQ/READSEQ.dummy:                  links_non_perl
1577RNACMA/RNACMA.dummy:                    links_non_perl header_libs
1578SECEDIT/SECEDIT.dummy:                  links_non_perl
1579SEQ_QUALITY/SEQ_QUALITY.dummy:          links_non_perl
1580SERVERCNTRL/SERVERCNTRL.dummy:          links_non_perl com
1581SL/ALILINK/ALILINK.dummy:               links_non_perl
1582SL/ALIVIEW/ALIVIEW.dummy:               links_non_perl
1583SL/AP_TREE/AP_TREE.dummy:               links_non_perl
1584SL/ARB_TREE/ARB_TREE.dummy:             links_non_perl
1585SL/AW_HELIX/AW_HELIX.dummy:             links_non_perl
1586SL/CONSENSUS/CONSENSUS.dummy:           links_non_perl
1587SL/DB_QUERY/DB_QUERY.dummy:             links_non_perl
1588SL/DB_SCANNER/DB_SCANNER.dummy:         links_non_perl
1589SL/DB_UI/DB_UI.dummy:                   links_non_perl
1590SL/FAST_ALIGNER/FAST_ALIGNER.dummy:     links_non_perl
1591SL/FILTER/FILTER.dummy:                 links_non_perl
1592SL/GUI_ALIVIEW/GUI_ALIVIEW.dummy:       links_non_perl
1593SL/HELIX/HELIX.dummy:                   links_non_perl
1594SL/INSDEL/INSDEL.dummy:                 links_non_perl
1595SL/ITEMS/ITEMS.dummy:                   links_non_perl
1596SL/ITEM_SHADER/ITEM_SHADER.dummy:       links_non_perl
1597SL/LOCATION/LOCATION.dummy:             links_non_perl
1598SL/MACROS/MACROS.dummy:                 links_non_perl
1599SL/MATRIX/MATRIX.dummy:                 links_non_perl
1600SL/NDS/NDS.dummy:                       links_non_perl
1601SL/NEIGHBOURJOIN/NEIGHBOURJOIN.dummy:   links_non_perl
1602SL/PRONUC/PRONUC.dummy:                 links_non_perl
1603SL/PTCLEAN/PTCLEAN.dummy:               links_non_perl link_db
1604SL/REFENTRIES/REFENTRIES.dummy:         links_non_perl
1605SL/REGEXPR/REGEXPR.dummy:               links_non_perl
1606SL/SEQIO/SEQIO.dummy:                   links_non_perl
1607SL/SEQUENCE/SEQUENCE.dummy:             links_non_perl
1608SL/TRANSLATE/TRANSLATE.dummy:           links_non_perl
1609SL/TREE_ADMIN/TREE_ADMIN.dummy:         links_non_perl
1610SL/TREE_READ/TREE_READ.dummy:           links_non_perl
1611SL/TREE_WRITE/TREE_WRITE.dummy:         links_non_perl
1612SL/TREEDISP/TREEDISP.dummy:             links_non_perl
1613STAT/STAT.dummy:                        links_non_perl
1614TREEGEN/TREEGEN.dummy:                  links_non_perl
1615WETC/WETC.dummy:                        links_non_perl
1616WINDOW/libWINDOW.dummy:                 links_non_perl
1617XML/XML.dummy:                          links_non_perl
1618
1619ifeq ($(OPENGL),1)
1620GL/glAW/glAW.dummy: links_non_perl
1621GL/glpng/glpng.dummy: links_non_perl
1622GL/GL.dummy: GL/glAW/glAW.dummy GL/glpng/glpng.dummy
1623RNA3D/RNA3D.dummy: links_non_perl gl
1624endif
1625
1626UNIT_TESTER/UNIT_TESTER.dummy:          link_db \
1627        SERVERCNTRL/SERVERCNTRL.dummy \
1628
1629# see also TOOLS/Makefile@TOOLSLIBDEPENDS
1630TOOLS/TOOLS.dummy : links_non_perl link_db \
1631        CONSENSUS_TREE/CONSENSUS_TREE.dummy \
1632        SERVERCNTRL/SERVERCNTRL.dummy \
1633        SL/FILTER/FILTER.dummy \
1634        SL/INSDEL/INSDEL.dummy \
1635        SL/REGEXPR/REGEXPR.dummy \
1636        SL/SEQIO/SEQIO.dummy \
1637        SL/TREE_READ/TREE_READ.dummy \
1638        SL/TREE_WRITE/TREE_WRITE.dummy \
1639        XML/XML.dummy \
1640
1641AWTC/AWTC.dummy :                       com
1642
1643NAMES/NAMES.dummy :                     com
1644SL/AW_NAME/AW_NAME.dummy :              com
1645
1646PROBE/PROBE.dummy :                     com
1647ptpan/PROBE.dummy :                     com
1648MULTI_PROBE/MULTI_PROBE.dummy :         com
1649PROBE_DESIGN/PROBE_DESIGN.dummy :       com
1650NALIGNER/NALIGNER.dummy :               com
1651
1652ARB_GDE/ARB_GDE.dummy :                 proto_tools
1653
1654compile_compatibility: SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.dummy
1655
1656#***************************************************************************************
1657#                       Short aliases to make targets
1658#***************************************************************************************
1659
1660show:
1661                @echo $(SEP)
1662                @echo 'Aliases for often needed targets:'
1663                @echo ''
1664                @echo ' executables:'
1665                @echo ''
1666                @echo '  nt     arb_ntree'
1667                @echo '  e4     arb_edit4 (includes secedit)'
1668                @echo '  di     arb_dist'
1669                @echo '  ph     arb_phylo'
1670                @echo '  pa     arb_parsimony'
1671                @echo '  tg     arb_treegen'
1672                @echo '  ds     arb_dbserver'
1673                @echo '  pt     arb_pt_server'
1674                @echo '  na     arb_name_server'
1675                @echo ''
1676                @echo ' libraries:'
1677                @echo ''
1678                @echo '  com    communication libraries'
1679                @echo '  db     ARB database'
1680                @echo '  aw     GUI lib'
1681                @echo '  awt    GUI toolkit'
1682                @echo '  awtc   general purpose library'
1683                @echo '  awti   import/export library'
1684                @echo '  mp     multi probe library'
1685                @echo '  ge     genome library'
1686                @echo '  pd     probe design lib'
1687                @echo '  prd    primer design lib'
1688                @echo ''
1689                @echo ' other targets:'
1690                @echo ''
1691                @echo '  help   recompile help files'
1692                @echo '  tools  make small tools used by arb'
1693                @echo ''
1694                @echo ' foreign targets:'
1695                @echo ''
1696                @echo '  gde    GDE'
1697                @echo '  agde   ARB_GDE'
1698                @echo ''
1699                @echo 'for other targets inspect $(ARBHOME)/Makefile'
1700                @echo ''
1701                @echo $(SEP)
1702
1703source_doc:
1704        @echo "Remove some links (doxygen crashes otherwise):"
1705        find . \( -name "AISC" -o -name "C" -o -name "GDEHELP" \) -type l -exec rm {} \;
1706        doxygen 2>&1 1>/dev/null
1707        $(MAKE) forcelinks
1708
1709dep_graph:
1710        @echo "Building some dependency graphs"
1711        SOURCE_TOOLS/dependency_graphs.pl
1712
1713help:   HELP_SOURCE/HELP_SOURCE.dummy
1714
1715HELP_SOURCE/HELP_SOURCE.dummy: link_core xml menus
1716
1717db:     ARBDB/libARBDB.dummy
1718core:   CORE/libCORE.dummy
1719aw:     WINDOW/libWINDOW.dummy
1720awt:    AWT/libAWT.dummy
1721awtc:   AWTC/AWTC.dummy
1722awti:   AWTI/AWTI.dummy
1723
1724mp:     MULTI_PROBE/MULTI_PROBE.dummy
1725mg:     MERGE/MERGE.dummy
1726ge:     GENOM/GENOM.dummy
1727prd:    PRIMER_DESIGN/PRIMER_DESIGN.dummy
1728
1729nt:     menus $(NTREE)
1730
1731nal:    $(NALIGNER)
1732
1733di:     $(DIST)
1734ph:     $(PHYLO)
1735pa:     $(PARSIMONY)
1736tg:     $(TREEGEN)
1737
1738ifeq ($(OPENGL),1)
17393d:     RNA3D/RNA3D.dummy
1740gl:     GL/GL.dummy
1741else
1742noopengl:
1743        @echo "invalid target for OPENGL=0"
17443d: noopengl
1745gl: noopengl
1746endif
1747
1748SL/SL.dummy: com
1749
1750ds:     $(DBSERVER)
1751pt:     $(PROBE)
1752pst:    PROBE_SET/PROBE_SET.dummy
1753pd:     PROBE_DESIGN/PROBE_DESIGN.dummy
1754na:     $(NAMES)
1755sq:     SEQ_QUALITY/SEQ_QUALITY.dummy
1756cma:    $(RNACMA)
1757
1758sec:    SECEDIT/SECEDIT.dummy
1759
1760e4:     $(EDIT4) readseq menus
1761
1762gi:     GENOM_IMPORT/GENOM_IMPORT.dummy
1763wetc:   $(WETC)
1764
1765xml:    XML/XML.dummy
1766xmlin:  XML_IMPORT/XML_IMPORT.dummy# broken
1767stat:   STAT/STAT.dummy $(NTREE) $(EDIT4)
1768fa:     SL/FAST_ALIGNER/FAST_ALIGNER.dummy
1769
1770#********************************************************************************
1771
1772up_by_remake: depends proto vectorize_checks
1773
1774up: up_by_remake tags valgrind_update
1775
1776#********************************************************************************
1777
1778touch:
1779        SOURCE_TOOLS/touch_modified.pl
1780
1781modified: touch
1782        $(MAKE) all
1783
1784#********************************************************************************
1785
1786libdepends:
1787        $(MAKE) -C "SOURCE_TOOLS" \
1788                "RNA3D_LIB=$(RNA3D_LIB_4_DEPENDS)" \
1789                libdepends
1790
1791#********************************************************************************
1792
1793# create generated headers:
1794genheaders: TEMPLATES/TEMPLATES.dummy
1795
1796clrdotdepends:
1797        rm PROBE_COM/.depends || true
1798        rm NAMES_COM/.depends || true
1799        rm PERL2ARB/.depends || true
1800
1801comdepends: comtools clrdotdepends
1802        @echo "$(SEP) Partially build com interface"
1803        $(MAKE) PROBE_COM/PROBE_COM.depends NAMES_COM/NAMES_COM.depends
1804        $(MAKE) PROBE_COM/server.depends    NAMES_COM/server.depends
1805
1806depends: genheaders comdepends vectorize_checks
1807        @echo "$(SEP) Updating other dependencies"
1808        $(MAKE) $(subst NAMES_COM/server.depends,,$(subst PROBE_COM/server.depends,,$(ARCHS:.a=.depends))) \
1809                HELP_SOURCE/HELP_SOURCE.depends \
1810                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.depends \
1811
1812        $(MAKE) libdepends
1813
1814depend: depends
1815
1816# ------------------------------------------------------------
1817# dependency generation tests for AISC code
1818#(all should work w/o creating wrong dependencies;
1819# neither in XXX_COM/Makefile nor in code using AISC interface)
1820dependstest1: silent_clean
1821        $(MAKE) depends
1822dependstest2: silent_clean
1823        $(MAKE) com
1824dependstest3: silent_clean
1825        $(MAKE) aw
1826dependstest4: silent_clean
1827        $(MAKE) pt
1828dependstest5: silent_clean
1829        $(MAKE) na
1830dependstest6: silent_clean
1831        $(MAKE) nt
1832dependstest7: silent_clean
1833        $(MAKE) all
1834# ------------------------------------------------------------
1835
1836vectorize_checks:
1837        $(MAKE) -C SOURCE_TOOLS -r vectorize_checks
1838
1839# ------------------------------------------------------------
1840
1841AISC_MKPTPS/AISC_MKPTPS.dummy: links
1842
1843proto_tools: AISC_MKPTPS/AISC_MKPTPS.dummy
1844
1845proto: proto_tools
1846        @echo $(SEP) Updating prototypes
1847        $(MAKE) \
1848                ARBDB/ARBDB.proto \
1849                AISC_COM/AISC_COM.proto \
1850                ARB_GDE/ARB_GDE.proto \
1851                CORE/CORE.proto \
1852                CONVERTALN/CONVERTALN.proto \
1853                NTREE/NTREE.proto \
1854                MERGE/MERGE.proto \
1855                $(ARCHS_PT_SERVER:.a=.proto) \
1856                SERVERCNTRL/SERVERCNTRL.proto \
1857                SL/SL.proto \
1858
1859#********************************************************************************
1860
1861valgrind_update: links
1862        @echo $(SEP) Updating for valgrind
1863        $(MAKE) -C SOURCE_TOOLS valgrind_update
1864
1865#********************************************************************************
1866
1867TAGFILE=TAGS
1868TAGFILE_TMP=TAGS.tmp
1869
1870TAG_SOURCE_HEADERS=TAGS.headers
1871TAG_SOURCE_CODE=TAGS.codefiles
1872TAG_SOURCE_LISTS=$(TAG_SOURCE_HEADERS) $(TAG_SOURCE_CODE)
1873
1874ETAGS=ctags -e -f $(TAGFILE_TMP) --sort=no --if0=no --extra=q
1875ETAGS_TYPES=--C-kinds=cgnsut --C++-kinds=cgnsut
1876ETAGS_FUN  =--C-kinds=fm     --C++-kinds=fm
1877ETAGS_REST =--C-kinds=dev    --C++-kinds=dev
1878
1879FILTER_TAGS_SOURCES= \
1880        $(SED) -e 's/^.\///g' | \
1881        grep -P -v -i '^HEADERLIBS|^GDE/|/GEN[CH]/'
1882
1883$(TAG_SOURCE_HEADERS): links
1884        find . \( -name '*.hxx' -o -name "*.h" \) -type f | $(FILTER_TAGS_SOURCES) > $@
1885
1886$(TAG_SOURCE_CODE): links
1887        find . \( -name '*.cxx' -o -name "*.c" \) -type f | $(FILTER_TAGS_SOURCES) > $@
1888
1889tags: $(TAG_SOURCE_LISTS)
1890        $(ETAGS)    $(ETAGS_TYPES) -L $(TAG_SOURCE_HEADERS)
1891        $(ETAGS) -a $(ETAGS_FUN)   -L $(TAG_SOURCE_HEADERS)
1892        $(ETAGS) -a $(ETAGS_REST)  -L $(TAG_SOURCE_HEADERS)
1893        $(ETAGS) -a $(ETAGS_TYPES) -L $(TAG_SOURCE_CODE)
1894        $(ETAGS) -a $(ETAGS_FUN)   -L $(TAG_SOURCE_CODE)
1895        $(ETAGS) -a $(ETAGS_REST)  -L $(TAG_SOURCE_CODE)
1896        mv_if_diff $(TAGFILE_TMP) $(TAGFILE)
1897        rm $(TAG_SOURCE_LISTS)
1898
1899#********************************************************************************
1900
1901LINKSTAMP=SOURCE_TOOLS/stamp.generate_all_links
1902
1903links: checks $(LINKSTAMP) arbmainwrapper
1904links_no_checks: $(LINKSTAMP) arbmainwrapper
1905
1906forcelinks:
1907        -rm $(LINKSTAMP)
1908        $(MAKE) links
1909
1910$(LINKSTAMP): SOURCE_TOOLS/generate_all_links.sh genheaders
1911        +SOURCE_TOOLS/generate_all_links.sh
1912        touch $(LINKSTAMP)
1913
1914clean_links:
1915#       avoid to delete linked pts, nas or arb_tcp.dat:
1916        find . -path './lib' -prune -o -type l -exec rm {} \;
1917#       removed obsolete file - refuses to disappear due to 'prune' above
1918        @rm -f lib/help/GDEHELP
1919        @rm -f $(LINKSTAMP) lib/inputMasks/format.readme
1920
1921redo_links: clean_links
1922        $(MAKE) links_no_checks
1923
1924#********************************************************************************
1925
1926header_libs:
1927        $(MAKE) -C HEADERLIBS all
1928
1929#********************************************************************************
1930
1931gde:            GDE/GDE.dummy
1932GDE:            gde
1933agde:           ARB_GDE/ARB_GDE.dummy
1934
1935tools:          TOOLS/TOOLS.dummy
1936
1937convert:        $(CONVERT_ALN)
1938readseq:        READSEQ/READSEQ.dummy
1939
1940#***************************************************************************************
1941#                       Some user commands
1942#***************************************************************************************
1943
1944menus: binlink links
1945        @(( \
1946                echo "$(SEP) Make GDEHELP"; \
1947                $(MAKE) -C GDEHELP -r all && \
1948                echo "$(SEP) Make GDEHELP [done]"; \
1949        ) > GDEHELP.log 2>&1 && (cat GDEHELP.log;rm GDEHELP.log)) || (cat GDEHELP.log;rm GDEHELP.log;false)
1950
1951ifeq ($(DEBUG),1)
1952BIN_TARGET=develall
1953else
1954BIN_TARGET=all
1955endif
1956
1957
1958binlink:
1959        $(MAKE) -C bin $(BIN_TARGET)
1960
1961preplib:
1962        (cd lib;$(MAKE) all)
1963
1964# --------------------------------------------------------------------------------
1965# This section is quite tricky:
1966#
1967# make 'perl' is a BIG target, so when it has to be made, it has to be started
1968# as early as possible to reduce overall compile time. Since 'make' does not
1969# provide any priotities, i force it to build all 'perl'-prerequisites early, by
1970# adding  artificial dependencies to these prerequisites
1971#
1972# That behavior is likely to be system-dependent.
1973# My goal was only to make it work on my current development system,
1974# where this saves about 20% of overall build time.
1975
1976ifeq ($(WITHPERL),1)
1977links_non_perl: PERLTOOLS/PERLTOOLS.dummy
1978perltools:      links_non_perl
1979perl:           realperl
1980else
1981links_non_perl: links
1982perl:
1983        $(MAKE) "WITHPERL=1" perl
1984endif
1985
1986# ---------------------------------------- perl
1987
1988ifeq ($(ARB_64),$(BUILDHOST_64))
1989TEST_PERL_SCRIPTS=$(MAKE) -C PERL_SCRIPTS/test test
1990else
1991TEST_PERL_SCRIPTS=echo "skipping perl script compilation (when cross-compiling)"
1992endif
1993
1994realperl: perltools
1995        (( \
1996                echo "$(SEP) Make PERL2ARB" ; \
1997                $(TIME) $(MAKE) -C PERL2ARB -r -f Makefile.main \
1998                        "AUTODEPENDS=1" \
1999                        "dflags=$(dflags)" \
2000                        "cflags4perl=$(cflags) $(cxxflags) $(dflags)" \
2001                        "lflags4perl=$(lflags4perl)" \
2002                        "COMPILER_VERSION=$(COMPILER_VERSION)" \
2003                        all && \
2004                $(TEST_PERL_SCRIPTS) && \
2005                echo "$(SEP) Make PERL2ARB [done]" ; \
2006        ) > PERL2ARB.log 2>&1 && (cat PERL2ARB.log;rm PERL2ARB.log)) || (cat PERL2ARB.log;rm PERL2ARB.log;false)
2007
2008perl_clean:
2009        @$(MAKE) -C PERL2ARB -r -f Makefile.main \
2010                "AUTODEPENDS=0" \
2011                clean
2012
2013PERL2ARB/PERL2ARB.clean:
2014        $(MAKE) perl_clean
2015        $(MAKE) -C PERL_SCRIPTS/test clean
2016
2017# ---------------------------------------- bindings to script languages
2018
2019bindings: lib/libCORE.so lib/libARBDB.so
2020        $(MAKE) -C BINDINGS all ARBDEPENDS="$(^:%=../%)" DFLAGS="$(dflags)"
2021
2022bindings_clean:
2023        $(MAKE) -C BINDINGS clean
2024
2025# ----------------------------------------
2026
2027CLOC=cloc-1.08.pl
2028CLOCFLAGS=--no3 --quiet --progress-rate=0
2029CLOCARB=--exclude-dir=GDE .
2030CLOCEXT=GDE
2031CLOCCODE=--read-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.code.def
2032CLOCREST=--read-lang-def=$(ARBHOME)/SOURCE_TOOLS/arb.cloc.rest.def
2033CLOCFILT=tail --lines=+4
2034
2035cloc:
2036        @echo 'Arb code:'
2037        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCARB) | $(CLOCFILT)
2038        @echo 'Arb rest:'
2039        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCARB) | $(CLOCFILT)
2040        @echo 'External code:'
2041        @$(CLOC) $(CLOCFLAGS) $(CLOCCODE) $(CLOCEXT) | $(CLOCFILT)
2042        @echo 'External rest:'
2043        @$(CLOC) $(CLOCFLAGS) $(CLOCREST) $(CLOCEXT) | $(CLOCFILT)
2044
2045# ---------------------------------------- check resources
2046
2047check_res:
2048        $(ARBHOME)/SOURCE_TOOLS/check_resources.pl
2049
2050# ---------------------------------------- cleaning
2051
2052rmbak:
2053        @echo "Cleanup:"
2054        @find . \(      -name '*%' \
2055                        -o -name '*.bak' \
2056                        -o -name '*~' \) \
2057                        -o \( -name 'core' -a \! -type d \) \
2058                -exec rm -v {} \;
2059
2060bin_reinit:
2061        $(MAKE) bin/bin.clean
2062        $(MAKE) -C "bin" all
2063
2064clean_directories:
2065        -rm -rf \
2066                $(ARBHOME)/PROBE_SET/bin \
2067                $(ARBHOME)/INCLUDE \
2068
2069libclean:
2070        -find $(ARBHOME) -type f \( -name '*.a' ! -type l \) -exec rm -f {} \;
2071
2072objclean:
2073        -find $(ARBHOME) -type f \( -name '*.o' ! -type l \) -exec rm -f {} \;
2074
2075# bin.clean and HELP_SOURCE.clean interfere
2076clean3:
2077        $(MAKE) bin/bin.clean
2078        $(MAKE) HELP_SOURCE/HELP_SOURCE.clean
2079
2080clean2: $(ARCHS:.a=.clean) \
2081                clean3 \
2082                rmbak \
2083                libclean \
2084                objclean \
2085                lib/lib.clean \
2086                GDEHELP/GDEHELP.clean \
2087                HEADERLIBS/HEADERLIBS.clean \
2088                SOURCE_TOOLS/SOURCE_TOOLS.clean \
2089                SOURCE_TOOLS/COMPILE_COMPAT/COMPILE_COMPAT.clean \
2090                UNIT_TESTER/UNIT_TESTER.clean \
2091                TEMPLATES/TEMPLATES.clean \
2092                perl_clean \
2093                clean_directories \
2094
2095        rm -f *.last_gcc *.last_compiler config.makefile.bak
2096
2097# links are needed for cleanup
2098clean: redo_links motif_xpm_hack_clean
2099        $(MAKE) clean2
2100        $(MAKE) clean_cov_all clean_links
2101
2102silent_clean:
2103        $(MAKE) clean >/dev/null
2104
2105# 'relocated' is about 50% faster than 'rebuild'
2106reloc_clean: links
2107        @echo "---------------------------------------- Relocation cleanup"
2108        $(MAKE) \
2109                perl_clean \
2110                GDEHELP/GDEHELP.clean \
2111                HELP_SOURCE/genhelp/genhelp.clean \
2112                bin/bin.clean \
2113                libclean \
2114                objclean
2115
2116relocated: links
2117        $(MAKE) reloc_clean
2118        @echo "---------------------------------------- and remake"
2119        $(MAKE) build
2120
2121# -----------------------------------
2122# some stress tests
2123# (helpful to reveal race conditions with -j)
2124
2125rebuild4ever: rebuild
2126        $(MAKE) rebuild4ever
2127
2128build4ever: build
2129        $(MAKE) build4ever
2130
2131clean4ever: clean
2132        $(MAKE) clean4ever
2133
2134test4ever: ut
2135        $(MAKE) test4ever
2136
2137perl4ever: clean
2138        $(MAKE) links
2139        $(MAKE) perl
2140        $(MAKE) perl4ever
2141
2142help4ever: clean
2143        $(MAKE) help
2144        $(MAKE) help4ever
2145
2146# -----------------------------------
2147
2148rebuild: clean
2149        $(MAKE) all
2150
2151cleanlinked: bin/bin.clean libclean
2152
2153relink: cleanlinked
2154        $(MAKE) all
2155
2156tarfile: rebuild
2157        $(MAKE) prepare_libdir
2158        util/arb_compress
2159
2160tarfile_quick: build
2161        $(MAKE) prepare_libdir
2162        util/arb_compress
2163
2164save: sourcetarfile
2165
2166patch:
2167        SOURCE_TOOLS/arb_create_patch.sh arbPatch
2168
2169# test early whether save will work
2170savetest:
2171        @util/arb_srclst.pl >/dev/null
2172
2173testsave: savetest
2174
2175sourcetarfile: rmbak
2176        util/arb_save
2177
2178save2: rmbak
2179        util/arb_save ignore
2180
2181save_test: rmbak
2182        @echo "Testing source list.."
2183        @util/arb_srclst.pl > /dev/null
2184
2185save_test_no_error:
2186        @-$(MAKE) save_test
2187
2188inc_candi:
2189        touch SOURCE_TOOLS/inc_candi.stamp
2190        $(MAKE) do_version_update
2191
2192inc_patch:
2193        touch SOURCE_TOOLS/inc_patch.stamp
2194        $(MAKE) do_version_update
2195
2196inc_minor:
2197        touch SOURCE_TOOLS/inc_minor.stamp
2198        $(MAKE) do_version_update
2199
2200inc_major:
2201        touch SOURCE_TOOLS/inc_major.stamp
2202        $(MAKE) do_version_update
2203
2204do_version_update:
2205        @echo Incrementing version information
2206        $(MAKE) testsave
2207        $(MAKE) genheaders # auto upgrades version early
2208
2209show_version:
2210        $(MAKE) genheaders # updates version info
2211        @echo "$(SEP) ARB version info"
2212        @grep ARB_VERSION TEMPLATES/arb_build.h
2213        @echo "$(SEP)"
2214
2215release_quick:
2216        -rm arb.tgz arbsrc.tgz
2217        $(MAKE) tarfile_quick
2218        $(MAKE) sourcetarfile
2219
2220# --------------------------------------------------------------------------------
2221
2222MAKE_IF_COMMITTED=$(MAKE) -C SOURCE_TOOLS -f Makefile.commitbuild
2223
2224build_CTARGET:
2225        +$(MAKE_IF_COMMITTED) "CTARGET=$(CTARGET)" build_CTARGET
2226
2227reset_committed_build:
2228        +$(MAKE_IF_COMMITTED) reset
2229
2230# --------------------------------------------------------------------------------
2231
2232arbapplications: nt pa e4 wetc pt na nal di ph ds wetc cma
2233
2234arb_external: convert tools gde readseq tg pst xmlin
2235
2236arb_no_perl: arbapplications help arb_external
2237
2238arb: motif_xpm_hack
2239        $(MAKE) "WITHPERL=1" perl arb_no_perl
2240
2241motif_xpm_hack:
2242        $(MAKE) -r -C "lib/motifHack" all
2243
2244motif_xpm_hack_clean:
2245        $(MAKE) -r -C "lib/motifHack" clean
2246
2247# --------------------------------------------------------------------------------
2248# special targets for SOURCE_TOOLS/remake_after_change.pl
2249
2250rac_arb_dist:           di
2251rac_arb_edit4:          e4
2252rac_arb_ntree:          nt
2253rac_arb_pars:           pa
2254rac_arb_phylo:          ph
2255rac_arb_wetc:           wetc
2256rac_arb_naligner:       nal
2257rac_arb_pt_server:      pt
2258rac_arb_db_server:      ds
2259rac_arb_name_server:    na
2260rac_arb_convert_aln:    convert
2261rac_arb_treegen:        tg
2262rac_arb_rnacma:         cma
2263rac_arb_help2xml:       help
2264
2265rac_arb_a2ps:           tools
2266rac_arb_consensus_tree: tools
2267rac_arb_dnarates:       tools
2268rac_arb_export_rates:   tools
2269rac_arb_export_tree:    tools
2270rac_arb_gene_probe:     tools
2271rac_arb_message:        tools
2272rac_arb_notify:         tools
2273rac_arb_primer:         tools
2274rac_arb_probe:          tools
2275rac_arb_read_tree:      tools
2276
2277# --------------------------------------------------------------------------------
2278# unit testing
2279# @@@ work in progress
2280#
2281# goal is to automatically test all libraries/executables using TESTED_UNITS_AUTO
2282#
2283# currently not all test executables link w/o error
2284# (see UNITS_WORKING, UNITS_UNTESTABLE_ATM and UNITS_NEED_FIX)
2285
2286# define RNA3D/RNA3D.test
2287RNA3D_TEST := $(subst .a,.test,$(RNA3D_LIB))
2288
2289TESTED_UNITS_AUTO = $(ARCHS:.a=.test)
2290
2291UNITS_WORKING = \
2292        $(RNA3D_TEST) \
2293        AWTI/AWTI.test \
2294        EISPACK/EISPACK.test \
2295        GENOM/GENOM.test \
2296        GL/glAW/libglAW.test \
2297        GL/glpng/libglpng_arb.test \
2298        ISLAND_HOPPING/ISLAND_HOPPING.test \
2299        NALIGNER/NALIGNER.test \
2300        NAMES/NAMES.test \
2301        PHYLO/PHYLO.test \
2302        PRIMER_DESIGN/PRIMER_DESIGN.test \
2303        PROBE_DESIGN/PROBE_DESIGN.test \
2304        SECEDIT/SECEDIT.test \
2305        SEQ_QUALITY/SEQ_QUALITY.test \
2306        SERVERCNTRL/SERVERCNTRL.test \
2307        SL/ALIVIEW/ALIVIEW.test \
2308        SL/AP_TREE/AP_TREE.test \
2309        SL/ARB_TREE/ARB_TREE.test \
2310        SL/AW_HELIX/AW_HELIX.test \
2311        SL/AW_NAME/AW_NAME.test \
2312        SL/DB_SCANNER/DB_SCANNER.test \
2313        SL/GUI_ALIVIEW/GUI_ALIVIEW.test \
2314        SL/HELIX/HELIX.test \
2315        SL/LOCATION/LOCATION.test \
2316        SL/MATRIX/MATRIX.test \
2317        SL/REFENTRIES/REFENTRIES.test \
2318        SL/SEQUENCE/SEQUENCE.test \
2319        SL/TRANSLATE/TRANSLATE.test \
2320        SL/TREE_ADMIN/TREE_ADMIN.test \
2321        SL/TREE_WRITE/TREE_WRITE.test \
2322        STAT/STAT.test \
2323        TREEGEN/TREEGEN.test \
2324        WETC/WETC.test \
2325        XML/XML.test \
2326
2327# untestable units
2328
2329UNITS_NEED_FIX = \
2330        ptpan/PROBE.test \
2331
2332UNITS_UNTESTABLE_ATM = \
2333        XML_IMPORT/XML_IMPORT.test \
2334
2335# for the moment, put all units containing tests into UNITS_TESTED or UNITS_TESTED_FIRST
2336
2337UNITS_TESTED_FIRST = \
2338        SL/ITEM_SHADER/ITEM_SHADER.test \
2339        PROBE_SET/fb_test.test \
2340        SL/ITEMS/ITEMS.test \
2341        SL/CONSENSUS/CONSENSUS.test \
2342        DIST/DIST.test \
2343        PARSIMONY/PARSIMONY.test \
2344        EDIT4/EDIT4.test \
2345        NTREE/NTREE.test \
2346        MULTI_PROBE/MULTI_PROBE.test \
2347
2348# plain test-libaries not linked anywhere
2349TEST_SANDBOXES = \
2350        SL/CB/CB.test \
2351
2352UNITS_TESTED = \
2353        SL/NEIGHBOURJOIN/NEIGHBOURJOIN.test \
2354        SL/NDS/NDS.test \
2355        ARB_GDE/ARB_GDE.test \
2356        GENOM_IMPORT/GENOM_IMPORT.test \
2357        SL/MACROS/MACROS.test \
2358        SL/REGEXPR/REGEXPR.test \
2359        SL/FILTER/FILTER.test \
2360        ARBDB/libARBDB.test \
2361        CONSENSUS_TREE/CONSENSUS_TREE.test \
2362        TOOLS/arb_consensus_tree.test \
2363        TOOLS/arb_test.test \
2364        TOOLS/arb_probe.test \
2365        PERLTOOLS/arb_proto_2_xsub.test \
2366        AWTC/AWTC.test \
2367        SL/ALILINK/ALILINK.test \
2368        SL/TREE_READ/TREE_READ.test \
2369        DBSERVER/DBSERVER.test \
2370        AWT/libAWT.test \
2371        CORE/libCORE.test \
2372        SL/INSDEL/INSDEL.test \
2373        SL/TREEDISP/TREEDISP.test \
2374        AISC_MKPTPS/mkptypes.test \
2375        MERGE/MERGE.test \
2376        SERVERCNTRL/SERVERCNTRL.test \
2377        SL/FAST_ALIGNER/FAST_ALIGNER.test \
2378        SL/PRONUC/PRONUC.test \
2379        WINDOW/libWINDOW.test \
2380        HELP_SOURCE/arb_help2xml.test \
2381        CONVERTALN/CONVERTALN.test \
2382        SL/SEQIO/SEQIO.test \
2383        SL/PTCLEAN/PTCLEAN.test \
2384        PROBE/PROBE.test \
2385        SL/DB_QUERY/DB_QUERY.test \
2386
2387TESTED_UNITS_MANUAL = \
2388        $(TEST_SANDBOXES) \
2389        $(UNITS_TESTED_FIRST) \
2390        $(UNITS_TESTED) \
2391
2392#       $(UNITS_WORKING)
2393
2394# see UNIT_TESTER/sym2testcode.pl@disableErrorOnUnitsWithoutTests
2395
2396#TESTED_UNITS = $(TESTED_UNITS_AUTO)
2397TESTED_UNITS = $(TESTED_UNITS_MANUAL)
2398
2399# ----------------------------------------
2400
2401TEST_LOG_DIR = UNIT_TESTER/logs
2402TEST_RUN_SUITE=$(MAKE) $(NODIR) -C UNIT_TESTER -f Makefile.suite -r
2403TEST_MAKE_FLAGS=
2404TEST_POST_CLEAN=
2405ifeq ($(COVERAGE),1)
2406TEST_POST_CLEAN=$(MAKE) clean_cov
2407TEST_MAKE_FLAGS+=-j1
2408endif
2409
2410
2411%.test:
2412        -@( export ID=$$$$; mkdir -p $(TEST_LOG_DIR); \
2413        ( \
2414            echo "fake[1]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"; \
2415            $(MAKE) -C UNIT_TESTER -f Makefile.test -r \
2416                "UNITDIR=$(@D)" \
2417                "UNITLIBNAME=$(@F:.test=)" \
2418                "COVERAGE=$(COVERAGE)" \
2419                "ARB_PID=$(ARB_PID)_$(@F)" \
2420                runtest; \
2421            echo "fake[1]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"; \
2422            $(TEST_POST_CLEAN) \
2423        ) >$(TEST_LOG_DIR)/$(@F).log 2>&1; \
2424        UNIT_TESTER/log_result.pl $(TEST_LOG_DIR)/$(@F).log )
2425
2426
2427test_base: $(UNIT_TESTER_LIB:.a=.dummy) $(subst .test,.dummy,$(TEST_SANDBOXES))
2428
2429clean_cov:
2430        find . \( -name "*.gcda" -o -name "*.gcov" -o -name "*.cov" \) -exec rm {} \;
2431
2432clean_cov_all: clean_cov
2433        find . \( -name "*.gcno" \) -exec rm {} \;
2434
2435run_tests: test_base clean_cov
2436        $(MAKE) "ARB_PID=UT_$$$$" run_tests_faked_arbpid
2437
2438cleanup_faked_arbpids:
2439        @rm ~/.arb_tmp/tmp/arb_pids_${USER}_${ARB_PID}_* || true
2440
2441cleanup_faked_arbpids_and_fail: cleanup_faked_arbpids
2442        @false
2443
2444run_tests_faked_arbpid:
2445        +@$(TEST_RUN_SUITE) init
2446        @echo "fake[2]: Entering directory \`$(ARBHOME)/UNIT_TESTER'"
2447        $(MAKE) $(TEST_MAKE_FLAGS) $(NODIR) $(TESTED_UNITS) || $(MAKE) cleanup_faked_arbpids_and_fail
2448        @echo "fake[2]: Leaving directory \`$(ARBHOME)/UNIT_TESTER'"
2449        +@$(TEST_RUN_SUITE) cleanup || $(MAKE) cleanup_faked_arbpids_and_fail
2450        @$(MAKE) clean_cov >/dev/null
2451        @$(MAKE) cleanup_faked_arbpids
2452
2453ut:
2454ifeq ($(UNIT_TESTS),1)
2455        @echo $(MAKE) run_tests
2456        @$(MAKE) run_tests
2457else
2458        @echo "Not compiled with unit tests"
2459endif
2460
2461
2462aut:
2463        +@$(TEST_RUN_SUITE) unskip
2464        $(MAKE) ut
2465
2466# --------------------------------------------------------------------------------
2467
2468TIMELOG=$(ARBHOME)/arb_time.log
2469TIMEARGS=--append --output=$(TIMELOG) --format=" %E(%S+%U) %P [%C]"
2470TIMECMD=$(TIME) $(TIMEARGS)
2471
2472time_one:
2473ifeq ($(ONE_TIMED_TARGET),)
2474        @echo "Error: You have to pass ONE_TIMED_TARGET to $@"
2475        false
2476else
2477        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET)"
2478        @$(TIMECMD) $(MAKE) $(ONE_TIMED_TARGET)
2479        @echo "$(SEP) $(MAKE) $(ONE_TIMED_TARGET) [done]"
2480endif
2481
2482timed_target:
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        @cat $(TIMELOG)
2490        @rm $(TIMELOG)
2491endif
2492
2493timed_target_tested:
2494ifeq ($(TIMED_TARGET),)
2495        @echo "Error: You have to pass TIMED_TARGET to $@"
2496        false
2497else
2498        @echo "Build time:" > $(TIMELOG)
2499        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2500        $(MAKE) "ONE_TIMED_TARGET=ut" time_one
2501        @cat $(TIMELOG)
2502        @rm $(TIMELOG)
2503endif
2504
2505clean_timed_target:
2506ifeq ($(TIMED_TARGET),)
2507        @echo "Error: You have to pass TIMED_TARGET to $@"
2508        false
2509else
2510        @echo "Build time:" > $(TIMELOG)
2511        $(MAKE) "ONE_TIMED_TARGET=clean" time_one
2512        $(MAKE) "ONE_TIMED_TARGET=$(TIMED_TARGET)" time_one
2513        @cat $(TIMELOG)
2514        @rm $(TIMELOG)
2515endif
2516
2517# --------------------------------------------------------------------------------
2518
2519CHECKOUT_MODIFIED=0# set to 1 to temporarily skip test for modifications (do not check in if set to 1)
2520
2521check_svn_does_not_contain_generated:
2522ifeq ($(CHECKOUT_MODIFIED),0)
2523        @echo "Testing that build does not modify files in SVN"
2524        @test 0 = `svn status | wc -l` || ( \
2525                echo "The checkout is not/no longer clean:"; \
2526                svn status; \
2527                echo "- if this fails instantly, your checkout is not clean"; \
2528                echo "- if this fails after other targets, these targets modify checked in data"; \
2529                echo "  (a common cause may be that depends are not up to date)"; \
2530                false)
2531else
2532        grep -Hn 'CHECKOUT_MODIFIED' Makefile
2533endif
2534
2535check_svn_ignores_generated:
2536        @test 0 = `svn status | grep '^\?' | wc -l` || ( \
2537                echo "There are svn-unignored files:"; \
2538                svn status | grep '^\?'; \
2539                echo "(all generated files should be svn-ignored)"; \
2540                false)
2541
2542check_svn_state: check_svn_does_not_contain_generated
2543        $(MAKE) check_svn_ignores_generated
2544        $(MAKE) savetest
2545
2546things_that_always_should_work: depends proto
2547
2548post_commit_check:
2549        @echo "---------------------------------------- [Initial]"
2550        $(MAKE) check_svn_state
2551
2552        $(MAKE) clean
2553        @echo "---------------------------------------- [After 'make clean']"
2554        $(MAKE) check_svn_state
2555
2556        $(MAKE) things_that_always_should_work
2557        @echo "---------------------------------------- [After 'make things_that_always_should_work']"
2558        $(MAKE) check_svn_state
2559
2560        $(MAKE) all
2561        @echo "---------------------------------------- [After 'make all']"
2562        $(MAKE) check_svn_state
2563
2564        $(MAKE) things_that_always_should_work
2565        @echo "---------------------------------------- [Final]"
2566        $(MAKE) check_svn_state
2567
2568# --------------------------------------------------------------------------------
2569# sanitize arb_ntree; also works for clients (arb_edit4, ...) started from there.
2570
2571sanitize: all
2572        ( \
2573                export "LSAN_OPTIONS=max_leaks=30:suppressions=$(ARBHOME)/SOURCE_TOOLS/arb.leaksan.supp"; \
2574                echo "sake[1]: Entering directory \`$(ARBHOME)'"; \
2575                $(ARBHOME)/bin/arb_ntree --execute _logged ~/data/test.arb 2>&1 ; \
2576                echo "sake[1]: Leaving directory \`$(ARBHOME)'" \
2577        ) | $(ARBHOME)/SOURCE_TOOLS/asan2msg.pl
2578
2579# --------------------------------------------------------------------------------
2580
2581build: arb
2582        $(MAKE) binlink preplib compile_compatibility
2583
2584all:
2585        @echo "Build time" > $(TIMELOG)
2586        @echo "$(SEP) $(MAKE) build"
2587        @$(TIMECMD) $(MAKE) build
2588        @echo $(SEP)
2589        @echo "made 'all' with success."
2590        @echo "to start arb enter 'arb'"
2591ifeq ($(UNIT_TESTS),1)
2592        @echo $(MAKE) run_tests
2593        @$(TIMECMD) $(MAKE) run_tests
2594endif
2595        @echo "$(SEP) $(MAKE) build [done]"
2596ifeq ($(DEBUG),1)
2597        @$(MAKE) save_test_no_error >/dev/null # just show hints
2598endif
2599        @cat $(TIMELOG)
2600        @rm $(TIMELOG)
2601
Note: See TracBrowser for help on using the repository browser.