source: tags/arb-6.0/Makefile

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