#****************************************************************************** # E.S.O. - ALMA project # # "@(#) $Id: acsMakefile,v 1.206 2013/02/04 09:33:24 eallaert Exp $" # #******************************************************************************* # ALMA - Atacama Large Millimeter Array # Copyright (c) ESO - European Southern Observatory, 2014 # (in the framework of the ALMA collaboration). # All rights reserved. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #******************************************************************************* #****************************************************************************** # NAME # acsMakefile - system wide make definitions for ALMA SW # # DESCRIPTION # # acsMakefile sets common definitions that are valid for the whole # ACS based software. It also finds out on which platform and which # operating system the software is being built on and sets variables # accordingly. # In addition, acsMakefile 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 an ACS based software. # # The variables set by acsMakefile 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 acsMakefile works for UNIX files. If the make variable # MAKE_VXWORKS is defined, acsMakefile works to produce VxWorks applications. # # In general, for any given supported by the acsMakefile, and used # in the Makefiles as = alpha, a set of auxiliary targets are made # available: # do__alpha # clean__alpha # install__alpha # clean_dist__alpha # # and so are the corresponding cumulative targets: # do_s, clean_s, clean_dist_, install_s. # # The association to is listed here: # # SCRIPTS script # ACSLOGTSDEF logts # XSDBIND xsdbind # ACSERRDEF xmlerr # IDL_FILES idl # JARFILES java # DDS_FILES dds # LIBRARIES lib # EXECUTABLES exe # PY_PACKAGES python_package # PY_MODULES python_module # PY_SCRIPTS python_script # TCL_SCRIPTS tcl_script # TCL_LIBRARIES tcl_lib # RTAI_MODULES rtai # KERNEL_MODULES kernel_module # # If the building of one specific part of the module is desired, # the above targets may be used in conjunction with overriding the # module's Makefile's variables from the command line. # # For instance: # make JARFILES=MyJar do_javas # make LIBRARIES=MyLibrary do_libs # # The correct dependency relationships must be fullfilled for the partial # system to build. # # In detail, acsMakefile 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 -Wundef -Wpointer-arith -Wconversion \ # -Wsign-compare -Wwrite-strings \ # -Wstrict-prototypes -Wmissing-prototypes \ # -Wmissing-declarations $(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 -Wundef -Wpointer-arith \ # -Wconversion -Wsign-compare -Wwrite-strings \ # -Wstrict-prototypes -Wmissing-prototypes \ # -Wmissing-declarations -c $(OPTIONS) # # For both, the compilation options controlling optimization # and debugging information generation are generated as follows: # # $(OPTIONS) # # default UNIX: -O -g -DDEBUG # VxWorks: -DDEBUG # # DEBUG='on' -g -DDEBUG # # # OPTIMIZE='on' -O # # OPTIMIZE= -O # =[0|1|..|9] # # If more than one variable are defined, the precedence is: # DEBUG, OPTIMIZE # # If defined, USER_CFLAGS are added to CFLAGS. # # C_PLUS_PLUS_FLAGS C++ compilation flags # CCDEP compiler used to extract automatic dependencies (gcc -MM -ansi) # # SEARCHPATH basic search path, set to MODROOT:INTROOT:INTLIST:ACSROOT # whereby the directories in INTROOT, INTLIST and ACSROOT will # have "/vw" appended to them if MAKE_VXWORKS is set. MODROOT will # be set to ".." if the environment variable MODPATH is set to 1; # otherwise it will not be part of SEARCHPATH. # ACSINC ACS includes (integration area, if defined, and then root) # ACSLIB ACS libraries (integration area, if defined, and then root) # XINC X11 includes # XLIB X11 libraries # 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) # - ACS root # - 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) (*) # - ACS root (ACSROOT/vw) # - VxWorks (VXINC or VXLIB) # (*) includes are searched in both the "vw/include/" # and "include/" directories # # 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 # # PRJTOP prefix directory for "install" operations # Rule: set to either INTROOT(/vw), the first directory in INTLIST # (eventually with /vw appended) or ACSROOT(/vw) - if any of these # variables is defined; left undefined otherwise. # INSTALL_ROOT set to either INTROOT, the first directory of INTLIST, or ACSROOT # INCLUDE target directory for installing .h files $(PRJTOP)/include # BINDIR binary directory: bin for WSs, bin/$CPU for LCUs # BIN target directory for installing bin files $(PRJTOP)/$(BINDIR) # LIBDIR library directory: lib for WSs, lib/$CPU for LCUs # LIB target directory for installing bin files $(PRJTOP)/$(LIBDIR) # MAN target directory for installing man files $(PRJTOP)/man # # # REMARK: if you do not like the value provided either by acsMakefile # or by make itself, you can still override each variable using # the assignement at command line level: # # Example: make CC='cc' CFLAGS='-g' # # IDL # # IDL files specified with the directive IDL_FILES are # passed to the three CORBA compilers for stubs and skeletons # generation. # These are: # # JacORB for Java # ACE/TAO for C++ # OMNIORB for Python # # Each of the files specified in IDL_FILES is passed to the three # CORBA compilers in turn, and in addition to the ALMA XmlIdl compiler, # if the XML_IDL variable is set. # # The IDL_FILES are intended to be either IDL files (extension .idl) or # IDL files containing only Macros (extension .midl) # # The stubs and skeletons for C++ are stored in the object directory. # The C++ Stubs will be compiled and put in a library called # ../lib/libStubs.a # # Additional libraries for the C++ stubs can be provided by specifying # the tag Stubs_LIBS = # # The Java files are directly compiled and jarred in a jarfile # with the same name under lib, the source and class files deleted. # # Generated Python files go into lib/python/site-packages. # # The directive COMPONENT_HELPERS is a flag to specify whether # component helper classes for Java have to be generated. # Any non null value will trigger this behaviour. # # Setting COMPONENT_HELPERS also implies ALMA XmlIdl compilation # (i.e. XML_IDL is set automatically to "NOTUSED"). # # The 'clean' target takes care of deleting all generated files. # # Also, IDL files specified in the ABEANS variable are used with the # ACS Beans generator and produce jarfiles in ../lib. # These are installed by the install target and cleaned by the clean target. # # Files with the extension .midl are pre-processed with cpp and saved as .idl # The variable $(MIDL_FLAGS) is used to pass definitions to the pre-processor # Pragma instructions are passed over as they are (see JacPrep for details). # # # RTAI # # The acsMakefile handles the targets to make, install and clean # RTAI kernel modules code. # # The main variable to be defined in the Makefile is RTAI_MODULES. # It behaves similarly to the EXECUTABLES or LIBRARIES variables, # and allows the customary specification of object files, compiler and # linking options. # # For RTAI modules to be build, installed or cleaned, the environment # variable RTAI_HOME must be defined. # # To customize compiling options USER_RTAI_CFLAGS can be used. # Also available is the tag RTAI_MODULES_L which keeps the modules local # without installing them. # The clean target deletes all files from rtai directory # # Support for modules load/unload: # # for each module listed in RTAI_MODULES or RTAI_MODULES_L, # the makefile assumes # the existence of two corresponding C++ files called # load.cpp and unload.cpp # # These files are built into two binaries. # Also, an additional script called "installLKM" is built, which contains # instructions on how to copy the LKM into the suitable system directories # and makes the load/unload binaries setuid root. # This script must be executed as root. # # KERNEL MODULES # # The acsMakefile handles the targets to make, install and clean # standard Linux kernel modules code. # # The main variable to be defined in the Makefile is KERNEL_MODULES. # It behaves similarly to the EXECUTABLES or LIBRARIES variables, # and allows the customary specification of object files, compiler and # linking options. # # For kernel modules to be build, installed or cleaned, the environment # variable LINUX_HOME must be defined. # # To customize compiling options USER_KERNEL_MODULE_CFLAGS can be used. # Also available is the tag KERNEL_MODULES_L which keeps the modules local # without installing them. # The clean target deletes all files from the kernel subdirectory. # # Support for modules load/unload: # # for each module listed in KERNEL_MODULES or KERNEL_MODULES_L, # the makefile assumes # the existence of two corresponding C++ files called # load.cpp and unload.cpp # # These files are built into two binaries. # Also, an additional script called "installLKM" is built, which contains # instructions on how to copy the LKM into the suitable system directories # and makes the load/unload binaries setuid root. # This script must be executed as root. # # PYTHON # # 1.PY_SCRIPTS and PY_SCRIPTS_L: These # scripts, specified without the .py extension, will be copied to the # local bin directory of the module. make install copies them to the # $INTROOT/bin. No further handling is done. As for any generic script, # the PY_SCRIPTS_L are not installed by make install # # 2.PY_MODULES: # These scripts, specified without the .py extension, will be copied # to the local lib/python/site-packages/module directory. Notice that # they are scripts, not directories. # # 3.PY_PACKAGES: # Packages specified in here must be under the corresponding directory # under src. They are copied to the local lib/python/site-packages/package # # JAVA # # The acsMakefile handles the targets to make, install and clean # Java code (all files in the src directory of a software module # with extension .java) # # All the files .java are compiled calling the Java compiler. # The resulting .class files are put in the ../object directory. # Afterwards, all the files .class existing in the ../object # directory are combined in one or more JAR archive files which are # created in the ../lib directory. # # The "make install" will copy this jar file under the lib # directory of the installation root (INTROOT, ACSROOT...) # # The names of the jar files are determined by the user who will # have to define in the module's Makefile the variable: # JARFILES = .... (without extension .jar) # (name of the resulting jar files without extension) # plus corresponding directories in the form of # _DIRS = ... (space separated) # _DIRS = ... # # Additional non java files can be added specifying the directories they # are in, relative to the module src directory, in the following form: # _EXTRAS = images # # or # # _EXTRAS = sounds/rock/queen.au sounds/classic/Beethoven.au # # Dependencies across jarfiles may be specified using the # _JLIBS = someOtherJar # construct, since acsMakefile does not have the capability to automatically # infer dependencies. Adding such dependency information is a precondition # to parallel make execution. # # Compiler options to the javac compiler can be passed by setting the # USER_JFLAGS and _JFLAGS. # # A single Jarfile may require to use the 'endorsed' behaviour, in which case # _ENDORSED="on" can be used. # # The above featuers can also be used for jarfiles listed in the tag # COMPONENTS_JARFILES, which is used to single out jarfiles which act as ACS # components and therefore follow a somewhat special treatment. # In particular, they are not installed straight under lib, but under # lib/ACScomponents # # Notice that a jarfile may be listed in either JARFILES or # COMPONENTS_JARFILES but not in both # # The CLASSPATH variable is generated by a custom script. # It takes the initial value of CLASSPATH from the shell and augments it # with all jarfiles contained in /lib, $INTROOT/lib and # $ACSROOT/lib, in that sequence. # If the script is called with the -components option, only the directories # containing ACS components jarfiles are returned. # # Java byte compiled code goes under /object, possibly # under a directory structure reflecting the Java package # structure. Jarfiles are created, as specified in the JARFILES # variable and moved to the lib directory. # # The DEBUG flag can be set, to make original Java files to be appended # in the jarfile. # # # FILE # ACSROOT/include/acsMakefile # ACS wide definitions for Linux or VxWorks # # ACSROOT/include/acsMakefileDefinitions.mk # (or MAKEDIR/acsMakefileDefinitions.mk) # macro definitions # # ACSROOT/include/Makefile.template # template for the preparation of module-Makefile # # /src/Makefile # /test/Makefile # local make file, shall include acsMakefile(.VxWorks) # # # ENVIRONMENT # The following variables, if defined either in the environment or by the # calling Makefile, can control acsMakefile # # GNU_ROOT where to look for GNU stuff. NO DEFAULT! # TCLTK_ROOT where to look for TCL/TK stuff. NO DEFAULT! # MAKEDIR where to look for the acsMakefile.all # default: $(ACSROOT)/include/acsMakefile.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_PURE if defined it triggers the acsStartJava to create mempro.jtp # MAKE_PURECOV if defined executable are instrumented for test coverage # MAKE_ALL_WARNINGS if defined all compiler warnings are activated # ACSROOT ACS Software root directory # INTROOT Current Integration area. If defined, it becomes the target # directory for "install" operation # INTLIST ":"-separated 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 ... ) # USER_LIB list of additional libraries (formated as -L ...) # XINC X11 includes # XLIB X11 libraries # WIND_BASE root directory for WINDRIVER VxWorks TORNADO product # MODVERSION version identification # # CAUTION # The variables defined by acsMakefile should not be redefined inside # a Makefile. If you need to do that, clearly comment the rational behind. # # EXAMPLES # # SEE ALSO # Makefile, (GNU) make # # BUGS #------------------------------------------------------------------------ # This variable has to be propagated to the recipes export INSTALL_ROOT COLON:= : EMPTY:= SPACE:= $(EMPTY) $(EMPTY) # # set auxiliary variables according to the verbose flag # AT is used to prefix commands # OUTPUT is where the output is redirected # PYTHON_OUTPUT is a flag determining verbosity for python code compilation # VERBOSE_DEF gives the literal string "-verbose", to be used as an option e.g. for XMLIDL # ifdef MAKE_VERBOSE AT = OUTPUT = PYTHON_OUTPUT = VERBOSE_DEF = -verbose else AT = @ OUTPUT = > /dev/null PYTHON_OUTPUT = -q VERBOSE_DEF = endif # # force Korn shell as the shell used to interpret the commands SHELL = /bin/bash debug_trace= THIS_MAKEFILE := $(word 1,$(MAKEFILE_LIST)) ################################################################## # machine-specific stuff, special options and syntax differences # ################################################################## # # current execution directory # PWD = $(shell pwd) # # figure out the current platform. # os = $(shell uname) osrev = $(shell uname -r) ifdef LINUX_HOME # ICT-5964: do not treat directories as text files when grep-ing for a pattern kernel_install_subfold := $(shell egrep --directories=skip --regexp="define[[:space:]]+UTS_RELEASE" $(LINUX_HOME)/include/linux/* | cut --delimiter="\"" --fields=2) endif mustBuild = $(if $(MAKE_ONLY),$(if $(findstring $(1),$(MAKE_ONLY)),true,false),true) # usage: # #ifeq ($(call mustBuild,Java),true) #endif # Added by E. Allaert: Linux case; remark Linux uses Gnu-echo ifeq ($(os),Linux) platform = Linux export ECHO = echo -e PATH_SEP=: else ifeq ($(os),$(CYGWIN_VER)) platform = Cygwin osrev = 1.7.9 export ECHO = echo -e PATH_SEP=: else export ECHO = echo endif ifndef platform # # force a syntax error, so that acsMake stops $(error UNSUPPORTED platform) endif ifndef GNU_ROOT # # force a syntax error, so that acsMake stops $(error GNU_ROOT must be defined) endif ifndef TCLTK_ROOT # # force a syntax error, so that acsMake stops $(error TCLTK_ROOT must be defined) endif # define WS or LCU related variables ifndef MAKEDIR MAKEDIR = $(ACSROOT)/include endif ifdef MAKE_VXWORKS -include $(MAKEDIR)/acsMakefileVxWorks.mk else VW = # # define UNIX environment CCDEP = gcc -MM -MG -ansi LD = ld AR = ar RANLIB = ranlib CC = gcc -ansi CXX = gcc -ansi # # 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 # COMP-800 ifdef MAKE_NO_PERMISSIVE C_PLUS_PLUS_FLAGS = -fno-operator-names else C_PLUS_PLUS_FLAGS = -fno-operator-names -fpermissive endif ifeq ($(platform),Linux) # WARNING GCH: Commented out -ansi option for c,c++ and dependencies. # Problems with ACE/TAO # CXX = c++ -ansi CCDEP = gcc -MM -MG CC = gcc -std=gnu99 -fextended-identifiers CXX = g++ LD = g++ NOSHARED_ON = -Xlinker -Bstatic NOSHARED_OFF = -Xlinker -Bdynamic SHLIB_EXT = so RANLIB = ranlib 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 CXX_FOR_VERSION_TEST := gcc # Todo: In ALMA/Apex ACS_GXX_4_OR_BETTER=1 is always fullfilled! # Only one reference - should remove legacy branch ACS_CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion) ifeq (cmd,$(findstring cmd,$(SHELL))) ACS_CXX_MAJOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e "s/[^0-9\.]//g" | sed -e "s/\..*$$//") else ACS_CXX_MAJOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e 's/[^0-9\.]//g' | sed -e 's/\..*$$//') endif ifeq ($(findstring $(ACS_CXX_MAJOR_VERSION),1 2 3),$(ACS_CXX_MAJOR_VERSION)) ACS_GXX_4_OR_BETTER := 0 else ACS_GXX_4_OR_BETTER := 1 endif endif ifeq ($(platform),Cygwin) # WARNING GCH: Commented out -ansi option for c,c++ and dependencies. # Problems with ACE/TAO # CXX = c++ -ansi CCDEP = gcc -MM -MG CC = gcc CXX = g++ LD = g++ NOSHARED_ON = -Xlinker -Bstatic NOSHARED_OFF = -Xlinker -Bdynamic SHLIB_EXT = dll RANLIB = ranlib 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 CXX_FOR_VERSION_TEST := g++ # Todo: In ALMA/Apex ACS_GXX_4_OR_BETTER=1 is always fullfilled! # Only one reference - should remove legacy branch ACS_CXX_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion) ifeq (cmd,$(findstring cmd,$(SHELL))) ACS_CXX_MAJOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e "s/[^0-9\.]//g" | sed -e "s/\..*$$//") else ACS_CXX_MAJOR_VERSION := $(shell $(CXX_FOR_VERSION_TEST) -dumpversion | sed -e 's/[^0-9\.]//g' | sed -e 's/\..*$$//') endif ifeq ($(findstring $(ACS_CXX_MAJOR_VERSION),1 2 3),$(ACS_CXX_MAJOR_VERSION)) ACS_GXX_4_OR_BETTER := 0 else ACS_GXX_4_OR_BETTER := 1 endif .LIBPATTERNS = lib%.dll lib%.dll.a lib%.a TAO_IDLFLAGS += -Gxhst -Gxhsk -Gxhsv -Gxhex -Gxhcn endif BINDIR = bin LIBDIR = lib # # the following awful construction is needed to implement an # OR conditional # I want MAKE_PURE to cause both Purify and Purecoverage # and MAKE_PURIFY and MAKE_PURECOV to be used to activate them # selectively. # Notice that on Linux, PurifyPlus does both coverage and memory # analysis with the same tool. # Mzampare August '03 # ifndef MAKE_PURIFY_TYPE MAKE_PURIFY_TYPE=OCI endif ifdef MAKE_PURE ENABLE_PURIFY=on ENABLE_PURECOV=on endif ifneq ($(MAKE_PURIFY_TYPE),SCI) ifdef MAKE_PUREGUI ENABLE_PURIFY=on ENABLE_PURECOV=on endif endif ifdef MAKE_PURIFY ENABLE_PURIFY=on endif ifdef MAKE_PURECOV ENABLE_PURECOV=on ifeq ($(MAKE_PURIFY_TYPE),SCI) ENABLE_PURIFY=on endif endif ifdef ENABLE_PURIFY PURIFY = purify \ -always-use-cache-dir \ -user-path="../test:../src:src:test" \ -g++=yes \ -linker=$(GNU_ROOT)/bin/ld \ -log-file=./.purifydir/MemoryReport -append-logfile=yes \ -messages=batch -view-file=./.purifydir/purify-%v.pv ifdef MAKE_PUREGUI PURIFY = purify \ -always-use-cache-dir \ -user-path="../test:../src:src:test" \ -g++=yes \ -linker=$(GNU_ROOT)/bin/ld endif else PURIFY = endif ifdef ENABLE_PURECOV PURECOV = purecov -dlclose-mode=2 -follow-child-processes=yes -always-use-cache-dir -counts-file=./.purifydir/purecov-%v.pcv ifdef MAKE_PUREGUI PURECOV = purecov -dlclose-mode=2 -follow-child-processes=yes -always-use-cache-dir endif # Purify and Purecoverage require the debug options. # Other user-choices are overridden, even if they come from the command line (see override directive) override OPTIMIZE = override DEBUG = defined else PURECOV = 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 endif # MAKE_VXWORKS CFLAGS := $(CFLAGS) ifdef USER_CFLAGS CFLAGS := $(CFLAGS) $(USER_CFLAGS) endif ifdef MAKE_GCOV CFLAGS := $(CFLAGS) -g -fprofile-arcs -ftest-coverage LDFLAGS_GCOV= -fprofile-arcs -ftest-coverage endif # # shell command to remove files and/or directories RM = rm -rf # shell command to do xargs ifeq ($(os),$(CYGWIN_VER)) XARGS = xargs #XARGS = env -i PATH=$(PATH) xargs #FIND = env -i PATH=$(PATH) JAVA_HOME=$(JAVA_HOME) find else XARGS = env -i xargs endif # # default tcl/tk shell WISH = wish -f # # default syntax checker for tcl/tk files TCL_CHECKER = tclCheck # External make flags MAKE_FLAGS += $(MAKE_PARS) ################################################################## # TAO search paths for include files and libraries # ################################################################## ifneq ($(strip $(ACE_ROOT_DIR)),) ifneq ($(strip $(ACE_ROOT)),) ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif ifndef MAKE_VXWORKS CFLAGS := -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -DACE_HAS_AIO_CALLS $(CFLAGS) CPPFLAGS = -fcheck-new else # There is nothing ACE/TAO specific for Compiler/linker settings! # The problem was that C++ was not handled at all by original linker command! # Only because of wrong munch version/arguments the perl workaround was necessary. # Now going back to the widely used recommended and proven linking variant. # For compilation don't override the architecture/version/optimization specific flags with hardcoded ones. # Only set the ACE/TAO specific flags. # New settings are valid also for vx 6.7, but at various places kept legacy for 6.7 ifeq ($(strip $(VX_VERSION)),6.9) # For 6.9 use new settings # Todo: # -fcheck-new unnecessary, because C++ raises an exception if new would return NULL. # Also not allowed for C e.g. ctdt.c . Relocated to C_PLUS_PLUS_FLAGS # -Wno-uninitialized overrridden by -Wall later on command line, superflous/no effect. # -pipe might just make the compiler faster, not creating faster code. Could be applied generally, not only for TAO. # Relocated to general CC setting. CFLAGS := -D_REENTRANT -DACE_VXWORKS=0x690 -DACE_LACKS_RTTI $(CFLAGS) else # For 6.7 keep legacy CFLAGS := -ansi -pipe -D_REENTRANT -fno-builtin -fno-defer-pop -fvolatile -nostdlib -DACE_VXWORKS=0x690 -Wno-uninitialized -DACE_LACKS_RTTI -fcheck-new $(CFLAGS) LD = perl $(ACE_ROOT)/bin/ace_ld -C ccppc $(CFLAGS) -- -m munch -n nm$(VX_CPU_FAMILY) ld$(VX_CPU_FAMILY) -X -r -T $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT endif endif endif endif ################################################# # IDL # ################################################# # COMP-8768: ensure no subdirs of CVS/ or .svn/ are included MK_IDL_PATH_LIST=$(shell if [ -d ../idl ]; then find ../idl -type d ! \( -name CVS -prune \) ! \( -name .svn -prune \) -printf "%p " 2>/dev/null ; fi ) ################################################################## # 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: TOOLS_INC = $(INC_DEFAULT) TOOLS_LIB = $(LIB_DEFAULT) ifdef GNU_ROOT ifndef MAKE_VXWORKS TOOLS_INC := -I$(GNU_ROOT)/include $(TOOLS_INC) TOOLS_LIB := -L$(GNU_ROOT)/lib $(TOOLS_LIB) endif endif ifdef TCLTK_ROOT TOOLS_INC := -I$(TCLTK_ROOT)/include $(TOOLS_INC) TOOLS_LIB := -L$(TCLTK_ROOT)/lib $(TOOLS_LIB) endif ifdef PYTHON_ROOT TOOLS_INC := -I$(PYTHONINC) $(TOOLS_INC) ifeq ($(platform),Cygwin) TOOLS_LIB := -L$(PYTHON_ROOT)/bin $(TOOLS_LIB) else TOOLS_LIB := -L$(PYTHON_ROOT)/lib $(TOOLS_LIB) endif endif ifdef ACSROOT TOOLS_INC := -I$(ACSROOT)/include $(TOOLS_INC) ifdef MAKE_VXWORKS TOOLS_INC := -I$(ACSROOT)$(VW)/include $(TOOLS_INC) TOOLS_LIB := -L$(ACSROOT)$(VW)/lib $(TOOLS_LIB) endif endif # # ... for software products ifdef MAKE_VXWORKS VXINC = -I$(VXROOT)/h/wrn/coreip/ ifeq ($(VX_CPU_FAMILY),ppc) VXINC := $(VXINC) endif VXLIB = -L$(VXROOT)/lib else # # if GUI libraries are not already defined, # take the platform-dependent default ifndef XINC XINC = $(XINC_DEFAULT) endif ifndef XLIB XLIB = $(XLIB_DEFAULT) endif endif # # ... for ACS software # ----> file are searched in this order ----> # [ [INTROOT] . . . [INTLIST] . . . ] ACSROOT # # 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 ACS-INC/LIB starts from the highest level (ACSROOT) # i.e., the last place where things will be searched in, and goes # backword. # # # define basic paths to ACSROOT: ifdef ACSROOT ACSINC := -I$(ACSROOT)/include -I$(ALMASW_INSTDIR)/boost/include ifdef MAKE_VXWORKS ACSINC := -I$(ACSROOT)$(VW)/include $(ACSINC) endif SEARCHPATH = $(ACSROOT)$(VW) ACSLIB = -L$(ACSROOT)$(VW)/$(LIBDIR) -L$(ALMASW_INSTDIR)/boost/lib PRJTOP = $(ACSROOT)$(VW) INSTALL_ROOT = $(ACSROOT) CDBS = $(ACSROOT)/config/CDB/schemas PRJTOP_LOG = $(ACSROOT) ACSIDL := -I$(ACSROOT)/idl ifdef MAKE_VXWORKS ACSIDL := -I$(ACSROOT)$(VW)/idl $(ACSIDL) endif endif # # for each item in INTLIST add search paths: DIRLIST = $(subst :, , $(INTLIST)) # # if INTLIST is defined, override or complete the search paths: # ifdef INTLIST ACSINC := $(foreach dir, $(DIRLIST), -I$(dir)/include) $(ACSINC) ifdef MAKE_VXWORKS ACSINC := $(foreach dir, $(DIRLIST), -I$(dir)$(VW)/include) $(ACSINC) endif #SEARCHPATH := $(strip $(INTLIST)):$(SEARCHPATH) empty:= space:= $(empty) $(empty) SEARCHPATH := $(subst $(space),:,$(foreach dir, $(DIRLIST),$(dir)$(VW))):$(SEARCHPATH) ACSLIB := $(foreach dir, $(DIRLIST), -L$(dir)$(VW)/$(LIBDIR)) $(ACSLIB) PRJTOP = $(word 1, $(DIRLIST))$(VW) INSTALL_ROOT = $(word 1, $(DIRLIST)) CDBS = $(word 1, $(DIRLIST))/config/CDB/schemas PRJTOP_LOG = $(word 1, $(DIRLIST)) ACSIDL := $(foreach dir, $(DIRLIST), -I$(dir)/idl) $(ACSIDL) ifdef MAKE_VXWORKS ACSIDL := $(foreach dir, $(DIRLIST), -I$(dir)$(VW)/idl) $(ACSIDL) endif endif # # if INTROOT is defined, override or complete the search paths: ifdef INTROOT ACSINC := -I$(INTROOT)/include $(ACSINC) ifdef MAKE_VXWORKS ACSINC := -I$(INTROOT)$(VW)/include $(ACSINC) endif SEARCHPATH := $(INTROOT)$(VW):$(SEARCHPATH) ACSLIB := -L$(INTROOT)$(VW)/$(LIBDIR) $(ACSLIB) PRJTOP = $(INTROOT)$(VW) INSTALL_ROOT = $(INTROOT) CDBS = $(INTROOT)/config/CDB/schemas PRJTOP_LOG = $(INTROOT) ACSIDL := -I$(INTROOT)/idl $(ACSIDL) ifdef MAKE_VXWORKS ACSIDL := -I$(INTROOT)$(VW)/idl $(ACSIDL) endif endif # # ... if ACE to used # ifdef ACE_ROOT ifeq ($(platform),Cygwin) ACSINC := -I$(ACE_ROOT)/TAO -I$(ACE_ROOT)/TAO/tao \ -I$(ACE_ROOT)/TAO/tao/IORTable \ -I$(ACE_ROOT)/TAO/tao/IFR_Client \ -I$(ACE_ROOT)/TAO/tao/PortableServer \ -I$(ACE_ROOT)/TAO/tao/SmartProxies \ -I$(ACE_ROOT)/TAO/tao/DynamicAny \ -I$(ACE_ROOT)/TAO/tao/DynamicInterface \ -I$(ACE_ROOT)/TAO/tao/Messaging \ -I$(ACE_ROOT)/TAO/tao/Valuetype \ -I$(ACE_ROOT)/TAO/orbsvcs/orbsvcs -I$(ACE_ROOT)/TAO/orbsvcs \ -I$(ACE_ROOT)/TAO/orbsvcs/orbsvcs/Log \ -I$(ACE_ROOT) $(ACSINC) else ACSINC := -I$(ACE_ROOT)/TAO -I$(ACE_ROOT)/TAO/tao \ -I$(ACE_ROOT)/ace -I$(ACE_ROOT)/TAO/tao/IORTable \ -I$(ACE_ROOT)/TAO/tao/IFR_Client \ -I$(ACE_ROOT)/TAO/tao/PortableServer \ -I$(ACE_ROOT)/TAO/tao/SmartProxies \ -I$(ACE_ROOT)/TAO/tao/DynamicAny \ -I$(ACE_ROOT)/TAO/tao/DynamicInterface \ -I$(ACE_ROOT)/TAO/tao/Messaging \ -I$(ACE_ROOT)/TAO/tao/Valuetype \ -I$(ACE_ROOT)/TAO/orbsvcs/orbsvcs -I$(ACE_ROOT)/TAO/orbsvcs \ -I$(ACE_ROOT)/TAO/orbsvcs/orbsvcs/Log \ -I$(ACE_ROOT) $(ACSINC) endif ACSLIB := -L$(ACE_ROOT)/lib $(ACSLIB) TAO_MK_IDL_PATH := -I$(ACE_ROOT)/TAO/orbsvcs/orbsvcs -I$(ACE_ROOT)/TAO/tao -I$(ACE_ROOT)/TAO -I$(ACE_ROOT)/TAO/orbsvcs ifeq ($(platform),Cygwin) USER_LIB += -lACE -lACEXML -lACEXML_Parser -lACEXML_XML_Svc_Conf_Parser -lACE_ETCL -lACE_ETCL_Parser -lACE_Monitor_Control -lACE_gperf_lib USER_LIB += -lKokyu -lTAO -lTAO_AV -lTAO_AnyTypeCode -lTAO_BiDirGIOP -lTAO_CSD_Framework -lTAO_CSD_ThreadPool -lTAO_Catior_i -lTAO_CodecFactory USER_LIB += -lTAO_Codeset -lTAO_Compression -lTAO_CosConcurrency -lTAO_CosConcurrency_Serv -lTAO_CosConcurrency_Skel -lTAO_CosEvent USER_LIB += -lTAO_CosEvent_Serv -lTAO_CosEvent_Skel -lTAO_CosLifeCycle -lTAO_CosLifeCycle_Skel -lTAO_CosLoadBalancing -lTAO_CosNaming USER_LIB += -lTAO_CosNaming_Serv -lTAO_CosNaming_Skel -lTAO_CosNotification -lTAO_CosNotification_MC -lTAO_CosNotification_MC_Ext USER_LIB += -lTAO_CosNotification_Persist -lTAO_CosNotification_Serv -lTAO_CosNotification_Skel -lTAO_CosProperty -lTAO_CosProperty_Serv USER_LIB += -lTAO_CosProperty_Skel -lTAO_CosTime -lTAO_CosTime_Serv -lTAO_CosTime_Skel -lTAO_CosTrading -lTAO_CosTrading_Serv USER_LIB += -lTAO_CosTrading_Skel -lTAO_DiffServPolicy -lTAO_DsEventLogAdmin -lTAO_DsEventLogAdmin_Serv -lTAO_DsEventLogAdmin_Skel USER_LIB += -lTAO_DsLogAdmin -lTAO_DsLogAdmin_Serv -lTAO_DsLogAdmin_Skel -lTAO_DsNotifyLogAdmin -lTAO_DsNotifyLogAdmin_Serv USER_LIB += -lTAO_DsNotifyLogAdmin_Skel -lTAO_DynamicAny -lTAO_DynamicInterface -lTAO_ETCL -lTAO_EndpointPolicy -lTAO_FTORB_Utils USER_LIB += -lTAO_FTRT_ClientORB -lTAO_FTRT_EventChannel -lTAO_FT_ClientORB -lTAO_FT_ServerORB -lTAO_FaultTolerance -lTAO_FtRtEvent USER_LIB += -lTAO_IDL_BE -lTAO_IDL_FE -lTAO_IFRService -lTAO_IFR_BE -lTAO_IFR_Client -lTAO_IORInterceptor -lTAO_IORManip -lTAO_IORTable USER_LIB += -lTAO_ImR_Activator -lTAO_ImR_Activator_IDL -lTAO_ImR_Client -lTAO_ImR_Locator -lTAO_ImR_Locator_IDL -lTAO_Messaging USER_LIB += -lTAO_Monitor -lTAO_Notify_Service -lTAO_ObjRefTemplate -lTAO_PI -lTAO_PI_Server -lTAO_PortableGroup -lTAO_PortableServer USER_LIB += -lTAO_RTCORBA -lTAO_RTCORBAEvent -lTAO_RTEvent -lTAO_RTEventLogAdmin -lTAO_RTEventLogAdmin_Serv -lTAO_RTEventLogAdmin_Skel USER_LIB += -lTAO_RTEvent_Serv -lTAO_RTEvent_Skel -lTAO_RTKokyuEvent -lTAO_RTPortableServer -lTAO_RTSched -lTAO_RTSchedEvent -lTAO_RTScheduler USER_LIB += -lTAO_RT_Notification -lTAO_ReplicationManagerLib -lTAO_Security -lTAO_SmartProxies -lTAO_Strategies -lTAO_Svc_Utils -lTAO_TC USER_LIB += -lTAO_TC_IIOP -lTAO_TypeCodeFactory -lTAO_Utils -lTAO_Valuetype -lTAO_ZIOP endif ifdef USE_OPENDDS TAO_MK_IDL_PATH := $(TAO_MK_IDL_PATH) -I$(DDS_ROOT) TAO_IDLFLAGS += -Gdcps USER_INC += -I$(DDS_ROOT) USER_LIB += -L$(DDS_ROOT)/lib endif endif # # ... in the current module # # object dir here added because of ALMASW2002100 # MODINC = -I../include -I../object MODLIB = -L../lib MODIDL = -I../idl ifdef MODPATH ifeq ($(MODPATH), 1) SEARCHPATH := ..:$(SEARCHPATH) endif endif #### #### GCH, 2004-05-28 #### Temporary patch: #### I extend here PATH, LD_LIBRARY_PATH and PYTHON_PATH #### to be sure everything works also if not set #### in the user profile (MODPATH=0) #### PATH := ../bin:$(PATH) LD_LIBRARY_PATH := ../lib:$(LD_LIBRARY_PATH) PYTHONPATH := ../lib/python/site-packages:$(PYTHONPATH) # # 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 MODIDL := $(MODIDL) -I../../ws/idl endif # # Merge all of them: # # -local- --user-- --ACS-- I_PATH = $(MODINC) $(USER_INC) $(ACSINC) L_PATH = $(MODLIB) $(USER_LIB) $(ACSLIB) MK_IDL_PATH = $(MODIDL) $(USER_IDL) $(ACSIDL) ifdef MAKE_VXWORKS # -VxWorks- # Additional paths must come after -I-. VX_IPNET_INC_ALLOBJECTS for vx6.5+ # network stack extensions. I_PATH := $(I_PATH) $(VXINC) $(VX_IPNET_INC_ALLOBJECTS) $(TOOLS_INC) L_PATH := $(L_PATH) $(VXLIB) else # --X11-- -GNU&TCLTK- I_PATH := $(I_PATH) $(XINC) $(TOOLS_INC) L_PATH := $(L_PATH) $(XLIB) $(TOOLS_LIB) endif # # In the past, there was a way to force the use of the search path in all cases, # using the -I- option which has been deprecated since gcc 4. The new -iquote # option is not quite the same ... # # -I. is added to allow includes from current directory (this is the case of # lcc software) # Todo: Here was the only reference of ACS_GXX_4_OR_BETTER to conditionally add -I-. # So the definition can be removed. I_PATH := -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 # # ICT-5840: ensure that the installation directory really exists, i.e. that # at least one of INTROOT/INTLIST/ACSROOT is defined and points to an existing # directory. ifdef PRJTOP $(if $(wildcard $(PRJTOP)),,$(error The installation root-directory '$(PRJTOP)' does not exist - check your INTROOT/INTLIST/ACSROOT settings)) # for VxWorks, binaries and libraries are organized according # to supported CPU types # BIN = $(PRJTOP)/$(BINDIR) LIB = $(PRJTOP)/$(LIBDIR) INCLUDE = $(PRJTOP)/include MAN = $(PRJTOP)/man else $(error INTROOT, INTLIST and ACSROOT are all undefined - cannot determine an installation root-directory) 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 ACSROOT LASTCHANGE = "$(MODVERSION) $(shell date '+%d/%m/%y-%H:%M')" else LASTCHANGE = "development $(shell date '+%d/%m/%y-%H:%M')" endif ################################################# # Doxygen # ################################################# ifdef MAKE_PDF DOXYGEN_PDF = "pdf" else DOXYGEN_PDF = "" endif ################################################# # 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) tDir := tmp$(UNIQUE_NUMBER) #!## following for backward compatibility - VLTTOP should be removed in 2nd phase (ICT-3707) VLTTOP = $(PRJTOP) FILE=/tmp/acsMake_$(UNIQUE_NUMBER)_$(USER_NAME) INSTALL_TARGET= CLEAN_TARGET= CLEAN_DIST_TARGET= ALL_TARGET= ifneq ($(strip $(MAKE_VXWORKS)),) ifneq ($(strip $(VX_VERSION)),5.5) # vxworks_license_check must remain to make sure that license server is accessible. # Otherwise unclear delays or legal state. ALL_TARGET := vxworks_license_check $(ALL_TARGET) endif endif ifneq ($(strip $(INCLUDES)),) INSTALL_TARGET := $(INSTALL_TARGET) install_includes endif ifneq ($(strip $(CDB_SCHEMAS)),) INSTALL_TARGET := $(INSTALL_TARGET) install_CDB-Schemas endif ifneq ($(strip $(INSTALL_FILES)),) INSTALL_TARGET := $(INSTALL_TARGET) install_files endif ifneq ($(strip $(MANSECTIONS_INSTALL)),) INSTALL_TARGET := $(INSTALL_TARGET) install_man endif # # RTAI Part, both clean, install and all are augmented here # ifdef RTAI_HOME I_PATH := $(I_PATH) -I$(RTAI_HOME)/include -I$(LINUX_HOME) CFLAGS := $(CFLAGS) -DRTAI_HOME endif ####################################################################### # 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 ################################################# ################################################# # entry points for various language specific # features # ********************************************* CREATE_DIRS = include object doc $(if $(RTAI_HOME),rtai/$(kernel_install_subfold),) $(if $(RTAI_HOME),,$(if $(LINUX_HOME),kernel/$(kernel_install_subfold),)) bin lib lib/ACScomponents lib/python/site-packages idl config ifneq ($(strip $(MAKE_VXWORKS)),) ifneq ($(strip $(VX_VERSION)),6.9) # With new linking rules, folders are superfluous. CREATE_DIRS += src/.obj CREATE_DIRS += test/.obj endif endif # Never needed for VxWorks. $(platform) is the host OS, not the target OS, useless test. # For now keep for legacy VxWorks 6.7 ifeq ($(platform),Linux) ifneq ($(strip $(MAKE_VXWORKS)),) ifneq ($(strip $(VX_VERSION)),6.9) CREATE_DIRS += src/.purifydir CREATE_DIRS += test/.purifydir endif endif endif _MKDIRS:= $(shell for dir in $(CREATE_DIRS); \ do \ [[ -d ../$$dir ]] || mkdir -p ../$$dir; \ done) .PHONY: vxworks_license_check vxworks_license_check: $(AT) lmutil lmstat -c $(WRSD_LICENSE_FILE) >/dev/null || ( $(ECHO) "=== License Server not Reachable! Please contact your system administrator ==="; exit -1); CHECKS1 := $(foreach idl, $(IDL_FILES), $(foreach jar, $(JARFILES), $(if $(filter $(idl),$(jar)),$(error "$(idl) is duplicated in JARFILES and IDL_FILES",)) ) ) CHECKS2 := $(foreach cjar, $(COMPONENT_JARFILES), $(foreach jar, $(JARFILES), $(if $(filter $(cjar),$(jar)),$(error "$(cjar) is duplicated in JARFILES and COMPONENT_JARFILES",)) ) ) CHECKS3 := $(foreach idl, $(IDL_FILES), $(foreach xml, $(ACSERRDEF), $(if $(filter $(idl),$(xml)),$(warning $(xml) is duplicated, removing it),"$(idl)") ) ) isContained = $(findstring YES,$(foreach item,$(2), $(if $(filter $(1),$(item)),YES,NO))) ifneq ($(strip $(ACSERRDEF)),) IDL_FILES := $(foreach idl, $(IDL_FILES), \ $(if $(call isContained,$(idl),$(ACSERRDEF)),,$(idl)) \ ) endif ################################################# # PATTERN RULES ################################################# # - for object files ../object/%.o : %.c - @echo "== C Compiling: $( ../object/__ctordtor.c $(AT)$(CXX) -traditional -c ../object/__ctordtor.c -o ../object/__ctordtor.o $(AT)$(LD) -r -o $(@F:.o=.out) ../object/__ctordtor.o $@ $(AT)mv $(@F:.o=.out) $@ $(AT)rm ../object/__ctordtor.* endif ../object/%.o : ../object/%.cpp - @echo "== C++ Compiling generated code: $( ../object/__ctordtor.c $(AT)$(CC) -traditional -c ../object/__ctordtor.c -o ../object/__ctordtor.o $(AT)$(LD) -r -o $(@F:.o=.out) ../object/__ctordtor.o $@ $(AT)mv $(@F:.o=.out) $@ $(AT)rm ../object/__ctordtor.* endif ../object/%.o : %.cpp - @echo "== C++ Compiling: $( ../object/__ctordtor.c $(AT)$(CC) -traditional -c ../object/__ctordtor.c -o ../object/__ctordtor.o $(AT)$(LD) -r -o $(@F:.o=.out) ../object/__ctordtor.o $@ $(AT)mv $(@F:.o=.out) $@ $(AT)rm ../object/__ctordtor.* endif ../object/%.d: %.c @echo "== Dependencies C: $@" $(AT)$(CCDEP) $(CFLAGS) $(I_PATH) $(RTAI_CFLAGS) $(KERNEL_MODULE_CFLAGS) $($*_CFLAGS) $< | \ sed -e "s/$*\.o/..\/object\/$*.o ..\/object\/$*.d /" \ -e "s/:/: Makefile /" > $@ ; \ if [ ! -s $@ ]; then $(RM) $@ ; fi ../object/%.d: %.C @echo "== Dependencies: C++ $@" $(AT)$(CCDEP) $(CFLAGS) $(CPPFLAGS) $(I_PATH) $($*_CFLAGS) $< | \ sed -e "s/$*\.o/..\/object\/$*.o ..\/object\/$*.d /" \ -e "s/:/: Makefile /" > $@ ; \ if [ ! -s $@ ]; then $(RM) $@ ; fi ../object/%.d: %.cpp @echo "== Dependencies C++: $@" $(AT)$(CCDEP) $(CFLAGS) $(CPPFLAGS) $(I_PATH) $($*_CFLAGS) $< | \ sed -e "s/$*\.o/..\/object\/$*.o ..\/object\/$*.d /" \ -e "s/:/: Makefile /" > $@ ; \ if [ ! -s $@ ]; then $(RM) $@ ; fi ../object/%.d: ../object/%.cpp @echo "== Dependencies for generated code: $@" $(AT)$(CCDEP) $(CFLAGS) $(CPPFLAGS) $(I_PATH) $($*_CFLAGS) $< | \ sed -e "s/$*\.o/..\/object\/$*.o ..\/object\/$*.d /" \ -e "s/:/: Makefile /" > $@ ; \ if [ ! -s $@ ]; then $(RM) $@ ; fi ../object/%.cpp : %.c - @$(ECHO) "== Preprocessing: $(" is about 15x faster than "find ( -type f -o -type l )" # and still 20% faster than "find -empty")" ...) # ICT-5703: execute find as intended (i.e. not only using the last pattern in the list) clean_dist_all: -@$(ECHO) " .\c" -$(AT)if [ "$(SHLIB_EXT)" == "" ]; then \ find .. -name \*\.o -o -name \*\~ -o -name \.\*\~ | $(XARGS) -i $(RM) {} $(OUTPUT) ; \ else \ find .. -name \*\.o -o -name \*\~ -o -name \.\*\~ -o -name \*\.$(SHLIB_EXT) | $(XARGS) -i $(RM) {} $(OUTPUT); \ fi $(AT)echo "Cleaning empty directories..." ifneq ($(strip $(MANSECTIONS)),) $(AT) for i in $(MANSECTIONS) l ; \ do \ if [ -d ../man/man$${i} ]; then \ if [ "`/bin/ls -A ../man/man$${i}`" == "" ]; then \ $(RM) ../man/man$${i} ;\ fi; \ fi; \ done endif $(AT)for dir in $(foreach dir, $(CREATE_DIRS) man, $(dir)); \ do \ if [ -d ../$${dir} ]; then \ if [ "`/bin/ls -A ../$${dir}`" == "" ]; then \ $(RM) ../$${dir} ;\ fi; \ fi; \ done # define PHONY all names used as targets .PHONY : install_all .PHONY : install_includes .PHONY : install_CDB-Schemas .PHONY : install_files .PHONY : install_man .PHONY : install_rtai #CHECK this part is a possible replacement for acsMakeInstallFiles # but needs a lot of reworking. Since I need an urgent proof of concept here, # I just leave it for 'later'. # install_begin: @echo "Installing into target: $(PRJTOP)" # CHECK install_includes: includes_begin $(foreach inc, $(INCLUDES), install_include_$(inc)) #$(INCLUDE)/`(cd ../include; find . -name $(member) | tail -1 )` ) includes_begin: @echo ".....includes:" install_include_%: # COMP-498: Need to find subdir-location of include file # COMP-6627: cleaner exclusion of CVS/ and .svn/ administrative subdirectories. # ICT-5703: use precedence rules of find properly (note that the previous implementation also produced # the same result, but just by "coincidence", due to the presence of the -printf action. The current # implementation is more logical/readable and will also work without such additional action). # The shell code here below to determine how many hits is much faster than piping tFile into "wc -w" ! $(AT)tFile=`(cd ../include; find . \( ! \( -type d -name CVS -prune -o -name .svn -prune \) \) -name $* -printf "%p ")` ; \ nrHits=0; for x in $${tFile}; do (( ++nrHits )); done; \ if [ $${nrHits} -eq 1 ]; then \ tDir=`dirname $${tFile}` ;\ if [ ! -d $(INCLUDE)/$${tDir} ]; then mkdir -p $(INCLUDE)/$${tDir} ; fi ;\ $(ECHO) "\t$*" ;\ cp ../include/$${tFile} $(INCLUDE)/$${tFile}; \ chmod $(P644) $(INCLUDE)/$${tFile}; \ elif [ $${nrHits} -gt 1 ]; then \ echo "==> multiple $* files under ../include: $${tFile}"; exit 1; \ elif [ $${nrHits} -eq 0 ]; then \ echo "==> $* missing" ; exit 1; \ fi # I eliminate the dependency here below because I am not sure why it is needed # $(INCLUDE)/${tFile}: ../include/${tFile}" ############################## install_CDB-Schemas: CDB-Schemas_begin $(foreach member, $(CDB_SCHEMAS), $(CDBS)/$(member).xsd ) CDB-Schemas_begin: @echo "...CDB-Schemas:" $(CDBS)/%.xsd: ../config/CDB/schemas/%.xsd -$(AT)echo "$*" $(AT)cp ../config/CDB/schemas/$*.xsd $(CDBS)/$*.xsd $(AT)chmod $(P644) $(CDBS)/$*.xsd ############################### ifneq ($(strip $(MANSECTIONS_INSTALL)),) install_man: -@$(ECHO) ""; $(ECHO) "....man-pages:" -$(AT) $(foreach i, $(MANSECTIONS_INSTALL), $(ECHO) "\tsection $(i)"; cp ../man/man$(i)/*.$(i) $(MAN)/man$(i) ;) endif # # set standard action for 'test' # A test target is also present in the module Makefile template # To avoid the warning messages: # "overriding commands for target `test'" and # "ignoring old commands for target `test'" # a variable is used. # --------------------------------- # execute the TAT test. # ifndef NO_TEST_TARGET acsTest = test $(acsTest): export MAKE_PURE tat -nc -v @echo " . . . test done" endif pureReport: $(AT) purecov -export=.purifydir/CoverageReport .purifydir/*.pcv $(AT) echo "== Purify coverage report in '.purifydir/CoverageReport'." pureGUI: $(AT) ls .purifydir/purecov*.pcv > /dev/null 2>&1; if [ $$? = "0" ]; then (purecov -view purecov*.pcv &); fi $(AT) ls .purifydir/purify*.pv > /dev/null 2>&1; if [ $$? = "0" ]; then \ for member in `ls .purifydir/purify*.pv`; \ do purify -view $$member & \ done \ fi pureClean: $(AT) $(RM) ../{src,test}/.purifydir/purecov-*.{pcv,pv} $(AT) $(RM) ../{src,test}/.purifydir/purify-*.{pcv,pv} $(AT) $(RM) ./.purifydir/MemoryReport ./.purifydir/CoverageReport $(AT) echo "Purify files cleaned." .PHONY: gcovClean gcovClean: $(foreach lib,$(LIBRARY_LIST),clean_gcov_lib_$(lib)) $(foreach exe,$(EXECUTABLE_LIST),clean_gcov_exe_$(exe)) $(AT)$(ECHO) "Gcov files cleaned." ## all #___oOo___ ################################################################################# # # ENTERING FORMER ACSMAKEFILE.ALL AREA ################################################################################# # - for libraries specify the same path used by the linker # The format is: "::..." # The list is build using the same directories listed for the # linker search (L_PATH: a list of -L items) # To put the ":", I'm using some tricks with the make's string manipulation # functions: # 1) change " -L" into " :" (-L -L... ---> : :.... ) # The substitution has to be done in such a way that directory # names having the "-L" inside (e.g., /vlt/VLT-LITE) are not touched. # 2) take out -L../lib from L_PATH list (I know it must be the first) # 3) put "../lib" in front (../lib : :.... ) # # remove leading, trailing, extra blanks LIB_PATH_LIST = $(strip $(L_PATH)) # # "-L../lib -L -L ...." --> "-L../lib : : ...." # # see GNU Make 3.70, p.80 (Function Call Syntax) for the handling of the "space" empty:= space:= $(empty) $(empty) LIB_PATH_LIST := $(subst $(space)-L,$(space):,$(LIB_PATH_LIST)) # "-L../lib : : ...." --> "../lib : : ...." LIB_PATH_LIST := ../lib $(filter-out -L../lib,$(LIB_PATH_LIST)) # "../lib : : ...." --> "../lib::...." LIB_PATH_LIST := $(subst $(space):,:,$(LIB_PATH_LIST)) # - for object file vpath %.o ../object vpath %.h ../object $(subst -I, ,$(I_PATH)) #vpath %.so $(subst -L,:,$(strip $(L_PATH))) vpath %.a $(LIB_PATH_LIST) vpath %.$(SHLIB_EXT) $(LIB_PATH_LIST) vpath %.jar $(LIB_PATH_LIST) # # set search path for idl files # - for library members: no implicit rules. # If a library does not exist AND there is not an explicit rule (made by # acsMakeLibraryDependencies) just give a message. (see remark below for more). # %.a: @echo "ERROR: ----> $@ does not exist."; exit 1 # # Include Automatic Dependancies for C source files, libraries, .... # ------------------------------------------------------------------ # (REMARK: if the files are not existing make does them using the appropriate # rule as from above. (see GNU Make 3.64, pag 26) # # if the list of C-sources names is not empty, include dependencies files. # Todo: Nowhere used CSOURCENAMES := $(sort $(CSOURCENAMES)) ################################################# # set standard targets. # ################################################# # NOTE: do_scripts must be execute as first to bootstrap this module # NOTE: the sequence of these prerequisites seem to play a role in parallelization # in particular that do_exes comes before do_libs # .DEFAULT_GOAL := do_all .PHONY : do_all_aux do_all_aux : $(_MKDIR) $(ALL_TARGET) # Use built in Macros for passing on arguments to nested makes, to avoid that # MACRO=... gets lost on more targets. # MAKEFLAGS is like export "MAKEFLAGS=w -- MACRO=value" # -$(MAKEFLAGS) tricks for auto prepending - fails if starting with a whitespace # after auto removal of special options, e.g. b. # Therefore we use the old variant $(MFLAGS) $(MAKEOVERRIDES) which always starts with a dash. # Must be last option before the target, because a "--" is inserted. # Todo: Is recursive makefile call needed at all, if no output filtering is in place? .PHONY : do_all #!!#do_all : $(if $(strip $(LINK_FILES)),do_links_internal,) do_all : # $(AT) $(MAKE) -f $(THIS_MAKEFILE) DEPENDENCIES=on $(MAKE_FLAGS) do_all_aux $(AT) $(MAKE) --no-print-directory -f $(THIS_MAKEFILE) DEPENDENCIES=on $(MAKE_FLAGS) $(MFLAGS) $(MAKEOVERRIDES) do_all_aux # Todo: Nowhere used .PHONY : CppFiles CppFiles: $(addprefix ../object/, $(addsuffix .d, $(CSOURCENAMES))) .PHONY : install_all install_all : $(INSTALL_TARGET) .PHONY: directory_structure directory_structure: @echo "This target ($@) does nothing and will be removed in future versions" # #___oOo___