source: branches/alilink/Makefile

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