source: branches/stable/Makefile

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