source: branches/profile/Makefile

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