#*******************************************************************************
# E.S.O. - VLT project
#
# "@(#) $Id: vltMakefile,v 1.11 2012/01/13 18:54:47 tstaig Exp $" 
#
# who       when      what
# --------  --------  ----------------------------------------------
# gfilippi  29/06/93  created
# gfilippi  19/07/93  dependency files disable for HP (c89 does not support -M)
# gfilippi  24/08/93  Solaris 2 added (CYGNUS compiler) 
# gfilippi  25/08/93  changed *PATH into *_PATH (see remark)
# gfilippi  04/11/93  te16 added (gcc version 2.4.5) 
# gfilippi  26/11/93  compiler for automatic dependencies (CCDEP) added
#                     dependency files now done available on all environment,
#                     including HP and VxWorks.
# gfilippi  26/11/93  modified documentation to include VxWork
# gfilippi  29/11/93  modified the rule to make libraries (always from scratch)
# gfilippi  29/11/93  $(AR) added
# gfilippi  29/11/93  restricted vpath for libr.&.h to ../lib and ../include
# gfilippi  29/11/93  test whether XINC and XLIB are already defined
# gfilippi  01/12/93  makeCopySources added
# gfilippi  09/12/93  vltMakefile.all added
# gfilippi  06/03/94  vltUpdateManIndex removed (see vltMan)
# gfilippi  22/04/94  set default to X11R5 & Motif1.2 as required by RTAP 6.31
# gfilippi  22/04/94  definition of CC, CFLAGS, etc. simplified
# gfilippi  26/04/94  definition of vpath moved to vltMakefile.all
# gfilippi  26/04/94  "make clean" deletes only created files (no wildcards)
# gfilippi  27/04/94  if INTROOT, "make install" create files group-writable
# gfilippi  27/04/94  EAL's comments integrated
# gfilippi  02/05/94  if required by the user, use c89 on HP (softBench)
# gfilippi  03/05/94  use $CPU for -DCPU in VxWorks compilation rule
# gfilippi  22/05/94  tcl/tk added 
# gfilippi  22/05/94  EAL-->target for executable (softbench compatibility)
# gfilippi  16/06/94  docDoManPage output files deletion added to "clean"
# gfilippi  16/06/94  protection mask 711 suppressed
# gfilippi  07/07/94  T.EBERT--> use separate rm commands in make clean
# gfilippi  07/07/94  L_PATH for VxWorks was using VLTINC instead of VLTLIB
# gfilippi  04/08/94  add logging of "make install"
# gfilippi  05/08/94  echo install target directory added
# gfilippi  07/09/94  rm -rf complains on Solaris 2 when no args are given
# gfilippi  07/09/94  makeXxxx utility renamed into vltMakeXxxx
# gfilippi  07/09/94  supports public and local manpages (SPR940176)
# gfilippi  07/09/94  supports ASCII to MIF (SPR940110)
# gfilippi  06/10/94  supports ERROR files  (SPR940145)
# gfilippi  06/10/94  ws-include file available also to lcu modules
# gfilippi  06/10/94  MAKE_VXWORKS passed to LCU compilation
# gfilippi  06/10/94  MAKE_VXWORKS passed to LCU compilation
# gfilippi  06/10/94  make output nicer as from SPR940175
# gfilippi  06/10/94  MAKEDIR added (SPR940175)
# gfilippi  06/10/94  USER_INC/LIB paths added (SPR940189)
# gfilippi  06/10/94  USER_CFLAGS  added
# gfilippi  12/10/94  "make version" added
# gfilippi  12/10/94  MAKE_VERBOSE added
# gfilippi  13/10/94  improved aesthetic
# gfilippi  23/10/94  CDT (installation) supported
# gfilippi  23/10/94  CIT (installation) supported
# gfilippi  24/10/94  clean up of ../object/vltMakeScriptDependencies.ds added
# gfilippi  24/10/94  $(platform) added to handle HP-UX, Solaris1, Solaris2
# gfilippi  24/10/94  handling of Motif and X11 for Solaris and HP
# gfilippi  24/10/94  handling of xxxError.h
# gfilippi  02/11/94  CCSliblist updated according to new CCS modules (evt,...)
# gfilippi  19/10/94  INTLIST supported
# gfilippi  03/11/94  handling of CCS & RTAP library list for Solaris and HP
# gfilippi  06/10/94  provide default value for MAKEDIR (backw. compatibility)
# gfilippi  16/10/94  use CCS global library
# gfilippi  08/12/94  clean script dependency files
# gfilippi  08/12/94  use "cp -f" to install files
# gfilippi  13/12/94  -I$(VLTINC) --> $(VLTINC)
# gfilippi  13/12/94  "cp -f" removed because not supported on Solaris2
# gfilippi  01/02/95  make clean deletes also local manpages
# gfilippi  01/02/95  Purify
# gfilippi  03/02/95  "make version" done in a different way
# gfilippi  09/02/95  vltMakeInstallErrorFiles introduced
# gfilippi  16/02/95  make test added
# gfilippi  17/02/95  default tcl shell (WISH) changed into "wish -f"
# gfilippi  17/02/95  panels added
# gfilippi  18/02/95  database files (CDF&BCF) added
# gfilippi  02/03/95  DBL_LOAD added
# gfilippi  02/03/95  vltMakeCleanDB to make clean of ../DB 
# gfilippi  04/03/95  make tcl checker customizable
# gfilippi  04/03/95  vltMakeInstallTableFiles introduced
# gfilippi  06/03/95  -lchkc added to CCS_LIBLIST_DEFAULT
# gfilippi  29/06/95  support of CCS-lite added
# gfilippi  04/07/95  LOGS added
# gfilippi  15/07/95  $(I_PATH) added to dbl files search path (SPR950228)
# gfilippi  08/08/95  TCL_*_L added to clean_all
# gfilippi  10/08/95  DBL_FLAGS_CCS added
# gfilippi  10/08/95  /usr/ccs/lib removed from here (see vltMakefile.all)
# gfilippi  07/11/95  added CPU, BINDIR, LIBDIR for VxWork code
# gfilippi  15/11/95  C_PLUS_PLUS_FLAGS added 
# gfilippi  20/11/95  ERRORS added
# gfilippi  21/11/95  do not delete *Errors.h and *Logs.h
# gfilippi  21/11/95  put log always into VLTROOT or INTROOT
# gfilippi  22/11/95  use a makefile to install
# gfilippi  08/12/95  create vltMakefile.install in /tmp
# gfilippi  16/12/95  install other files (vltMakeInstallFiles)
# gfilippi  10/01/96  avoid "string too long" install of more than 20-30 files.
# gfilippi  10/01/96  avoid "string too long" when cleaning objects
# gfilippi  27/01/96  for loops changed to reduce "string too long" possibility
# gfilippi  27/01/96  use xargs in clean man-pages to reduce "string too... 
# gfilippi  27/01/96  use for loops for manpages 
# gfilippi  27/01/96  clean TAT files
# gfilippi  28/01/96  better implementation (use of ifneq($(strip....)
# gfilippi  30/01/96  clean TAT files disabled
# gfilippi  16/04/96  no CCS_LIGHT when NOCCS is set (SPR 960157 & SPR 950501)
# gfilippi  16/04/96  make install continue even on errors
# gfilippi  29/04/96  -lm added to CCS liblist when CCSlite
# gfilippi  06/05/96  -lchkc removed from CCS_LIBLIST_DEFAULT (from JUN96 chkc is in libCCS)
# gfilippi  11/05/96  fixed $ --> \$  for HP-UX10
# gfilippi  11/05/96  defined RTAP libraries for HP-UX10
# gfilippi  11/05/96  -I- added to I_PATH
# gfilippi  11/05/96  PURECOV added
# gfilippi  11/05/96  -I. added to I_PATH
# gfilippi  22/05/96  HP-UX B.10.10 added
# gfilippi  20/09/96  use RTAP/shlib
# gfilippi  21/09/96  add /usr/local/include (now gcc does not do it by default)
# gfilippi  21/09/96  default changed to Optimized code
# gfilippi  21/09/96  HP-9, c89, Solaris1 phased out
# gfilippi  24/09/96  added W flags as suggested by RKA/GCH
# gfilippi  24/09/96  default -g -DDEBUG -O
# gfilippi  24/09/96  commented out W flags as suggested by RKA/GCH
# gfilippi  15/10/96  default -g -DDEBUG for VxWorks
# gfilippi  15/10/96  OPTIMIZE 0 1 2 3 ...9
# gfilippi  15/10/96  on HP-UX  LD = ld +s +b :   
# gfilippi  23/10/96  still support HP-9 for CCSlite
# gfilippi  23/10/96  OPTIMIZE 0 corrected to -O0 (oh zero)
# gfilippi  29/10/96  NOSHARED added
# gfilippi  27/02/97  HP10.20 supported (for preliminary release to DMD)
# gfilippi  10/04/97  HP-9.x and SunOS-2.3 removed
# gfilippi  10/04/97  separate INC and LIB for GNU and TCLTK
# gfilippi  10/04/97  SPR970010: added options to better purify C++ code
# gfilippi  10/04/97  SPR970077: DBL as target directory for dbl file installation
# gfilippi  10/04/97  -fPIC added to CC_FLAGS to support shared libraries
# gfilippi  10/04/97  support shared libraries (.so or .sl and .dal) in clean and install
# gfilippi  16/04/97  RTAP_NOX11 added (EAL request)
# gfilippi  19/04/97  made SHLIB_EXT available to external (EAL request)
# gfilippi  19/04/97  fixed purify options, PURIFY_COLLECTOR added
# gfilippi  23/04/97  added -lsocked for CCSlite on SUN
# gfilippi  06/05/97  added DFLOW_ROOT
# gfilippi  19/05/97  SPR960448: clean checks existence of ../doc, ../man/man<x> 
# gfilippi  29/07/97  use WIND_BASE, changed cc68k flags for TORNADO
# gfilippi  08/08/97  SunOS-2.5.1 added
# gfilippi  18/07/97  use VXROOT to support both old and new VxWorks
# gfilippi  29/10/97  PowerPC added as supported CPU for VxWorks
# gfilippi  23/11/97  CppFiles target added (SPR 950609)
# gfilippi  23/11/97  HP-UX B.10.10 dismissed
# gfilippi  30/06/98  new CCSlite (from tebert mail)
# gfilippi  09/07/98  CCS_LIBLIST_DEFAULT removed
# gfilippi  13/07/98  qsemuLib removed (as it was removed from qsemu 3.0)
# gfilippi  22/07/98  -lcma added for HP .AND. CCSlite case
# fcarbogn  23/09/98  clean tat generated files
# gfilippi  24/01/99  SPR9900034 -Xlinker +vnocompatwarnings added for HP-UX
# gfilippi  24/01/99  SPR9900035 NOT_Y2K environment variable supported
# gfilippi  27/02/99  Ignore externally defined VX_CPU_FAMILY, use only CPU
# gfilippi  27/02/99  MC68000 added
# gfilippi  27/02/99  quit with error if CPU is not a supported type
# gfilippi  03/03/99  override external VX_CPU_FAMILY based on CPU
# eallaert 1999-03-16 added Linux (for the aficionados)
# wpirani  1999-04-01 added test case for Solaris 2.6
# rschmutz 1999-04-03 added RedHat 5.2 support, some $ECHO back to echo.
# gfilippi 1999-05-26 gcc 2.8.1 HP-UX: -w (no warnings for the moment)
# gfilippi 1999-05-26 gcc 2.8.1 HP-UX: -D_HPUX_SOURCE -D_HIUX_SOURCE added
# gfilippi  23/06/99  ALARMS, vltMakeInstallAlarmFiles added (SPR 990257)
# gfilippi  14/07/99  use /tmp/vltMake_$$_<username> as temporary file
# gfilippi  14/07/99  remove /tmp/vltMake_$$_<username> before using it
# gfilippi  22/07/99  SPR9900035 NOT_Y2K environment variable removed
# psivera   02/08/99  enable warnings (CC_FLAGS = -Wall)
# psivera   09/08/99  change the option "collector" to use the system loader
# psivera   14/08/99  add the option "-fpermissive" to C_PLUS_PLUS_FLAGS to 
#                     avoid g++ errors when types are missing
# psivera   21/08/99  $(DFLOW_ROOT)/include/rtd and $(DFLOW_ROOT)/include/cat added
# psivera   26/08/99  statements (CXX, NM, C_PLUS_PLUS_FLAGS) added to support C++ on LCU
# psivera   09/09/99  /usr/include/X11R5 and /usr/lib/X11R5 eliminated from definition of 
#                     XINC_DEFAULT and XLIB_DEFAULT for HP-UX
# rschmutz  30/09/99  INS_ROOT_FILES, INS_ROOT_DIR rules added (SPR 990346).
# psivera   05/10/99  added link to mathematic libraries for linux platform
# psivera   07/10/99  added some other warning flags, if MAKE_NO_WARNS is not defined
# psivera   12/10/99  changed the variable name from MAKE_NO_WARNS to MAKE_NO_WARNINGS
# psivera   19/10/99  removed two warning flags: Wconversion and Wsign-compare
# psivera   29/11/99  removed warning flag Wstrict-prototypes from LCU code compilation
# psivera   30/11/99  removed all warning flags for the external distribution
# psivera   30/11/99  turned all warning flags on for the internal distribution
# eallaert  2000-01-11  tuned default warning flags; added MAKE_ALL_WARNINGS
# eallaert  2000-01-12  removed -Wconversion from default warning flags;
# psivera   03/02/00  added CPU flag -mlongcall for PPC only.
# psivera   10/04/00  ported to HPUX-11
# psivera   07/05/00  added automatic removal of core, #*, .so, .d, .dx, .dxt,
#                     .ds, .sl, .da, .gdb_history files (SPR 00990048)
# psivera   16/05/00  removed -lcma for HP11 .AND. CCSlite 
# psivera   17/05/00  added CC_FLAGS: -D_XOPEN_SOURCE_EXTENDED -fno-builtin (HP11)
# psivera   28/05/00  PURIFY can be run with OPTIMIZATION (SPR 00990338)
#                     removed NOOPTIMIZE flag
# psivera   03/07/00  removed DFLOW_ROOT check 
# almamgr 2000-07-25 IDL files management addedd
# psivera   28/09/00  added include/rtd and include/cat to the TOOLS_INC variable
# psivera   11/01/01  changed egcs into gcc for linux (SPR 20010030)
# psivera   02/02/01  implemented conversion manpages/txt; updated clean target
# psivera   03/02/01  added clean_dist target (SPR 20000291)
# psivera   06/02/01  added MAN2TXT environment variable
# psivera   08/02/01  added cleaning of *~ files in clean_dist
# psivera   16/02/01  removed longcall option for PPC-Linux
# psivera   01/03/01  added MAN2TXT documentation to the man page
# psivera   01/03/09  removed ../src in order to make cpp files in test dir also
# psivera   22/05/01  for Linux: CC, CXX and CCDEP are all used without -ansi option
# psivera   01/06/22  for Linux: -ansi option restored if ACSROOT is NOT defined. 
# psivera   01/07/05  changed clean_links and do_links to rm_links and make_links
# psivera   16/09/01  removed obsolete purify option: ignore-unknown-subspaces
# psivera   22/01/02  SPR 20010715: tplMakefile included
#	              ported to Solaris 8
# psivera   28/01/02  tplMakefile included only if one of the INS variables is defined
# psivera   25/02/02  restored removal of temporary makefile under /tmp
# mzampare  2002-03-04 fixed bug with timestamps in clean and install idl
# mzampare  2002-03-05 fixed bug: timestamps were not removed in make clean
# mzampare  2002-03-12 more exact tests (-f instead of -e)
# psivera   2002-06-09 restored install_all target 
# psivera   2002-06-18 added -lnsl for CCSLite also in CCS_LIBLIST (for Solaris)
# psivera   2002-07-08 Porting to GCC 3.1: removed the default include: /usr/local/include
# psivera   2002-07-18 changed the standard from ansi to gnu99 for Solaris/ws only
# psivera   2002-07-19 On Solaris: gnu99 is used for C only, ansi for C++
# psivera   2002-07-22 CCDEP uses ansi for all platforms
# psivera   2002-07-31 introduced GEN_LIBLIST variable: list of lib that have always
#                      to be linked for Solaris platform only (at the moment)
# psivera   2002-08-20 fixed bug in installing java files
# psivera   2002-08-22 changed target install_all from: 
#	install_all : $(INSTALL_TARGET)
#                                              to:
#	$(INSTALL_TARGET) install_all :
#                      to make the install_includes target work.
# psivera   2002-09-03 moved the install_java bit from javaMakefile to vltMakefile
# psivera   2002-10-16 removed ansi flag for compilation on SUN
# psivera   2003-01-02 some man pages editing
# 
#*******************************************************************************
#   NAME
#   vltMakefile - system wide make definitions for VLT SW
# 
#   DESCRIPTION
#   
#   vltMakefile sets common definitions that are valid for the whole 
#   VLT software. It also finds out on which platform and which operating system
#   the software is being built on and sets variables accordingly.
#   In addition, vltMakefile provides a set of activities normally required 
#   by every module (generation of automatic dependencies, clean, man pages,
#   install). The scope of such standard actions is controlled by the
#   calling Makefile via a set of variables (see Makefile for more).
#
#   This file shall be included by each Makefile used to build any piece
#   of the VLT software.
#
#   The variables set by vltMakefile depends on the value of some
#   shell-environment variables (see ENVIRONMENT) and on the operating 
#   system (type and version). Make defaults can apply as well.
#
#   By default vltMakefile works for UNIX files. If the make variable
#   MAKE_VXWORKS is defined, vltMakefile works to produce VxWorks applications.
#   
#   In detail, it provides the definition of the following variables:
#
#   SHELL     the shell used to interpret the commands
#             RULE: /bin/sh   (force Bourne shell)
#
#   CC        compiler to be used
#
#   CFLAGS    compilation flags
#             RULE: a basic default is provided and, if needed, modified 
#                   according to os/version:
#
#                   - UNIX (both HP and SUN): 
#                       
#                     CC     = gcc -ansi
#                     CFLAGS = -Wall $(OPTIONS) 
#
#                    - VxWorks (CPU= MC68000|MC68040|PPC604):
#                         CPU     VX_CPU_FAMILY  CPU_CFLAGS
#                         MC68000       68k      -DCPU=MC68000 -m68000  
#                         MC68040       68k      -DCPU=MC68040  
#                         PPC604        ppc      -DCPU=PPC604  
#
#                      CC     = cc$(VX_CPU_FAMILY) -ansi -fno-builtin -nostdinc
#                      CFLAGS = $(CPU_CFLAGS) -Wall $(OPTIONS) 
#                                             
#             For both, the compilation options controlling optimization
#             and debugging information generation are generated as follows:    
#
#                                                   $(OPTIONS) 
#                  
#                     default    UNIX:           -O    -g -DDEBUG
#                             VxWorks:                 -g -DDEBUG
#
#                          DEBUG='on'                  -g -DDEBUG
#
#     
#                          OPTIMIZE='on'         -O                 
#
#                          OPTIMIZE=<n>          -O<n>              
#                             <n>=[0|1|..|9]
#
#             If more than one variable are defined, the precedence is:
#             DEBUG, OPTIMIZE
#
#             If defined, USER_CFLAGS are added to CFLAGS.
#
#     To turn off debug and optimization just define (from command line or
#     in the Makefile or in your environment):
#     OPTIMIZE=0
#     (This is equivalent to OPTIMIZE=O0)
#     To turn off debug only and use your preferred OPTIMIZATION levels define:
#     OPTIMIZE=number  where number is in the range 1-3
#
#   C_PLUS_PLUS_FLAGS  C++ compilation flags
#   CCDEP     compiler used to extract automatic dependencies (gcc -MM -ansi)
#
#   VLTINC    VLT includes  (integration area, if defined, and then root)
#   VLTLIB    VLT libraries (integration area, if defined, and then root)
#   RTINC     rtap includes
#   RTLIB     rtap libraries
#   XINC      X11  includes  (defined as required by RTAP) 
#   XLIB      X11  libraries (defined as required by RTAP)
#   VXINC     VxWorks includes
#   VXLIB     VxWorks libraries
#             RULE: use os/version/machine depending values, or
#                   empty otherwise.
#
#   I_PATH    complete search path for include files
#   L_PATH    complete search path for libraries 
#             Each variable is build as an ordered list od directory 
#             prefixed by -I or -L and followed by /include or ../lib (or LIBDIR)
#             as appropriate. The directory used are:
#
#               - for UNIX applications:
#                   - the current module (..) 
#                   - user defined (USER_INC or USER_LIB).
#                   - the integration (INTROOT)
#                   - the additional integration areas (INTLIST)
#                   - VLT root
#                   - rtap     (RTINC or RTLIB)
#                   - X11      (XINC  or XLIB)
#
#               - for VxWorks applications:
#                   - the current module (..) 
#                   - if exists, the ws-part of the module (../../ws) 
#                   - user defined (USER_INC or USER_LIB).        (*)
#                   - the integration (INTROOT/vw)                (*)
#                   - the additional integration areas (INTLIST)  (*)
#                   - VLT root (VLTROOT/vw) 
#                   - VxWorks  (VXINC or VXLIB)
#                (*) includes are searched in both the "vw/include/" 
#                    and "include/" directories
#
#   RTAP_FLAGS platform dependend library list to link RTAP
#
#   CCS_LIBLIST ordered list of CCS libraries
#
#   AR        archive maintaining program
#
#   SHLIB_EXT extention for shared libraries: "sl" on HP, "so" for Sun
#
#   RANLIB    program to update Archive Symbol Directory (__.SYMDEF)
#
#   RM        shell commands to delete files or directory (rm -rf)
#
#   WISH      default tcl/tk shell (wish -f)
#
#   TCL_CHECKER default syntax checker for tcl/tk files (tclCheck)
#
#   LASTCHANGE the version identifier to label man pages
#             RULE: "MODVERSION d/m/y-H:M" if MODVERSION shell-variable defined,
#                   "development d/m/y-H:M" otherwise
#
#   VLTTOP    prefix directory for "install" operations
#             RULE: set to either INTROOT(/vw) or VLTROOT(/vw), if defined,
#                   left undefined otherwise.
#   INSTALL_ROOT  set to either INTROOT or VLTROOTif
#   INCLUDE   target directory for installing .h files    $(VLTTOP)/include
#   BINDIR    binary directory: bin for WSs, bin/$CPU for LCUs
#   BIN       target directory for installing bin files   $(VLTTOP)/$(BINDIR)
#   LIBDIR    library directory: lib for WSs, lib/$CPU for LCUs
#   LIB       target directory for installing bin files   $(VLTTOP)/$(LIBDIR)
#   MAN       target directory for installing man files   $(VLTTOP)/man
#   ALARMS    target directory for installing ALARM files $(*)/ALARMS
#   ERRORS    target directory for installing ERROR files $(*)/ERRORS
#   LOGS      target directory for installing LOG   files $(*)/LOGS
#   DBL       target directory for installing dbl   files $(*)/dbl
#              (*) is VLTTOP without /vw because these files are 
#                  valid only at workstation level
#
# 
#     REMARK: if you do not like the value provided either by vltMakefile
#             or by make itself, you can still override each variable using
#             the assignement at command line level:
#
#             Example:      make CC='cc' CFLAGS='-g' 
#
#   FILE
#   VLTROOT/include/vltMakefile
#             VLT wide definitions for UNIX or VxWorks
#
#   VLTROOT/include/vltMakefile.all 
#   (or MAKEDIR/vltMakefile.all)
#             auxiliary file dealing with do_all
#
#   VLTROOT/include/Makefile.template   
#             template for the preparation of module-Makefile
#
#   <module>/src/Makefile  
#   <module>/test/Makefile   
#             local make file, shall include vltMakefile(.VxWorks)
#
#   
#   ENVIRONMENT  
#   The following variables, if defined either in the environment or by the
#   calling Makefile, can control vltMakefile 
#
#     GNU_ROOT     where to look for GNU stuff. NO DEFAULT!
#     TCLTK_ROOT   where to look for TCL/TK stuff. NO DEFAULT!
#     DFLOW_ROOT   where to look for Data Flow stuff. NO DEFAULT!
#     MAKEDIR      where to look for the vltMakefile.all
#                  default: $(VLTROOT)/include/vltMakefile.all
#     MAKE_VERBOSE if defined all commands are printed, by default only the
#                  relevant (compilation) ones are printed
#     MAKE_NOSHARED if defined, shared libraries are not used. The actual
#                  behaviour is platform dependent.
#     CC           if defined can force the usage of a specific compiler.
#     CPU          (mandatory for LCU) cpu type
#     MAKE_PURIFY  if defined executable are created in a Purify'd way
#     MAKE_PURECOV if defined executable are instrumented for test coverage
#     MAKE_ALL_WARNINGS if defined all compiler warnings are activated
#     MAN2TXT      if this flag is "on" the conversion of all the man pages
#                  to correspondifng txt files is performed. 
#                  The output files are put under the directory doc of the
#                  module and have the extension ".txt"
#     VLTROOT      VLT Software root directory
#     INTROOT      Current Integration area. If defined, it becomes the target 
#                  directory for "install" operation
#     INTLIST      ":"-separeted list of Auxiliary Integration areas. If defined, 
#                  are used to build include and lib search paths.
#                  Used ONLY if INTROOT is defined!
#     USER_CFLAGS  list of additional C compilation flags
#     USER_INC     list of additional include files  (formated as  -I<dir> ... )
#     USER_LIB     list of additional libraries      (formated as  -L<dir> ...)
#     XINC         X11 includes  
#     XLIB         X11 libraries
#     RTAPROOT     root directory for HP-RTAP product
#     WIND_BASE    root directory for WINDRIVER VxWorks TORNADO product 
#     MODVERSION   version identification
#
#   CAUTION
#   - The variables defined by vltMakefile should not be redefined inside 
#     a Makefile. If you need to do that, clearly comment the rational behind.
#   - Because of SPR 20010715, the vltMakefile includes now the tplMakefile. 
#     The vltMakefile(.all) *AND* the tplMakefile are found by default in the directory
#     $MAKEDIR. If the user changes the default location of, f. i., the 
#     vltMakfile.all and needs to use the tpl stuff also, he has to remember 
#     to put in the same location the tplMakefile.
#   - To make the make process valid for every type of VLTROOT, if the tplMakefile 
#     is not found, no warnings/errors are issued.
#
#   EXAMPLES
#
#   SEE ALSO
#   Makefile, (GNU) make
#
#   GNU make - Edition 0.41, for make Version 3.64 Beta, April 93
#   VLT Software - Programming Standard - 1.0 10/03/93
#   VxWorks documentation 
#
#   BUGS
#------------------------------------------------------------------------

#
# vltMakefile.all requires all make-variables being accesible 
# to sub-make (see GNU make, p.60)
#
export

#
# set auxiliary variables according to the verbose flag
#    AT      is used to prefix commands
#    OUTPUT  is where the output is redirected 
#
ifdef MAKE_VERBOSE
    AT = 
    OUTPUT =
else
    AT = @
    OUTPUT = > /dev/null
endif

#
# force Bourne shell as the shell used to interpret the commands
SHELL = /bin/bash 

##################################################################
# machine-specific stuff, special options and syntax differences #
##################################################################
#
# figure out the current platform.
# 
os     = $(shell uname)
osrev  = $(shell uname -r)

ifeq ($(os),HP-UX)
    ifeq ($(osrev),B.10.20)
        platform = HP-10
    endif
    ifeq ($(osrev),B.11.00)
        platform = HP-11
    endif
endif

ifeq ($(os),SunOS)
    ifeq ($(osrev),5.4)
        platform = Sun-Solaris2
    endif  
    ifeq ($(osrev),5.5)
        platform = Sun-Solaris2
    endif  
    ifeq ($(osrev),5.5.1)
        platform = Sun-Solaris2
    endif  
    ifeq ($(osrev),5.6)
        platform = Sun-Solaris2
    endif
    ifeq ($(osrev),5.8)
        platform = Sun-Solaris2
    endif
endif

# Added by E. Allaert: Linux case; remark Linux uses Gnu-echo
ifeq ($(os),Linux)
   platform = Linux
   ECHO = echo -e
else ifeq ($(os),$(CYGWIN_VER))
   platform = Cygwin
   osrev = 1.7.9
   ECHO = echo -e
else
   ECHO = echo
endif

ifndef platform
    #
    # force a syntax error, so that vltMake stops on a
    UNSUPPORTED platform
endif

ifndef GNU_ROOT
    #
    # force a syntax error, so that vltMake stops 
    GNU_ROOT must be defined
endif

ifndef TCLTK_ROOT
    #
    # force a syntax error, so that vltMake stops 
    TCLTK_ROOT must be defined
endif


# define WS or LCU related variables

ifndef MAKE_VXWORKS

    #
    # define UNIX environment   
    CCDEP   = gcc -MM -ansi
    LD      = ld
    AR      = ar
    RANLIB  = ranlib

    # set flags for NOCCS and CCSlite
    ifdef NOCCS
        CCS_CFLAGS = -DNOCCS
    else
        ifndef RTAPROOT
            CCS_CFLAGS = -DCCS_LIGHT
        endif
    endif
    
    # gcc flags
    # RSC: CXX added to differentiate between C and C++ compilers
    #
    ifeq ($(platform),Sun-Solaris2)
        CC         = gcc 
        CXX        = gcc 
    else
        CC         = gcc -ansi
        CXX        = gcc -ansi
    endif
    
    #
    # default flags are all warning enabled and Position Independent Code
    # for shared libraries
    
    #
    # for the time being, NO WARNINGS!!!!
    #CC_FLAGS   = -w
#    ifndef MAKE_NO_WARNINGS
#      CC_FLAGS   = -Wall                  \
#                   -Wundef                \
#                   -W                     \
#                   -Wno-unused            \
#                   -Wpointer-arith        \
#                   -Wwrite-strings        \
#                   -Wstrict-prototypes    \
#                   -Wmissing-prototypes   \
#                   -Wmissing-declarations
#    else
#      CC_FLAGS   = -Wall
#    endif

    CC_FLAGS   = -Wall

    # all warnings left out for the default (see above) must be added here
    ifdef MAKE_ALL_WARNINGS
	CC_FLAGS   := $(CC_FLAGS) -Wshadow     \
                        -Wcast-qual            \
                        -Wcast-align           \
                        -Wundef                \
                        -W                     \
                        -Wno-unused            \
                        -Wpointer-arith        \
                        -Wwrite-strings        \
                        -Wstrict-prototypes    \
                        -Wmissing-prototypes   \
                        -Wmissing-declarations
    endif

    CC_FLAGS   := $(CC_FLAGS) -fPIC
    C_PLUS_PLUS_FLAGS = -fno-operator-names -fpermissive

    ifeq ($(platform),HP-10)
        #
        # between 2.7.2.2 and 2.8.1, the way gcc is generated
        # has been modified. Before the  -D_HPUX_SOURCE was
        # added automatically, now it is only when -ansi
        # is NOT specified (see /vlt/gnu/lib/gcc-lib/hppa*/2.*/spec)
        # The flags are now added explicitely!
        CC_FLAGS   := $(CC_FLAGS) -D_HPUX_SOURCE -D_HIUX_SOURCE

        #
        # use SHLIB_PATH 
        LD            = $(CC) -Xlinker +s  -Xlinker +b  -Xlinker :
       
        # SPR 9900034 - begin
        # in the last upgrade of HP-UX, some features have been
        # declared obsolescent (may be not supported in future releases)
        # At a first glance, it does not seem to be trivial to fix
        # the problem, therefore I suppress the warning for the time being. 
        # This should be removed after that the problem is solved
        LD            := $(LD) -Xlinker +vnocompatwarnings 
        # SPR 9900034 - end

        NOSHARED_ON   =  -Xlinker -a -Xlinker archive 
        NOSHARED_OFF  =  -Xlinker -a -Xlinker default 
        SHLIB_EXT     = sl
        RANLIB        = @/bin/true
	# Porting to gcc 3.1: this include is obsolete
        #INC_DEFAULT   = -I/usr/local/include
        LIB_DEFAULT   = -L/usr/local/lib
        XINC_DEFAULT  = -I/usr/include/Motif1.2  
        XLIB_DEFAULT  = -L/usr/lib/Motif1.2         
        # Rtap 06.70
        ifdef RTAPROOT
            CCS_LIBLIST           =                -lCCS
            CCS_LIBLIST_NOSHARED  = $(NOSHARED_ON) -lCCS $(NOSHARED_OFF)
            RTAP_FLAGS                = -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools -lXm -lXt -lX11 -lm -lc /usr/lib/libdld.sl 
            RTAP_FLAGS_NOSHARED       = -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools -lXm -lXt -lX11 -lm -lc /usr/lib/libdld.sl 
            RTAP_NOX11_FLAGS          = -lrtapPlus -lrtap -lrtapLic            -lcrTools                 -lm -lc /usr/lib/libdld.sl 
            RTAP_NOX11_FLAGS_NOSHARED = -lrtapPlus -lrtap -lrtapLic            -lcrTools                 -lm -lc /usr/lib/libdld.sl 
            RTINC_DEFAULT = -I$(CRTOOLS_ROOT)/include -I$(RTAPROOT)/include 
            RTLIB_DEFAULT = -L$(RTAPROOT)/shlib -L$(RTAPROOT)/lib -L$(CRTOOLS_ROOT)/shlib 
        else
            CCS_LIBLIST          :=                -lCCS                 -lcma -lm -lc
            CCS_LIBLIST_NOSHARED := $(NOSHARED_ON) -lCCS $(NOSHARED_OFF) -lcma -lm -lc
        endif
        ifeq ($(osrev),B.10.20)
            PURIFY_COLLECTOR=$(GNU_ROOT)/lib/gcc-lib/hppa1.1-hp-hpux10.20/2.7.2.2/ld
        endif
    endif


    ifeq ($(platform),HP-11)
        #
        # between 2.7.2.2 and 2.8.1, the way gcc is generated
        # has been modified. Before the  -D_HPUX_SOURCE was
        # added automatically, now it is only when -ansi
        # is NOT specified (see /vlt/gnu/lib/gcc-lib/hppa*/2.*/spec)
        # The flags are now added explicitely!
        CC_FLAGS   := $(CC_FLAGS) -D_HPUX_SOURCE -D_HIUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -fno-builtin

        #
        # use SHLIB_PATH 
        LD            = $(CC) -Xlinker +s  -Xlinker +b  -Xlinker :
       
        # SPR 9900034 - begin
        # in the last upgrade of HP-UX, some features have been
        # declared obsolescent (may be not supported in future releases)
        # At a first glance, it does not seem to be trivial to fix
        # the problem, therefore I suppress the warning for the time being. 
        # This should be removed after that the problem is solved
        LD            := $(LD) -Xlinker +vnocompatwarnings 
        # SPR 9900034 - end

        NOSHARED_ON   =  -Xlinker -a -Xlinker archive 
        NOSHARED_OFF  =  -Xlinker -a -Xlinker default 
        SHLIB_EXT     = sl
        RANLIB        = @/bin/true
        RANLIB        = @/bin/true
        # Porting to gcc 3.1: this include is obsolete
        # INC_DEFAULT   = -I/usr/local/include
        LIB_DEFAULT   = -L/usr/local/lib
        XINC_DEFAULT  = -I/usr/include/Motif2.1  
        XLIB_DEFAULT  = -L/usr/lib/Motif2.1         
        # Rtap 06.70
        ifdef RTAPROOT
            CCS_LIBLIST           =                -lCCS
            CCS_LIBLIST_NOSHARED  = $(NOSHARED_ON) -lCCS $(NOSHARED_OFF)
            RTAP_FLAGS                = -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools -lXm -lXt -lX11 -lm -lc /usr/lib/libdld.sl 
            RTAP_FLAGS_NOSHARED       = -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools -lXm -lXt -lX11 -lm -lc /usr/lib/libdld.sl 
            RTAP_NOX11_FLAGS          = -lrtapPlus -lrtap -lrtapLic            -lcrTools                 -lm -lc /usr/lib/libdld.sl 
            RTAP_NOX11_FLAGS_NOSHARED = -lrtapPlus -lrtap -lrtapLic            -lcrTools                 -lm -lc /usr/lib/libdld.sl 
            RTINC_DEFAULT = -I$(CRTOOLS_ROOT)/include -I$(RTAPROOT)/include 
            RTLIB_DEFAULT = -L$(RTAPROOT)/shlib -L$(RTAPROOT)/lib -L$(CRTOOLS_ROOT)/shlib 
        else
            CCS_LIBLIST          :=                -lCCS                 -lm -lc
            CCS_LIBLIST_NOSHARED := $(NOSHARED_ON) -lCCS $(NOSHARED_OFF) -lm -lc
        endif
        ifeq ($(osrev),B.11.00)
            PURIFY_COLLECTOR=/usr/bin/ld
        endif
    endif

    ifeq ($(platform),Sun-Solaris2)
        LD            = $(CC)
        NOSHARED_ON   = -Xlinker -Bstatic 
        NOSHARED_OFF  = -Xlinker -Bdynamic
        SHLIB_EXT     = so
        RANLIB        = @/bin/true 
        RANLIB        = @/bin/true
        # Porting to gcc 3.1: this include is obsolete
        # INC_DEFAULT   = -I/usr/local/include
        GEN_LIBLIST           =                -lsocket -lnsl
        GEN_LIBLIST_NOSHARED  =                -lsocket -lnsl
        LIB_DEFAULT   = -L/usr/local/lib
        XINC_DEFAULT  = -I/opt/SUNWmotif/include -I/usr/openwin/include 
        XLIB_DEFAULT  = -L/opt/SUNWmotif/lib     -L/usr/openwin/lib     
        # Rtap 06.60
        ifdef RTAPROOT
            CCS_LIBLIST          =                -lCCS 
            CCS_LIBLIST_NOSHARED = $(NOSHARED_ON) -lCCS $(NOSHARED_OFF)
            # also the Rtap libraries are treated as archive, to solve problem like for msgServer1, except for X, where Xm is available only as a ".so"
            RTAP_FLAGS                =                -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools                 -lXm -lXt -lX11 -lgen -lelf -lm
            RTAP_FLAGS_NOSHARED       = $(NOSHARED_ON) -lrtapPlus -lrtap -lrtapLic -lStarlite -lcrTools $(NOSHARED_OFF) -lXm -lXt -lX11 -lgen -lelf -lm
            RTAP_NOX11_FLAGS          =                -lrtapPlus -lrtap -lrtapLic            -lcrTools                                 -lgen -lelf -lm
            RTAP_NOX11_FLAGS_NOSHARED = $(NOSHARED_ON) -lrtapPlus -lrtap -lrtapLic            -lcrTools $(NOSHARED_OFF)                 -lgen -lelf -lm
            RTINC_DEFAULT = -I$(RTAPROOT)/include
            RTLIB_DEFAULT = -L$(RTAPROOT)/lib 
        else
            CCS_LIBLIST          =                -lCCS                 -lm -lposix4
            CCS_LIBLIST_NOSHARED = $(NOSHARED_ON) -lCCS $(NOSHARED_OFF) -lm -lposix4
        endif
        ifeq ($(osrev),5.4)
            PURIFY_COLLECTOR=$(GNU_ROOT)/lib/gcc-lib/sparc-sun-solaris2.4/2.7.2.2/ld
        endif  
        ifeq ($(osrev),5.5)
            PURIFY_COLLECTOR=$(GNU_ROOT)/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.2/ld
        endif
        # for the time being, Sun 2.5.1 uses same binaries as 2.5
        ifeq ($(osrev),5.5.1)
            PURIFY_COLLECTOR=$(GNU_ROOT)/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2.2/ld
        endif
    endif

    # Linux-case added by E. Allaert
    # RSC: adapted to RedHat 5.2: use egcs C++ compiler
    # RSC: use ranlib, CCS_LIBLIST* = -lCCS.
    ifeq ($(platform),Linux)
        # WARNING GCH: Commented out -ansi option for c++, gcc and CCDEP. Problems with ACE/TAO
        # CXX           = c++ -ansi
	# remark from PSI: for the time being, the -ansi option is restored 
	# when ACSROOT is not defined. 
	ifndef ACSROOT 
            CC            = gcc -ansi
	    CCDEP         = gcc -MM -ansi
            CXX           = c++ -ansi
	else
            CC            = gcc
	    CCDEP         = gcc -MM
            CXX           = c++
	endif
        LD            = gcc
        NOSHARED_ON   = -Xlinker -Bstatic 
        NOSHARED_OFF  = -Xlinker -Bdynamic
        SHLIB_EXT     = so
        RANLIB        = ranlib
        RANLIB        = @/bin/true
        # Porting to gcc 3.1: this include is obsolete
        # INC_DEFAULT   = -I/usr/local/include
        LIB_DEFAULT   = -L/usr/local/lib
        XINC_DEFAULT  = -I/usr/X11R6/include/X11 
        XLIB_DEFAULT  = -L/usr/X11R6/lib     
        CCS_LIBLIST          :=                -lCCS                 -lm 
        CCS_LIBLIST_NOSHARED := $(NOSHARED_ON) -lCCS $(NOSHARED_OFF) -lm 
    endif

    ifeq ($(platform),Cygwin)
        # WARNING GCH: Commented out -ansi option for c++, gcc and CCDEP. Problems with ACE/TAO
        # CXX           = c++ -ansi
        # remark from PSI: for the time being, the -ansi option is restored
        # when ACSROOT is not defined.
        ifndef ACSROOT
            CC            = gcc -ansi
            CCDEP         = gcc -MM -ansi
            CXX           = g++ -ansi
        else
            CC            = gcc
            CCDEP         = gcc -MM
            CXX           = g++
        endif
        LD            = g++
        NOSHARED_ON   = -Xlinker -Bstatic
        NOSHARED_OFF  = -Xlinker -Bdynamic
        SHLIB_EXT     = dll
        RANLIB        = ranlib
        RANLIB        = @/bin/true
        # Porting to gcc 3.1: this include is obsolete
        # INC_DEFAULT   = -I/usr/local/include
        LIB_DEFAULT   = -L/usr/local/lib
        XINC_DEFAULT  = -I/usr/X11R6/include/X11
        XLIB_DEFAULT  = -L/usr/X11R6/lib
        CCS_LIBLIST          :=                -lCCS                 -lm
        CCS_LIBLIST_NOSHARED := $(NOSHARED_ON) -lCCS $(NOSHARED_OFF) -lm
        .LIBPATTERNS = lib%.dll lib%.dll.a lib%.a
    endif

    BINDIR   = bin
    LIBDIR   = lib

else
   
    #
    # CPU must be one of the supported types:
    ifeq ($(CPU),MC68000)
        VX_CPU_FAMILY = 68k
        CPU_CFLAGS = -DCPU=$(CPU) -m68000
    endif
    ifeq ($(CPU),MC68040)
        VX_CPU_FAMILY = 68k
        CPU_CFLAGS = -DCPU=$(CPU)
    endif
    ifeq ($(CPU),PPC604)
        VX_CPU_FAMILY = ppc
        CPU_CFLAGS = -DCPU=$(CPU) -mlongcall
        ifeq ($(platform),Linux)
                CPU_CFLAGS = -DCPU=$(CPU)
        endif
    endif

    ifndef VX_CPU_FAMILY
        #
        # force a syntax error, so that vltMake stops on a
        UNSUPPORTED CPU type
    endif

    #
    # GNU-VXWORKS environment
    CC       = cc$(VX_CPU_FAMILY) -ansi -fno-builtin -nostdinc
    CXX      = cc$(VX_CPU_FAMILY) -ansi -fno-builtin -nostdinc
    CCDEP    = cc$(VX_CPU_FAMILY) -MM -ansi -fno-builtin -nostdinc
#    ifndef MAKE_NO_WARNINGS
#      CC_FLAGS = $(CPU_CFLAGS) -DMAKE_VXWORKS \
#                       -Wall                  \
#                       -W                     \
#                       -Wno-unused            \
#                       -Wpointer-arith        \
#                       -Wwrite-strings        \
#                       -Wmissing-prototypes   \
#                       -Wmissing-declarations \
#                       -c
#    else
#      CC_FLAGS = $(CPU_CFLAGS) -DMAKE_VXWORKS -Wall -c
#    endif

    CC_FLAGS = $(CPU_CFLAGS) -DMAKE_VXWORKS -Wall -c

    # all warnings left out for the default (see above) must be added here
    ifdef MAKE_ALL_WARNINGS
	CC_FLAGS   := $(CC_FLAGS) -Wshadow     \
                        -Wcast-qual            \
                        -Wcast-align           \
                        -W                     \
                        -Wno-unused            \
                        -Wpointer-arith        \
                        -Wwrite-strings        \
                        -Wmissing-prototypes   \
                        -Wmissing-declarations 
    endif

    LD       = ld$(VX_CPU_FAMILY)
    AR       = ar$(VX_CPU_FAMILY)
    RANLIB   = ranlib$(VX_CPU_FAMILY)
    NM       = nm$(VX_CPU_FAMILY)

    ifdef CPU
        BINDIR   = bin/$(CPU)
        LIBDIR   = lib/$(CPU)
    else
        #
        # force a syntax error, so that vltMake stops
        CPU not defined (required when MAKE_VXWORKS is defined)
    endif

    C_PLUS_PLUS_FLAGS = -r
    
endif


ifndef MAKE_VXWORKS
    ifdef MAKE_PURIFY
        PURIFY = purify -always-use-cache-dir
        # SPR970010: additional options needed by C++ code. Because it is not
        # easy to know whether the code is C or C++, the options are set for
        # all type of code.
        PURIFY = purify \
                  -always-use-cache-dir \
                  -user-path="../test:../src:src:test" \
                  -g++=yes \
                  -collector=/usr/bin/ld
        GCC_EXEC_PREFIX = 
    else
        PURIFY =
    endif

    ifdef MAKE_PURECOV
        PURECOV = purecov -always-use-cache-dir
        GCC_EXEC_PREFIX = 
        NEED_DEBUG = on
    else
        PURECOV =
    endif
endif


#
# complete CFLAGS definition
ifdef NEED_DEBUG
    # Purify and Purecoverage require the debug options. 
    # Other user's choices are override, even if they come from 
    # the command line (see override directive)
    # 28/05/00 PSI: Purify is taken out (see SPR 990338)
    override OPTIMIZE =
    override DEBUG = defined
endif

# the user can ask one out of: optimized/non optimized/debuggable code
ifdef DEBUG
    CFLAGS = $(CC_FLAGS) -g3 -ggdb3 -DDEBUG                
endif

ifdef OPTIMIZE
    O_LEVEL = -O
    ifeq ($(OPTIMIZE),0)
        O_LEVEL = -O0
    endif
    ifeq ($(OPTIMIZE),1)
        O_LEVEL = -O1
    endif
    ifeq ($(OPTIMIZE),2)
        O_LEVEL = -O2
    endif
    ifeq ($(OPTIMIZE),3)
        O_LEVEL = -O3
    endif
    ifeq ($(OPTIMIZE),4)
        O_LEVEL = -O4
    endif
    ifeq ($(OPTIMIZE),5)
        O_LEVEL = -O5
    endif
    ifeq ($(OPTIMIZE),6)
        O_LEVEL = -O6
    endif
    ifeq ($(OPTIMIZE),7)
        O_LEVEL = -O7
    endif
    ifeq ($(OPTIMIZE),8)
        O_LEVEL = -O8
    endif
    ifeq ($(OPTIMIZE),9)
        O_LEVEL = -O9
    endif
    ifdef DEBUG
        CFLAGS = $(CC_FLAGS) -g -DDEBUG $(O_LEVEL)
    else
        CFLAGS = $(CC_FLAGS) $(O_LEVEL)
    endif
endif

    # default case, used during development, depends on OS
ifndef DEBUG
  ifndef OPTIMIZE
    ifdef MAKE_VXWORKS
        CFLAGS = $(CC_FLAGS) -g -DDEBUG
    else
        CFLAGS = $(CC_FLAGS) -g -DDEBUG -O
    endif
  endif
endif

CFLAGS := $(CFLAGS) $(CCS_CFLAGS)                               

ifdef USER_CFLAGS
    CFLAGS := $(CFLAGS) $(USER_CFLAGS)                               
endif

#
# shell command to remove files and/or directories
RM = rm -rf

#
# default tcl/tk shell
WISH = wish -f

#
# default syntax checker for tcl/tk files
TCL_CHECKER = tclCheck

##################################################################
#   TAO search paths for include files and libraries             #
##################################################################
ifdef ACE_ROOT
ifndef TAO_ROOT
  TAO_ROOT = $(ACE_ROOT)/TAO
endif

##
## Originally I included these ACE/TAO files,
## but there are a lot of problems using them with VxWorks.
## 
##include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
##include $(ACE_ROOT)/include/makeinclude/macros.GNU
##include $(TAO_ROOT)/rules.tao.GNU
##include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
##include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
##include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
##include $(TAO_ROOT)/taoconfig.mk
#
## WARNING GCH: There are some problems with ACE includes
##              that override the CXX definition!!!!
##              to be fixed!!!!!
##ifdef MAKE_VXWORKS
##    CXX      = cc$(VX_CPU_FAMILY) -ansi -fno-builtin -nostdinc
##endif

ifndef MAKE_VXWORKS
  CFLAGS :=  -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -DACE_HAS_AIO_CALLS   -fno-exceptions -fcheck-new $(CFLAGS) 
else
  CFLAGS :=   -ansi -pipe -D_REENTRANT -fno-builtin -fno-defer-pop -fvolatile -nostdlib -W -g -DACE_VXWORKS=0x540 -Wno-uninitialized -fno-exceptions -fno-rtti -DACE_LACKS_RTTI  -fcheck-new $(CFLAGS)
  LD = perl $(ACE_ROOT)/bin/ace_ld -C ccppc $(CFLAGS) -traditional -- -m munch -n nm$(VX_CPU_FAMILY) ld$(VX_CPU_FAMILY) -X -r 

endif

endif


#################################################
# IDL                                           #
#################################################

IDL_PATH_LIST:=../idl



##################################################################
#   set search paths for include files and libraries             #
##################################################################

#
# ... for GNU and TCLTK tools 

# from MAY97 on, GNU, TCLTK, Data Flow tools are not installed under
# /usr/local, but they have a dedicated directories.

# Default values:
# Porting to GCC 3.1: /usr/local/include does not exist on HP11 
# and SUN 5.8 and it is empty on Linux RH 7.2
#TOOLS_INC = $(INC_DEFAULT)
TOOLS_LIB = $(LIB_DEFAULT)

ifdef GNU_ROOT
# Porting to GCC 3.1: the following include must be removed. 
# It is not needed and produce tons of warnings
#    TOOLS_INC := -I$(GNU_ROOT)/include   $(TOOLS_INC)
    TOOLS_LIB := -L$(GNU_ROOT)/lib       $(TOOLS_LIB)
endif

ifdef TCLTK_ROOT
    TOOLS_INC := -I$(TCLTK_ROOT)/include $(TOOLS_INC)
    TOOLS_LIB := -L$(TCLTK_ROOT)/lib     $(TOOLS_LIB)
endif

ifdef VLTROOT
    TOOLS_INC := -I$(VLTROOT)/include/rtd $(TOOLS_INC)
    TOOLS_INC := -I$(VLTROOT)/include/cat $(TOOLS_INC)
endif

#
# ... for software products
ifdef MAKE_VXWORKS
    VXINC = -I$(VXROOT)/h
    ifeq ($(VX_CPU_FAMILY),ppc)
        VXINC := $(VXINC) -I$(VXROOT)/h/arch/ppc
    endif
    VXLIB = -L$(VXROOT)/lib
else
    ifdef RTAPROOT
        RTINC = $(RTINC_DEFAULT)
        RTLIB = $(RTLIB_DEFAULT)
    endif

    #
    # if GUI libraries are not already defined, 
    # take the platform-dependent default(as required by RTAP 6.31)
    ifndef XINC
        XINC = $(XINC_DEFAULT)
    endif
    ifndef XLIB
        XLIB = $(XLIB_DEFAULT)
    endif

endif

#
# ... for VLT software
#         ----> file are searched in this order ---->
#      [ [INTROOT] . . . [INTLIST] . . . ] VLTROOT
#
#   to support modules that are spanned among WS and LCU
#   include files must be searched on the workstation include and,
#   if MAKE_VXWORKS defined, in the lcu include directory.
#
#   Each element of the list adds:
#    MAKE_VXWORKS     not defined                    defined
#        _INC       xxxROOT/include          xxxROOT/vw/include xxxROOT/include
#        _LIB       xxxROOT/$(LIBDIR)        xxxROOT/vw/$(LIBDIR)
#
#   The building of VLT-INC/LIB starts from the highest level (VLTROOT)
#   i.e., the last place where things will be searched in, and goes
#   backword.
#

#
# the following is used to switch from the WS to the LCU part:
ifdef MAKE_VXWORKS
    VW = /vw
else
    VW =
endif

#
# define basic paths to VLTROOT:
ifdef VLTROOT
    VLTINC := -I$(VLTROOT)/include
    ifdef MAKE_VXWORKS
        VLTINC := -I$(VLTROOT)$(VW)/include $(VLTINC)
    endif
    VLTLIB  = -L$(VLTROOT)$(VW)/$(LIBDIR)
    VLTTOP  = $(VLTROOT)$(VW)
    INSTALL_ROOT = $(VLTROOT)
    ALARMS  = $(VLTROOT)/ALARMS
    ERRORS  = $(VLTROOT)/ERRORS
    LOGS    = $(VLTROOT)/LOGS
    CIT_DIR = $(VLTROOT)/vw/CIT
    CDT_DIR = $(VLTROOT)/CDT
    DBL     = $(VLTROOT)/dbl
    VLTTOP_LOG = $(VLTROOT)
    VLTIDL := -I$(VLTROOT)/idl
endif

#
# for each item in INTLIST add search paths:
DIR_LIST = $(subst :, , $(LOCALDIR))

ifdef MAKE_VXWORKS
    AUXILIARY_INC = $(foreach dir, $(DIR_LIST), -I$(dir)$(VW)/include -I$(dir)/include)
else
    AUXILIARY_INC = $(foreach dir, $(DIR_LIST), -I$(dir)/include)
endif
AUXILIARY_LIB = $(foreach dir, $(DIR_LIST), -L$(dir)$(VW)/$(LIBDIR))

DIRLIST = $(subst :, , $(INTLIST))

#
# if ACSROOT is defined, override or complete the search paths:
# This allows to build and use the module also in an environment
# where ACS is installed on top of VLT.
#
ifdef ACSROOT
    VLTINC := -I$(ACSROOT)/include $(AUXILIARY_INC) $(VLTINC)
    ifdef MAKE_VXWORKS
        VLTINC := -I$(ACSROOT)$(VW)/include $(VLTINC)
    endif
    VLTLIB := -L$(ACSROOT)$(VW)/$(LIBDIR) $(AUXILIARY_LIB) $(VLTLIB)
    VLTTOP  = $(ACSROOT)$(VW)
    INSTALL_ROOT = $(ACSROOT)
    ALARMS  = $(ACSROOT)/ALARMS
    ERRORS  = $(ACSROOT)/ERRORS
    LOGS    = $(ACSROOT)/LOGS
    CIT_DIR = $(ACSROOT)/vw/CIT
    CDT_DIR = $(ACSROOT)/CDT
    DBL     = $(ACSROOT)/dbl
    VLTTOP_LOG = $(ACSROOT)
    VLTIDL := -I$(ACSROOT)/idl $(VLTIDL)
endif

#
# if INTLIST is defined, override or complete the search paths:
ifdef INTLIST    
    VLTINC := $(foreach dir, $(DIRLIST), -I$(dir)/include) $(VLTINC)
    ifdef MAKE_VXWORKS
        VLTINC := $(foreach dir, $(DIRLIST), -I$(dir)$(VW)/include) $(VLTINC)
    endif
    VLTLIB  := $(foreach dir, $(DIRLIST), -L$(dir)$(VW)/$(LIBDIR)) $(VLTLIB)
    VLTTOP  = $(word 1, $(DIRLIST))/$(VW)
    INSTALL_ROOT =  $(word 1, $(DIRLIST))
    ALARMS  = $(word 1, $(DIRLIST))/ALARMS
    ERRORS  = $(word 1, $(DIRLIST))/ERRORS
    LOGS    = $(word 1, $(DIRLIST))/LOGS
    CIT_DIR = $(word 1, $(DIRLIST))/vw/CIT
    CDT_DIR = $(word 1, $(DIRLIST))/CDT
    DBL     = $(word 1, $(DIRLIST))/dbl
    VLTTOP_LOG = $(word 1, $(DIRLIST))
    VLTIDL := $(foreach dir, $(DIRLIST), -I$(dir)/idl) $(VLTIDL)
    ifdef MAKE_VXWORKS
        VLTIDL := $(foreach dir, $(DIRLIST), -I$(dir)$(VW)/idl) $(VLTIDL)
    endif
endif

#
# if INTROOT is defined, override or complete the search paths:
ifdef INTROOT
    VLTINC := -I$(INTROOT)/include $(AUXILIARY_INC) $(VLTINC)
    ifdef MAKE_VXWORKS
        VLTINC := -I$(INTROOT)$(VW)/include $(VLTINC)
    endif
    VLTLIB := -L$(INTROOT)$(VW)/$(LIBDIR) $(AUXILIARY_LIB) $(VLTLIB)
    VLTTOP  = $(INTROOT)$(VW)
    INSTALL_ROOT = $(INTROOT)
    ALARMS  = $(INTROOT)/ALARMS
    ERRORS  = $(INTROOT)/ERRORS
    LOGS    = $(INTROOT)/LOGS
    CIT_DIR = $(INTROOT)/vw/CIT
    CDT_DIR = $(INTROOT)/CDT
    DBL     = $(INTROOT)/dbl
    VLTTOP_LOG = $(INTROOT)
    VLTIDL := -I$(INTROOT)/idl $(VLTIDL)
endif

#
# ... if ACE to used
#
ifdef ACE_ROOT

    VLTINC := -I$(ACE_ROOT)/TAO -I$(ACE_ROOT)/TAO/tao -I$(ACE_ROOT) $(VLTINC)
    VLTLIB := -L$(ACE_ROOT)/ace $(VLTLIB)

endif

#
# ... in the current module
#
MODINC = -I../include
MODLIB = -L../lib 
MODIDL = -I../idl

#
# REMARK: for VW module there is the possibility that a mod/ws-lcu structure
#         is used, so include files should be searched also in the include/
#         directory of the ws-part of the module:
# (If the module has not the mod/ws-lcu structure, the following
# is a non-sense, but I do not care because the path can contain 
# not existing directory and also because I have no idea how to test
# from inside the makefile whether the ../../ws exists or not!)
#
ifdef MAKE_VXWORKS
    MODINC := $(MODINC) -I../../ws/include 
endif


#
# Merge all of them:
#
#         -local-   --user--    --VLT-- 
I_PATH   = $(MODINC) $(USER_INC) $(VLTINC)
L_PATH   = $(MODLIB) $(USER_LIB) $(VLTLIB)
IDL_PATH = $(MODIDL) $(USER_IDL) $(VLTIDL) 
ifdef MAKE_VXWORKS
    #                   -VxWorks-
    I_PATH := $(I_PATH) $(VXINC)
    L_PATH := $(L_PATH) $(VXLIB) 
else
    #                   --RTAP-- --X11-- -GNU&TCLTK-
    I_PATH := $(I_PATH) $(RTINC) $(XINC) $(TOOLS_INC)
    L_PATH := $(L_PATH) $(RTLIB) $(XLIB) $(TOOLS_LIB)
endif

#
# force to use always the search path. 
# By default, cpp gets an include from the current directory. So if an 
# include file includes another one, the second is taken from where 
# the first is found. To ihnibit such a behaviour and to force the 
# compiler always to restart the search from the beginning of the 
# search path, the -I- option is added (see Using and Porting GNU CC
# for version 2.5, Oct 93, p.48, 3.12 Options for directory searching)
#
# -I. is added to allow includes from current directory (this is the case of
#                lcc software)

I_PATH := -I- -I. $(I_PATH)

#
# REMARK about L_PATH
#  an additional environment variable is used by the loader as default 
#  search path for libraries. It is:
#       on  HP     LPATH   
#       on  SUN    LD_LIBRARY_PATH 
#  the way the variable is used is also different see ld(1) on both systems
#

ifdef VLTTOP
    # for VxWorks, binaries and libraries are organized according
    # to supported CPU types
    #
    BIN     = $(VLTTOP)/$(BINDIR)
    LIB     = $(VLTTOP)/$(LIBDIR)
    INCLUDE = $(VLTTOP)/include
    MAN     = $(VLTTOP)/man
endif

#  
#  define the "mode" masks for file installation. If the installation 
#  is into INTROOT, the mask are set also as group writable, so
#  a colleague can overwrite an existing application when the owner 
#  is not available (holiday, illness, etc.)
#
ifdef INTROOT
    P755 = 775
    P644 = 664
else
    P755 = 755
    P644 = 644
endif


# 
# man page generation Last Change flag
ifdef VLTROOT
    LASTCHANGE = "$(MODVERSION) $(shell date '+%d/%m/%y-%H:%M')"
else
    LASTCHANGE = "development $(shell date '+%d/%m/%y-%H:%M')"
endif

TMP_SCRIPT_LIST := $(TMP_SCRIPT_LIST) $(SCRIPTS) 
#################################################

# 
MANSECTIONS_INSTALL = $(filter-out l, $(MANSECTIONS))

# this gives a unique number that can be used for the filename
#     important: ":=" is needed to force the substitution here, and not at every occurence of $FILE
UNIQUE_NUMBER := $(shell echo $$$$)
USER_NAME     := $(shell whoami)

FILE=/tmp/vltMake_$(UNIQUE_NUMBER)_$(USER_NAME)


INSTALL_TARGET = 

ifneq ($(strip $(EXECUTABLES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_bin
endif

ifneq ($(strip $(TMP_SCRIPT_LIST)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_scripts
endif

ifneq ($(strip $(INCLUDES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_includes
endif

INSTALL_TARGET := $(INSTALL_TARGET) install_standardfiles

ifneq ($(strip $(LIBRARIES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_libraries
endif

ifneq ($(strip $(TCL_SCRIPTS)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_TCLscripts
endif

ifneq ($(strip $(TCL_LIBRARIES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_TCLlibraries
endif

ifneq ($(strip $(PANELS)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_panels
endif

ifneq ($(strip $(DBL_CLASSES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_DB-Classes
endif

ifneq ($(strip $(DBL_BCF)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_DB-BCF
endif

ifneq ($(strip $(INS_ROOT_DIR)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_insrootdir
endif

ifneq ($(strip $(INS_ROOT_FILES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_insrootfiles
endif

ifneq ($(strip $(INSTALL_FILES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_files
endif

ifneq ($(strip $(MANSECTIONS_INSTALL)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_man
endif

ifneq ($(strip $(JARFILES)),)
    INSTALL_TARGET := $(INSTALL_TARGET) install_java
endif


#################################################
# set standard targets.                         #
#################################################
#
# define 'all' as the default target (by definition, the default target is
# the first that make encounters). 
#
# REMARK: having 'all' as the first target in Makefile should be enough,
#         but I do this to have the possibility to define here other
#         standard targets.
default : all

#
# force each standard target name to be an independent target
# (i.e., it will not be affected by an actual file with the same name)
.PHONY : all
.PHONY : clean
.PHONY : clean_dist
.PHONY : man
.PHONY : install
.PHONY : db
.PHONY : test
.PHONY : CppFiles

#
#   The MAKEDIR allows the user to have a local version of the vltMakefile.all
#

    #
    # to be backword compatible, a default value for MAKEDIR is provided.
    # REMARK: in future, this default should be deleted to discover the
    #         modules that have not been updated according to this new vltMake
    ifndef MAKEDIR
        MAKEDIR = $(VLTROOT)/include
    endif
#


# notify the user about current file in use and version
.PHONY : version
version:
	-@$(ECHO) "vltMakefile in use: $(MAKEDIR)/vltMakefile"
	-@what $(MAKEDIR)/vltMakefile

# SPR 20010715: include tpl makefile rules 
# -include is used: in case the tplMakefile does not exist 
# the vltMakefile will go on without producing warnings/errors

ifdef INS_TSFX_FILES
    INS_FLAG := on
endif
ifdef INS_PACKAGE
    INS_FLAG := on
endif
ifdef INS_PACKAGE_ISF
    INS_FLAG := on
endif
ifdef INS_PACKAGE_TSF
    INS_FLAG := on
endif
ifdef INS_TEC_PACKAGE
    INS_FLAG := on
endif
ifdef INS_TEC_PACKAGE_ISF
    INS_FLAG := on
endif
ifdef INS_TEC_PACKAGE_TSF
    INS_FLAG := on
endif

ifneq ($(strip $(INS_FLAG)),)
-include $(MAKEDIR)/tplMakefile
endif

#################################################
# entry points for various language specific
# features
# *********************************************
include $(MAKEDIR)/javaMakefile
# 

#
# set standard action for 'all' 
# -----------------------------
#
#   The specific actions for scripts, executables and libraries, both public 
#   and local and including the use of automatic dependencies, 
#   are defined in an auxiliary file
#

AUXILIARY_FLAGS := -f $(MAKEDIR)/vltMakefile.all --no-print-directory

.PHONY : do_all
do_all : make_links 
	-$(AT) vltMakeIndexFilesDependencies >../object/vltMakeIndexFiles.del
	$(MAKE) $(AUXILIARY_FLAGS) do_all

.PHONY : do_exes
do_exes: $(EXECUTABLE_LIST) 
	-$(AT) vltMakeIndexFilesDependencies >../object/vltMakeIndexFiles.del
	@$(MAKE) $(AUXILIARY_FLAGS) do_exes

.PHONY : do_libs
do_libs: $(LIBRARY_LIST)
	-$(AT) vltMakeIndexFilesDependencies >../object/vltMakeIndexFiles.del
	@$(MAKE) $(AUXILIARY_FLAGS) do_libs

.PHONY : do_scripts
do_scripts: 
	@$(MAKE) $(AUXILIARY_FLAGS) do_scripts


.PHONY : do_panels
do_panels: 
	@$(MAKE) $(AUXILIARY_FLAGS) do_panels

.PHONY : do_tcl
do_tcl: 
	@$(MAKE) $(AUXILIARY_FLAGS) do_tcl

.PHONY : make_links
make_links: 
ifneq ($(strip $(LINK_FILES)),)
#	-@$(ECHO) "....do links:"
	-$(AT) for member in $(LINK_FILES) ; do \
	if [ ! -h $${member} ]; then echo "== Linking file: $${member}"; ln -s ../../ws/src/$${member} $${member}; fi \
	done
endif

.PHONY : do_LOGS
do_LOGS:
	-$(AT) vltMakeIndexFilesDependencies >../object/vltMakeIndexFiles.del
	@$(MAKE) $(AUXILIARY_FLAGS) $@

.PHONY : do_ERRORS
do_ERRORS: 
	-$(AT) vltMakeIndexFilesDependencies >../object/vltMakeIndexFiles.del
	@$(MAKE) $(AUXILIARY_FLAGS) $@

#
# set standard action for 'CppFiles'
# ----------------------------------
#
# c-preprocessor output files used by error check utility (SPR 950609)
#
vpath  %.cpp  ../object

# IMPORTANT: 
#   check the following rules with the ones in vltMakefile.all used to
#   compile .c and .C. Except for "-E" and the output suffix (.cpp), they
#   must be the same!
#
# RSC: C++: use $CXX
../object/%.cpp : %.c
	  - @$(ECHO) "==  Preprocessing: $(<F)"
	  $(AT)$(CC) -E -c $(CFLAGS) $(CPPFLAGS) $(I_PATH) $($*_CFLAGS) -o $@ $(@F:.cpp=.c)

../object/%.cpp : %.C
	  - @$(ECHO) "==  Preprocessing: $(<F)"
	  $(AT)$(CXX) -E -c $(CFLAGS) $(CPPFLAGS) $(C_PLUS_PLUS_FLAGS) $(I_PATH) $($*_CFLAGS) -o $@ $(@F:.cpp=.C)

CppFiles: $(addprefix ../object/, $(addsuffix .cpp, $(CSOURCENAMES)))


#
# set standard action for 'man'
# -----------------------------
#
#    foreach section in the MANSECTIONS list, extract the man pages
#    from the appropriate input file list
.PHONY : do_man
do_man: do_man_hello $(addprefix man, $(MANSECTIONS)) manl do_A2MIF

.PHONY : do_man_hello
do_man_hello:
	-@$(ECHO) "\nman-pages..."

.PHONY : man1
man1:
	-@$(ECHO) "....section 1:"
	-$(AT) for member in $(MAN1) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 1 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man1 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man2
man2:
	-@$(ECHO) "....section 2:"
	-$(AT) for member in $(MAN2) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 2 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man2 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man3
man3:
	-@$(ECHO) "....section 3:"
	-$(AT) for member in $(MAN3) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 3 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man3 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man4
man4:
	-@$(ECHO) "....section 4:"
	-$(AT) for member in $(MAN4) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 4 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man4 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man5
man5:
	-@$(ECHO) "....section 5:"
	-$(AT) for member in $(MAN5) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 5 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man5 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man6
man6:
	-@$(ECHO) "....section 6:"
	-$(AT) for member in $(MAN6) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 6 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man6 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man7
man7:
	-@$(ECHO) "....section 7:"
	-$(AT) for member in $(MAN7) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 7 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man7 -type f -print | xargs -i docDeroff {}
endif
.PHONY : man8
man8:
	-@$(ECHO) "....section 8:"
	-$(AT) for member in $(MAN8) ; do $(ECHO) "	$${member}"; docDoManPages $${member} 8 $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/man8 -type f -print | xargs -i docDeroff {}
endif
.PHONY : mann
mann:
	-@$(ECHO) "....section n:"
	-$(AT) for member in $(MANn) ; do $(ECHO) "	$${member}"; docDoManPages $${member} n $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/mann -type f -print | xargs -i docDeroff {}
endif

#
# generate local manpages (not to be installed)
# 
.PHONY : manl
manl:
	-@$(ECHO) "..local pages:"
ifneq ($(strip $(MANl)),)
	-$(AT) for member in $(MANl) ; do $(ECHO) "	$${member}"; docDoManPages $${member} l $(LASTCHANGE) $(OUTPUT); done
ifneq ($(strip $(MAN2TXT)),)
	-$(AT) find ../man/manl -type f -print | xargs -i docDeroff {}
endif
endif


#
# Convert ASCII document into Framemaker MIF format
#
.PHONY : do_A2MIF
do_A2MIF:
	-@$(ECHO) " ASCII to MIF:"
ifneq ($(strip $(ASCII_TO_MIF)),)
	-$(AT) for member in $(ASCII_TO_MIF) ; do $(ECHO) "	$${member}"; docA2MIF $${member} ../doc/`basename $${member}`.mif $(OUTPUT); done
	-@$(ECHO) ""
endif

#
# set standard action for 'clean'
# -------------------------------
#    delete all the files that "do_all:" can create.
#
# REMARKS:
#     - although this should be done with only one $(RM) command followed by 
#       all the file names, I do an $(RM) for each group of files because
#       due to number of file in the module, the unique list can be longer than 
#       the allowed maximum string accepted by the shell.
#     - on Solaris 2, a command like rm -rf and no arguments produces an error mesage
#       (on HP-UX does not). Since I cannot know in advance whether a list of file
#       is empty and I do not want to make the things too complicate, a fictitious
#       file name "vltMake_clean_xxxxx" is put in front of each list, so it is never
#       empty (and, if somebody, by chance, will create a file with such a name, 
#       means that he has very bad luck and has not followed naming conventions).
#         
#
# REMARK: ../object/vltMakeScriptDependencies.ds  is a remaining from an old implementation
#         when all modules are using a newer vltMake can be deleted from the list of file to be "rm"
#
.PHONY : clean_all
clean_all: rm_links $(CLEAN_TARGET)
	-@$(ECHO) "Cleaning up .\c"
	-$(AT)$(RM) vltMake_clean_executables  $(foreach member, $(EXECUTABLES) $(EXECUTABLES_L), ../bin/$(member) ../object/$(member).dx )     $(OUTPUT)
	-@$(ECHO)  " .\c"
	-$(AT)$(RM) vltMake_clean_libraries    $(foreach member, $(LIBRARIES)   $(LIBRARIES_L), ../lib/lib$(member).a ../lib/lib$(member).$(SHLIB_EXT) ../object/$(member).da ../object/$(member).dal )  $(OUTPUT)
	-@$(ECHO)  " .\c"
	-$(AT)$(RM) vltMake_clean_scripts      $(foreach member, $(SCRIPTS) $(SCRIPTS_L) , ../bin/$(member) ../object/$(member).ds ) ../object/vltMakeScriptDependencies.ds  $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_.o_Files.    $(foreach member, $(CSOURCENAMES), ../object/$(member).o )                 $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_.d_Files     $(foreach member, $(CSOURCENAMES), ../object/$(member).d )                 $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_.cpp_Files   $(foreach member, $(CSOURCENAMES), ../object/$(member).cpp )                 $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_tclScripts   $(foreach member, $(TCL_SCRIPTS)   $(TCL_SCRIPTS_L),  ../bin/$(member) ../object/$(member).dxt )                    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_tclLibraries $(foreach member, $(TCL_LIBRARIES) $(TCL_LIBRARIES_L), ../lib/lib$(member).tcl ../object/$(member).dat )            $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_panels       $(foreach member, $(PANELS) $(PANELS_L), ../bin/$(member) ../object/$(member).dpan )             $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)$(RM) vltMake_clean_indexfiles   ../LOGS/*.IDX ../ERRORS/*.IDX ../object/vltMakeIndexFiles.del  $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \#\* -print | xargs -i $(RM) {}
	-@$(ECHO) " .\c"
	-$(AT)find .. -name core -print | xargs -i $(RM) {}
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.gdb_history -print | xargs -i $(RM) {}
	-@$(ECHO) " .\c"

	-$(AT)vltMakeCleanDB $(OUTPUT)
	-@$(ECHO) " .\c"

ifneq ($(strip $(MANSECTIONS)),)
	-$(AT)  for i in $(MANSECTIONS) ; \
		do \
		    if [ -d ../man/man$${i} ];\
		    then \
		        find ../man/man$${i} -type f -print | xargs grep -l -s "This Man Page has been automatically produced. DO NOT EDIT THIS FILE!" | xargs $(RM) vltMake_clean_manpages  ;\
		    else \
			$(ECHO) "\n\n	ERROR: ''$${i}'' is in MANSECTIONS but ../man/man$${i} does not exists." ;\
		    fi ; \
		done
endif
	-$(AT)  if [ -d ../doc ];\
		then \
		    find ../doc -type f -print | xargs grep -l -s "This file has been automatically produced. DO NOT EDIT THIS FILE!" | xargs rm -rf vltMake_clean_manpages ;\
		    find ../doc -name \*.txt -print | xargs grep -l -s "### generated by docDeroff ###" |  xargs rm -rf vltMake_clean_manpages ;\
		fi
ifneq ($(strip $(MANl)),)
	-$(AT)  if [ -d ../man/manl ];\
		then \
	            find ../man/manl -type f -print | xargs grep -l -s "This Man Page has been automatically produced. DO NOT EDIT THIS FILE!" | xargs $(RM) vltMake_clean_manpages  ;\
		fi
endif
	-@$(ECHO) " ."
	-$(AT)$(RM) vltMake_clean_testReport ./*.rep             $(OUTPUT)
	-$(AT)$(RM) vltMake_clean_install   ../object/vltMakefile.install  $(OUTPUT)
	-@$(ECHO) " .\c"

#
# clean TAT files
#
ifndef MAKE_FROMTAT
	-@$(ECHO) " .\c"
	-$(AT)  currentdir=`pwd`;\
	  	current=`basename $$currentdir`;\
		if [ -d ../test/tatlogs -a $$current = "test" ] ;\
		then \
	            $(RM) ../test/tatlogs;\
		fi
endif

.PHONY : rm_links
rm_links: 
ifneq ($(strip $(LINK_FILES)),)
	$(AT) echo "Removing links ..."; $(RM) $(LINK_FILES)
endif

.PHONY : clean_dist_all
clean_dist_all:
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.o -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\~ -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \.\*\~ -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.$(SHLIB_EXT) -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.sl -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.d -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.ds -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.dx -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.dxt -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"
	-$(AT)find .. -name \*\.da -print | xargs -i $(RM) {}    $(OUTPUT)
	-@$(ECHO) " .\c"


#
# set standard action for 'install'
# ---------------------------------
#  copy the files that have been indicated in the lists the 
#  caller prepared (only public ones) and the manpages to the
#  appropriate target directories.
#  To avoid to copy files that are already up-to-date, a makefile
#  is created and then executed. In this way, only file newer than
#  those already in the target area are copied. This means that 
#  included and libraries are copied only when they are changed,
#  therefore the recompilation of depending files is reduced to the
#  minimum. 
#
#   - an explicit chmod is used to set permission
#   - if any, all files under ../ALARMS, ../ERRORS and ../LOGS are copied
#     respectively into the $(ALARMS), $(ERRORS) and $(LOGS) directory.
#     Please notice that such directory is always located at the level of 
#     workstation application (INTROOT or VLTROOT) even if the application is an
#     lcu application
#   - all, but "l", mansections are installed
#
# To allow partial installation, e.g. installing only header files during
# CCS library build, separated taerget instal_<type> are created.
#

# define PHONY all names used as targets
.PHONY : install_all
.PHONY : install_bin
.PHONY : install_scripts
.PHONY : install_includes
.PHONY : install_standardfiles
.PHONY : install_libraries
.PHONY : install_TCLscripts
.PHONY : install_TCLlibraries
.PHONY : install_panels
.PHONY : install_DB-Classes
.PHONY : install_DB-BCF
.PHONY : install_insrootdir
.PHONY : install_insrootfiles
.PHONY : install_files
.PHONY : install_man
.PHONY : install_java




#
# Whatever install_<type> is requested, build the Makefile
#
# In order to avoid that left over files from ctrl-C interrupted
# execution can cause troubles, remove possible old files
$(INSTALL_TARGET) install_all :
#install_all : $(INSTALL_TARGET)
	-@$(ECHO) "install_all: begin $(INSTALL_TARGET)" >> $(FILE)
	-@$(ECHO) "begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"Installing into target: $(VLTTOP)\"" >>$(FILE)

ifneq ($(strip $(EXECUTABLES)),)
	-@$(ECHO) "install_bin: bin_begin $(foreach member, $(EXECUTABLES), $(BIN)/$(member)  )" >>$(FILE)
	-@$(ECHO) "bin_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \".....binaries:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(EXECUTABLES), $(name) ); \
		do \
		    $(ECHO) "$(BIN)/$${member}: ../bin/$${member}" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../bin/$${member} $(BIN)/$${member};\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P755) $(BIN)/$${member}" >>$(FILE);\
		done
endif

ifneq ($(strip $(TMP_SCRIPT_LIST)),)
	-@$(ECHO) "install_scripts: scripts_begin $(foreach member, $(TMP_SCRIPT_LIST), $(BIN)/$(member)  )" >>$(FILE)
	-@$(ECHO) "scripts_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"......scripts:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(TMP_SCRIPT_LIST), $(name) ); \
		do \
		    $(ECHO) "$(BIN)/$${member}: ../bin/$${member}" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../bin/$${member} $(BIN)/$${member};\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P755) $(BIN)/$${member}" >>$(FILE);\
		done
endif



ifneq ($(strip $(INCLUDES)),)
	-@$(ECHO) "install_includes: includes_begin $(foreach member, $(INCLUDES), $(INCLUDE)/$(member) )" >>$(FILE)
	-@$(ECHO) "includes_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \".....includes:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(INCLUDES),  $(name) ); \
		do \
		    $(ECHO) "$(INCLUDE)/$${member}: ../include/$${member}" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../include/$${member} $(INCLUDE)/$${member};\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P644) $(INCLUDE)/$${member}" >>$(FILE);\
		done;
endif

	-@$(ECHO) "install_standardfiles: alarms errors logs tables" >>$(FILE)
	-$(AT)vltMakeInstallAlarmFiles $(ALARMS) $(P644) >>$(FILE)
	-$(AT)vltMakeInstallErrorFiles $(ERRORS) $(P644) >>$(FILE)
	-$(AT)vltMakeInstallLogFiles   $(LOGS)   $(P644) >>$(FILE)
	-$(AT)vltMakeInstallTableFiles $(CDT_DIR) $(CIT_DIR) $(P644) >>$(FILE)


ifneq ($(strip $(LIBRARIES)),)
	-@$(ECHO) "libraries_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"....libraries:\"" >>$(FILE)
	-$(AT) target="install_libraries: libraries_begin";\
	       for member in $(foreach name, $(LIBRARIES), $(name) ); \
		do \
		    target="$$target $(LIB)/lib$${member}.a";\
		    $(ECHO) "$(LIB)/lib$${member}.a: ../lib/lib$${member}.a" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../lib/lib$${member}.a $(LIB)/lib$${member}.a;  \\" >>$(FILE);\
		    $(ECHO) "	chmod $(P755) $(LIB)/lib$${member}.a" >>$(FILE);\
	            if [ -f ../lib/lib$${member}.$(SHLIB_EXT) ];\
	            then \
	                target="$$target $(LIB)/lib$${member}.$(SHLIB_EXT)";\
		        $(ECHO) "$(LIB)/lib$${member}.$(SHLIB_EXT): ../lib/lib$${member}.$(SHLIB_EXT)" >>$(FILE);\
		        $(ECHO) "	-\$$(AT)rm -f $(LIB)/lib$${member}.$(SHLIB_EXT); \\" >>$(FILE);\
		        $(ECHO) "	cp ../lib/lib$${member}.$(SHLIB_EXT) $(LIB)/lib$${member}.$(SHLIB_EXT);  \\" >>$(FILE);\
		        $(ECHO) "	chmod $(P755) $(LIB)/lib$${member}.$(SHLIB_EXT); \\" >>$(FILE);\
		        $(ECHO) "	chmod ugo-w $(LIB)/lib$${member}.$(SHLIB_EXT) " >>$(FILE);\
	            fi;\
ifeq($(os),$(CYGWIN_VER))
		         if [ -f ../lib/lib$${member}.$(SHLIB_EXT).a ];\
		         then \
		             target="$$target $(LIB)/lib$${member}.$(SHLIB_EXT).a";\
		        $(ECHO) "$(LIB)/lib$${member}.$(SHLIB_EXT).a: ../lib/lib$${member}.$(SHLIB_EXT).a" >>$(FILE);\
		        $(ECHO) "\t-\$$(AT)rm -f $(LIB)/lib$${member}.$(SHLIB_EXT).a; \\" >>$(FILE);\
		        $(ECHO) "\tcp -P ../lib/lib$${member}.$(SHLIB_EXT).a $(LIB)/lib$${member}.$(SHLIB_EXT).a;  \\" >>$(FILE);\
		        $(ECHO) "\tchmod $(P755) $(LIB)/lib$${member}.$(SHLIB_EXT).a; \\" >>$(FILE);\
		        $(ECHO) "\tchmod ugo-w $(LIB)/lib$${member}.$(SHLIB_EXT).a " >>$(FILE);\
		         fi;\
		         if [ -f ../lib/lib$${member}.$(SHLIB_EXT).def ];\
		         then \
		             target="$$target $(LIB)/lib$${member}.$(SHLIB_EXT).def";\
		        $(ECHO) "$(LIB)/lib$${member}.$(SHLIB_EXT).def: ../lib/lib$${member}.$(SHLIB_EXT).def" >>$(FILE);\
		        $(ECHO) "\t-\$$(AT)rm -f $(LIB)/lib$${member}.$(SHLIB_EXT).def; \\" >>$(FILE);\
		        $(ECHO) "\tcp ../lib/lib$${member}.$(SHLIB_EXT).def $(LIB)/lib$${member}.$(SHLIB_EXT).def;  \\" >>$(FILE);\
		        $(ECHO) "\tchmod $(P755) $(LIB)/lib$${member}.$(SHLIB_EXT).def; \\" >>$(FILE);\
		        $(ECHO) "\tchmod ugo-w $(LIB)/lib$${member}.$(SHLIB_EXT).def " >>$(FILE);\
		         fi;\
endif
	        done;\
		$(ECHO) "$$target" >>$(FILE); $(ECHO) "	-@echo \"\"" >>$(FILE)
endif
 
ifneq ($(strip $(TCL_SCRIPTS)),)
	-@$(ECHO) "install_TCLscripts: TCLscripts_begin $(foreach member, $(TCL_SCRIPTS), $(BIN)/$(member)) app-defaults" >>$(FILE)
	-@$(ECHO) "TCLscripts_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"...TCLscripts:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(TCL_SCRIPTS), $(name) ); \
		do \
		    $(ECHO) "$(BIN)/$${member}: ../bin/$${member}" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\"  >>$(FILE);\
		    $(ECHO) "	cp ../bin/$${member} $(BIN)/$${member};\\"  >>$(FILE);\
		    $(ECHO) "	chmod $(P755) $(BIN)/$${member}" >>$(FILE);\
	        done; 
	-$(AT) target="app-defaults:";\
	       for member in $(foreach name, $(TCL_SCRIPTS), $(name) ); \
		do \
			if [ -f ../app-defaults/X$${member} ];\
			then \
			    target="$$target $(VLTTOP)/app-defaults/X$${member}";\
			    $(ECHO) "$(VLTTOP)/app-defaults/X$${member}: ../app-defaults/X$${member}" >>$(FILE);\
			    $(ECHO) "	-\$$(AT)cp ../app-defaults/X$${member} $(VLTTOP)/app-defaults/X$${member};\\" >>$(FILE);\
			    $(ECHO) "	chmod $(P644) $(VLTTOP)/app-defaults/X$${member}" >>$(FILE) ;  \
			fi;\
	        done; \
		$(ECHO) "$$target" >>$(FILE); $(ECHO) "	-@echo \"\"" >>$(FILE)
endif

ifneq ($(strip $(TCL_LIBRARIES)),)
	-@$(ECHO) "install_TCLlibraries: TCLlibraries_begin $(foreach member, $(TCL_LIBRARIES), $(LIB)/lib$(member).tcl) " >>$(FILE)
	-@$(ECHO) "TCLlibraries_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \".TCLlibraries:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(TCL_LIBRARIES), $(name) ); \
		do \
		    $(ECHO) "$(LIB)/lib$${member}.tcl: ../lib/lib$${member}.tcl" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	rm -rf $(LIB)/lib$${member}.tcl;\\" >>$(FILE);\
		    $(ECHO) "	cp -r ../lib/lib$${member}.tcl $(LIB)/lib$${member}.tcl;\\" >>$(FILE);\
		    $(ECHO) "	chmod -R $(P755) $(LIB)/lib$${member}.tcl" >>$(FILE);\
		done;
endif

ifneq ($(strip $(PANELS)),)
	-@$(ECHO) "install_panels: panels_begin $(foreach member, $(PANELS), $(BIN)/$(member) )" >>$(FILE)
	-@$(ECHO) "panels_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \".......panels:\"" >>$(FILE)
	-$(AT)  for member in  $(foreach name, $(PANELS), $(name) ); \
		do \
		    $(ECHO) "$(BIN)/$${member}: ../bin/$${member}" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../bin/$${member} $(BIN)/$${member};\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P755) $(BIN)/$${member} " >>$(FILE);\
		done;
endif


ifneq ($(strip $(DBL_CLASSES)),)
	-@$(ECHO) "install_DB-Classes: DB-Classes_begin $(foreach member, $(DBL_CLASSES), $(DBL)/$(member).class )" >>$(FILE)
	-@$(ECHO) "DB-Classes_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"...DB-Classes:\"" >>$(FILE)
	-$(AT)  for member in  $(foreach name, $(DBL_CLASSES), $(name) ); \
		do \
		    $(ECHO) "$(DBL)/$${member}.class: ../dbl/$${member}.class" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../dbl/$${member}.class $(DBL)/$${member}.class;\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P644) $(DBL)/$${member}.class" >>$(FILE); \
		done;
endif

ifneq ($(strip $(DBL_BCF)),)
	-@$(ECHO) "install_DB-BCF: DB-BCF_begin $(foreach member, $(DBL_BCF), $(DBL)/$(member).db )" >>$(FILE)
	-@$(ECHO) "DB-BCF_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"...DB-Classes:\"" >>$(FILE)
	-$(AT) for member in  $(foreach name, $(DBL_BCF), $(name) ); \
		do \
		    $(ECHO) "$(DBL)/$${member}.db: ../dbl/$${member}.db" >>$(FILE);\
		    $(ECHO) "	-\$$(AT)echo \"\t$${member}\";\\" >>$(FILE);\
		    $(ECHO) "	cp ../dbl/$${member}.db $(DBL)/$${member}.db;\\" >>$(FILE);\
		    $(ECHO) "	chmod $(P644) $(DBL)/$${member}.db" >>$(FILE);\
		done;
endif

ifneq ($(strip $(JARFILES)),)
	-@$(ECHO) "install_java: java_begin $(foreach member, $(JARFILES), $(LIB)/$(member).jar  )" >>$(FILE)
	-@$(ECHO) "java_begin:" >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"......jarfiles:\"" >>$(FILE)
	-$(AT) for member in $(foreach name, $(JARFILES), $(name) ); \
		do \
			$(ECHO) "$(LIB)/$${member}.jar: ../lib/$${member}.jar" >>$(FILE);\
			$(ECHO) "	-\$$(AT)echo \"\t$${member}.jar\";\\" >>$(FILE);\
			$(ECHO) "	cp ../lib/$${member}.jar $(LIB);\\" >>$(FILE);\
			$(ECHO) "	chmod $(P644) $(LIB)/$${member}.jar" >>$(FILE);\
		done
endif


ifneq ($(strip $(INS_ROOT_DIR)),)
#       vltMakeInstallInsRootDir takes care to properly build the target "install_insrootdir"
	$(AT)vltMakeInstallInsRootDir "$(INS_ROOT_DIR)" $(INSTALL_ROOT) $(P644) >>$(FILE)
endif

ifneq ($(strip $(INS_ROOT_FILES)),)
#       vltMakeInstallInsRootFiles takes care to properly build the target "install_insrootfiles"
	$(AT)vltMakeInstallInsRootFiles "$(INS_ROOT_FILES)" $(INSTALL_ROOT) $(P644) >>$(FILE)
endif

ifneq ($(strip $(INSTALL_FILES)),)
#       vltMakeInstallFiles takes care to properly build the target "install_files"
	$(AT)vltMakeInstallFiles "$(INSTALL_FILES)" $(VLTTOP) $(INSTALL_ROOT) $(P644) >>$(FILE)
endif

ifneq ($(strip $(MANSECTIONS_INSTALL)),)
	-@$(ECHO) "install_man: " >>$(FILE)
	-@$(ECHO) "	-@echo \"\"; $(ECHO) \"....man-pages:\"" >>$(FILE)
	-@$(ECHO) "	-\$$(AT) $(foreach i, $(MANSECTIONS_INSTALL), $(ECHO) \"\tsection $(i)\"; cp ../man/man$(i)/*.$(i) $(MAN)/man$(i) ;)" >>$(FILE)
endif

	-@$(ECHO) "	-@vltMakeLogInstallation $(VLTTOP_LOG)" >>$(FILE)
	-@$(ECHO) "	-@vltMakeCopySources $(VW)" >>$(FILE)

#
# executing the created makefile. By passing the target, only the selected
# part of the makefile, will be done.
#
	-@$(MAKE) -k -f $(FILE) --no-print-directory $(@)
	-@$(RM) $(FILE)

#
# set standard action for 'db'
# ---------------------------------
#    "db" is a special target that has different behaviour depending
#    whether is a module or an environment
#    

#
# define the search path for include files. To allow commom definition 
# between code and dbl files, the h-file path is added to the pure
# dbl files (SPR950228)
DBL_INC = $(subst include,dbl,$(MODINC) $(VLTINC)) $(I_PATH)

ifdef MAKE_VXWORKS
    DBL_FLAGS_LCU = -DMAKE_VXWORKS
endif

ifndef RTAPROOT
    DBL_FLAGS_CCS = -DCCS_LIGHT
endif

.PHONY : db_all
db_all:
	-$(AT)if [ -f DATABASE.db ];\
	      then \
	          $(ECHO) "\n== remove current ../DB";     \
	          vltMakeCleanDB $(OUTPUT);             \
	          $(ECHO) "\n== db-loading of: DATABASE.db";     \
		  dbl $(DBL_INC) $(DBL_FLAGS_LCU) $(DBL_FLAGS_CCS) $(DBL_FLAGS) DATABASE.db ../DB;\
	      else \
		  if [ "$(DBL_LOAD)" = "" ];\
		  then \
		      $(ECHO) "DBL_LOAD is empty. Nothing to be done for 'make db'.";\
		  else \
		      /bin/true;\
		      $(foreach member, $(DBL_LOAD), \
			      $(ECHO) "\n== db-loading of: ../dbl/$(member).db";     \
			      dbl $(DBL_INC) $(DBL_FLAGS_LCU) $(DBL_FLAGS_CCS) $(DBL_FLAGS) $($(member)_DBL_FLAGS) ../dbl/$(member).db ../DB;\
	           ) \
		  fi;\
	      fi;

#
# set standard action for 'test'
# ---------------------------------
#    execute the TestDriver proccedure.
#    This target cannot be customiized from the Makefile
#
test:
	-$(AT)if [ -f ./TestDriver ];\
		then chmod +x ./TestDriver; ./TestDriver ALL ;\
		else $(ECHO) "TEST FAIL -- TestDriver not found";\
		fi

#
# set one target for each executable (required by SoftBench)
# ----------------------------------
$(addprefix ../bin/, $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $(exe))) :all

#___oOo___

