Paul,

Let me clarify this better - I'd like to have one generic Makefile
fo a huge source tree.  I only want the work directory created
in directories where it makes sense.  I want to keep that complexity
away from the developer - or as much as possible away from
developers.

I'm attaching a file I called Makebase that I use in all directories.
Makebase is itself built from a standard m4 file and application
dependant file m4 file.

Anyway, you'll notice from the attached Makebase that rules
only depend on the work directory if it does not exist. If you have
a work-around, that would be great.  I suppose I could add a
patched version of make to the directory but that's sub optimal !

This is a sample leaf Makefile using Makebase :

---------------------------
IN_CXXFILES=$(wildcard *.cc)

IN_TARGETS_ALL=$(MBS_BUILD_BIN)/ptycmd
IN_CXXLIBS=pty
IN_LINKOBJS=$(MBS_CXXOBJS)

include $(SERNET_ROOT)/make/Makebase

$(MBS_BUILDPREFIX)ptycmd : $(MBS_LINKOBJS)
---------------------------

This compiles and links an application called ptycmd

Features of Makebase:

1. automatically decends a directory tree.

2. control directory dependatncies through special
    targets <dirname>/all <dirname>/install etc.

e.g. - here is a Makefile that traverses directories.
----------------
include $(SERNET_ROOT)/make/Makebase

ptycmd/all : lib/all
comopt/all : lib/all
app/all : ptycmd/all
----------------
btw - these could be combined in one file.

3. be able to build more than one architecture in
   the same directory.

4. Single file controls how the entire build is done hence
   reliable way of setting things.

... on and on ... you get the point.  I don't want the
directory created unless a rule requires it !


Anyway, I broke my thumb yesterday so my typing
is somewhat slow and erroneous ... apologies in
advance.

Cheers
G


"Paul D. Smith" wrote:

> %% Gianni Mariani <[EMAIL PROTECTED]> writes:
>
>   gm> It seems the attached Makefile will fail for a clean build.  I
>   gm> read through the docs and it seems that there is nothing that says
>   gm> this should not work.  The problem is a invalid assumption that if
>   gm> a implicit prerequisite's directory does not exist at the
>   gm> beginning then it must not be a candidate.  It fails to not notice
>   gm> that during the bulding of other rules the directory will in fact
>   gm> be created.
>
> There is a known issue with GNU make's directory caching.  I've
> considered adding a command-line option to disable it for makefiles
> where it causes problems.
>
> However, I wonder if you have considered doing this a different way?
> Personally I think that depending on directories is not really a good
> idea.  While your method does solve most of the serious problems, it
> seems hard to understand.
>
> What I generally do is just use the $(shell ...) function to create
> any needed directories when the makefile is invoked, as a kind of
> pre-op.  Like this:
>
>   WORKDIR=work.i686
>   __dummy := $(shell [ -d $(WORKDIR) ] || mkdir -p $(WORKDIR))
>
> Now that directory gets created, if it doesn't exist, when the makefile
> is parsed.  It's always there, you don't need any target to depend on
> it, etc.
>
> --
> -------------------------------------------------------------------------------
>  Paul D. Smith <[EMAIL PROTECTED]>          Find some GNU make tips at:
>  http://www.gnu.org                      http://www.ultranet.com/~pauld/gmake/
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
#
# Makebase
#               *****************************************************************
#               * generated from Makebase.m4 - DO NOT EDIT THIS FILE - it will  *
#               * be overwritten.  Edit MakeAppDefs.m4 for application specific *
#               * changes and Makebase.m4 for Makebase structure changes.              
 *
#               *****************************************************************
#
#       This is intended to be used in every Makefile in the system
#       being built. It provides the basic support for all standard
#       targets and standard variables.
#
#       There are a number of advantages to keeping a unified make structure.
#       1. Simplifies systems with complex subdirectories, avoiding repeating
#               common build commands making it easy to make sweeping simple
#               changes to the build process.
#       2. Simplifies Makefile creation in each subdirectory.  Simply
#               defining a couple of variables and then including this file.
#               e.g.
#               IN_CPPFILES=$(wildcard *.cc)
#               IN_TARGETS_ALL=$(MBS_CXXOBJS)
#               include $(MAKEBASEHOME)/Makebase
#
#       The basic method is that all the local Makefile files need is
#       to define a set variables that determine desired operation
#       and then include Makebase followed by any rules specific to
#       to that file.
#
#       Variable prefix conventions -
#               IN_             defined in the host Makefile
#               INL_    defined in the user's environment
#               INS_    defined for subsystem
#               ING_    defined globally - usually defined in MakeAppDefs.m4
#               MBS_    Makefile variables in Makebase
#               M4X_    M4 macros defined in Makebase.m4 (private ones)
#               MIN_    M4 macros defined in Makebase.m4 (public ones)
#               IN4_    M4 macros defined in MakeAppDefs.m4
#               xxx_    (Pick your favorite <xxx_> Makefile macros defined
#                                       in MakeAppDefs.m4
#
# The following appears as the Makebase file
#       Standard targets are:
#
#               The following targets are defined by Makebase.  To perform
#               an operation on a target you will need to define IN_TARGETS_<TARGET>
#               before you include this file.  e.g. if you would like to have XFile
#               build on the `all' target - do this :
#                       IN_TARGETS_ALL=XFile
#
#               Similarly if you want XFile removed on when you run 'make clean' do
#               this e.g.:
#                       IN_FILES_CLEAN=XFile
#
#               Or if you have your own clean target "myclean", you can have the
#               default clean target depend on it - e.g.:
#                       IN_TARGETS_CLEAN=myclean
#
#               Defining IN?_SUBMAKEFILES with a list of Makfiles that also
#               need to be executed will cause a list of targets to be generated
#               that can be used.  For example :
#                       IN_SUBMAKEFILES=foo/Makefile bar/Makefile
#               Will cause targets "foo/all foo/setup ... bar/all etc" to also be
#               defined - these will also have default actions that will cause
#               the sub-directories to be built.
#                       ING_SUBMAKEFILES by default is defined like:
#                       ING_SUBMAKEFILES=$(wildcard */Makefile)
#               IN?_SUBMAKEDIRS operates in much the same was as ING_SUBMAKEFILES
#               except that it is a list of directories.
#
#
# all              perform regular build - create all build files
# setup            on a top level make it will build a directory structure
# test             run unit test
# clean            remome intermediate build files
# mostlyclean      like clean
# distclean        revert to checked out state
# docs             build whatever docs need building
# uninstall        targets that remove from installation
# cvsadd_all       add all files to CVS - do this after a distclean
#
#       Environment variables:
#
#               The list of environment variables below change the behaviour of
#               this Makefile. The '?' can be one of these:
#                       <empty> - Define these in the input Makefile for the directory
#                       G - These are global defines - usually defined in this file.
#                       L - Defined in the user's environment
#                       S - Defined in the subsystem
#               For option like variables there is a priority order for
#               these defines (L, <empty>, S, G).
#

# IN?_TARGETS_ALL          dependantcies for "all" base target
# IN?_PARALLEL_JOBS_ALL    Number of jobs to execute in parallel
# IN?_TARGETS_SETUP        dependantcies for "setup" base target
# IN?_PARALLEL_JOBS_SETUP  Number of jobs to execute in parallel
# IN?_TARGETS_TEST         dependantcies for "test" base target
# IN?_PARALLEL_JOBS_TEST   Number of jobs to execute in parallel
# IN?_TARGETS_CLEAN        dependantcies for "clean" base target
# IN?_PARALLEL_JOBS_CLEAN  Number of jobs to execute in parallel
# IN?_TARGETS_MOSTLYCLEAN  dependantcies for "mostlyclean" base target
# IN?_PARALLEL_JOBS_MOSTLYCLEAN Number of jobs to execute in parallel
# IN?_TARGETS_DISTCLEAN    dependantcies for "distclean" base target
# IN?_PARALLEL_JOBS_DISTCLEAN Number of jobs to execute in parallel
# IN?_TARGETS_DOCS         dependantcies for "docs" base target
# IN?_PARALLEL_JOBS_DOCS   Number of jobs to execute in parallel
# IN?_TARGETS_UNINSTALL    dependantcies for "uninstall" base target
# IN?_PARALLEL_JOBS_UNINSTALL Number of jobs to execute in parallel
# IN?_TARGETS_CVSADD_ALL   dependantcies for "cvsadd_all" base target
# IN?_PARALLEL_JOBS_CVSADD_ALL Number of jobs to execute in parallel
# IN?_BUILDDIR             Option - Directory where all built files are placed
#                          MBS_BUILDPREFIX : Build file prefix dervied +MBS_BUILDDIR+/ 
only when MBS_BUILDDIR is set
# IN?_LIBS                 libraries for linking
#                          MBS_LIBS_OPTS : -l options for linking CLIBS
# IN?_SUBMAKEFILES         List of Makefiles in directories to be built
#                          MBS_SUBMAKEFDIRS is MBS_SUBMAKEFILES with extensions 
/Makefile changed to 
# IN?_SUBMAKEDIRS          List of directories to be built
# IN?_CXXFILES             Files with .cc extension - creates MBS_CXXOBJS
#                          MBS_CXXOBJS is MBS_CXXFILES with extensions .cc changed to 
.o
# IN?_CFILES               Files with .c - creates MBS_COBJS
#                          MBS_COBJS is MBS_CFILES with extensions .c changed to .o
# IN?_YYACC_FILES          Files with .yy - creates MBS_YYACCCXX_FILES
#                          MBS_YYACCCXX_FILES is MBS_YYACC_FILES with extensions .yy 
changed to .tab.cc
#                          MBS_YYACCHXX_FILES is MBS_YYACC_FILES with extensions .yy 
changed to .tab.hh
#                          MBS_YYACCOBJ_FILES is MBS_YYACC_FILES with extensions .yy 
changed to .tab.o
# IN?_TEST_CXXFILES        Test files with .cc extension - creates MBS_CXXOBJS
#                          MBS_TEST_CXXOBJS is MBS_TEST_CXXFILES with extensions .cc 
changed to .o
# IN?_TEST_CFILES          Test files with .c - creates MBS_COBJS
#                          MBS_TEST_COBJS is MBS_TEST_CFILES with extensions .c 
changed to .o
# IN?_BUILD_HOME           Option - Where all files to be installed go
# IN?_BUILD_HOME_DIRS      The list of directories in build home
#                          MBS_BUILD_NAMES : List of actual build directories
# IN?_IDIRS                A list of directories to create -I flags
#                          MBS_ICFLAGS : -I options for pre processor
# IN?_LDIRS                A list of directories to create -L flags
#                          MBS_LCFLAGS : -L options for linker
# IN?_LINKOBJS             A list of objects to link by default
# IN?_LDFLAGS              Options to the linker
# IN?_CXXLIBS              A list of library names to be included as -l flags
#                          MBS_CXXLIBS_OPTS : -l options for linking CXXLIBS
# IN?_OCFLAGS              Optimizer or debugging flags
# IN?_CFLAGS               Other flags for the compiler
# IN?_CXXFLAGS             Other flags for the c++ compiler
# IN?_ASFLAGS              flags for the assembler
# IN?_CPPFLAGS             Other flags for the c/c++ pre processor
# IN?_YFLAGS               Yacc (or bison) flags
# IN?_LFLAGS               Lex (or flex) flags
# IN?_FILES_CLEAN          Files to remove when running target clean
# IN?_FILES_MOSTLYCLEAN    Files (not including CLEAN list) to remove for mostlyclean
# IN?_FILES_DISTCLEAN      Files (not including CLEAN and MOSTLYCLEAN) to remove for 
distclean
#

#
# If there is a Makefile.in in the current directory then include the
# file here.
#
MBS_MAKEFILE_IN=$(wildcard Makefile.in)
ifneq ($(MBS_MAKEFILE_IN),)

# first make sure that all is declared ...
all:

include $(MBS_MAKEFILE_IN)
endif


#
# Standard definitions for many useful commands.
# 


ifeq ($(SERNET_ROOT),)
x:=$(shell exec echo "------------------------------------------------------------" 
1>&2)
x:=$(shell exec echo "ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR" 1>&2)
x:=$(shell exec echo "SERNET_ROOT is undefined, SERNET_ROOT is the top level 
directory" 1>&2)
x:=$(shell exec echo "for yasql. Set this environment variable and try again" 1>&2)
x:=$(shell exec echo "------------------------------------------------------------" 
1>&2)
# syntax error here
.exit
endif

ifeq ($(SERNET_ARCH),)
SERNET_ARCH=gx86
endif

# Special defines for yasql
SERNETM_SUPPORTED_ARCHS=.gx86 .mipsl .mipsb .sspc .wnt

#
# Pick the build architecture

ifeq (,$(filter %$(SERNET_ARCH),$(SERNETM_SUPPORTED_ARCHS)))
x:=$(shell exec echo "------------------------------------------------------------" 
1>&2)
x:=$(shell exec echo "ERROR - ERROR - ERROR - ERROR - ERROR - ERROR - ERROR" 1>&2)
x:=$(shell exec echo "SERNET_ARCH is set to $(SERNET_ARCH) which is not a supported" 
1>&2)
x:=$(shell exec echo "architecture.  Set SERNET_ARCH to one of :" 1>&2)
x:=$(shell exec echo "  $(SERNET_SUPPORTED_ARCHS)" 1>&2)
x:=$(shell exec echo "You can correct this by adding auto detection in " 1>&2)
x:=$(shell exec echo "  $(SERNET_ROOT)/environment/csh/setup" 1>&2)
x:=$(shell exec echo "or setting SERNET_ARCH explicitly" 1>&2)
x:=$(shell exec echo "------------------------------------------------------------" 
1>&2)
x:=$(shell echo .exit; exit 1  )
# syntax error here
.exit
endif


# Global defaults for various variables.
#
ING_DEFAULT_CFLAGS=-fPIC -Werror -Wall
ING_DEFAULT_CXXFLAGS=-fPIC -Werror -Wall
ING_DEFAULT_FILES_CLEAN=*.BAK core jnk *.o $(MBS_BUILDDIR)

#
# mostlyclean should perform all that clean does and more
ING_DEFAULT_FILES_MOSTLYCLEAN=$(MBS_FILES_CLEAN)
ING_DEFAULT_TARGETS_MOSTLYCLEAN=$(MBS_TARGETS_CLEAN)

#
# distclean should perform all that mostlyclean does and more
ING_DEFAULT_FILES_DISTCLEAN=$(MBS_FILES_MOSTLYCLEAN)
ING_DEFAULT_TARGETS_DISTCLEAN=$(MBS_TARGETS_MOSTLYCLEAN)

#
# try to execute subdirectories in parallel for ALL.
ING_DEFAULT_PARALLEL_JOBS_ALL=2

#
# find all Makefile files in subdirectories - causes automatic
# traversal of all subdirectoris containing Makefile.
ING_DEFAULT_SUBMAKEFILES=$(wildcard */Makefile)

#
# files get built into a subdirectory
ING_DEFAULT_BUILDDIR=work.$(SERNET_ARCH)
ING_DEFAULT_BUILD_HOME=$(SERNET_ROOT)

#
# Include files also from the build directory - for generated
# header files
MBS_GEN_INCLUDEDIRS=/hda3/gianni/limbo/SerialNet/src/external/CommonC++/ 
/hda3/gianni/limbo/SerialNet/src/external/CommonC++/common/ 
/hda3/gianni/limbo/SerialNet/src/external/CommonC++/posix/ 
/hda3/gianni/limbo/SerialNet/src/lib/

ING_DEFAULT_IDIRS=. $(MBS_BUILDDIR) $(MBS_GEN_INCLUDEDIRS)



MBS_BUILD_LIB=$(MBS_BUILD_HOME)/$(MBS_BUILDPREFIX)lib
MBS_BUILD_BIN=$(MBS_BUILD_HOME)/$(MBS_BUILDPREFIX)bin



ING_DEFAULT_BUILD_HOME_DIRS=lib bin 

ING_DEFAULT_LDIRS=$(MBS_BUILD_LIB)

ifeq ($(CC_EXE),)
CC_EXE=gcc
endif
#CC_EXE=gcc
ifeq ($(CXX_EXE),)
CXX_EXE=/usr/local/bin/g++
endif
CC=$(CC_EXE)
CXX=$(CPPC_EXE)
INSTALL=/usr/bin/install
MAKE=make
RMF=/bin/rm -f
RMRF=/bin/rm -rf
LN=/bin/ln -f
MKDIR=/bin/mkdir
BUNZIP2=/usr/bin/bunzip2
TAR=/bin/tar
CHMOD=/bin/chmod
TEXI2HTML=/usr/bin/texi2html
CP=/bin/cp
GUNZIP=/bin/gunzip
FIND=/usr/bin/find
TOUCH=/bin/touch
M4=/usr/bin/m4
CVS=/usr/bin/cvs
BISON=/usr/bin/bison
MV=/bin/mv



# MBS_TARGETS_ALL definition
#
# Assign default value of IN4_TARGETS_ALL
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_ALL),1)
ING_TARGETS_ALL=$(ING_DEFAULT_TARGETS_ALL)
endif

MBS_TARGETS_ALL=$(INL_TARGETS_ALL) $(ING_TARGETS_ALL)$ $(INS_TARGETS_ALL) 
$(IN_TARGETS_ALL)

# MBS_PARALLEL_JOBS_ALL definition
#
# Pick the option for MBS_PARALLEL_JOBS_ALL - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_ALL),)
MBS_PARALLEL_JOBS_ALL=$(INL_PARALLEL_JOBS_ALL)
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_ALL),1)
MBS_PARALLEL_JOBS_ALL=
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_ALL),1)
ifneq ($(IN_PARALLEL_JOBS_ALL),)
MBS_PARALLEL_JOBS_ALL=$(IN_PARALLEL_JOBS_ALL)
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_ALL),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_ALL),1)
MBS_PARALLEL_JOBS_ALL=
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_ALL),1)
ifneq ($(INS_PARALLEL_JOBS_ALL),)
MBS_PARALLEL_JOBS_ALL=$(INS_PARALLEL_JOBS_ALL)
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_ALL),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_ALL),1)
MBS_PARALLEL_JOBS_ALL=
MBS_ISSET_PARALLEL_JOBS_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_ALL),1)
MBS_PARALLEL_JOBS_ALL=$(ING_DEFAULT_PARALLEL_JOBS_ALL)
endif

# MBS_PARALLEL_ALL is a transform of MBS_MBS_PARALLEL_JOBS_ALL
#

MBS_PARALLEL_ALL=$(foreach zX,$(MBS_PARALLEL_JOBS_ALL),-j $(zX))

# MBS_TARGETS_SETUP definition
#
# Assign default value of IN4_TARGETS_SETUP
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_SETUP),1)
ING_TARGETS_SETUP=$(ING_DEFAULT_TARGETS_SETUP)
endif

MBS_TARGETS_SETUP=$(INL_TARGETS_SETUP) $(ING_TARGETS_SETUP)$ $(INS_TARGETS_SETUP) 
$(IN_TARGETS_SETUP)

# MBS_PARALLEL_JOBS_SETUP definition
#
# Pick the option for MBS_PARALLEL_JOBS_SETUP - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_SETUP),)
MBS_PARALLEL_JOBS_SETUP=$(INL_PARALLEL_JOBS_SETUP)
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_SETUP),1)
MBS_PARALLEL_JOBS_SETUP=
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_SETUP),1)
ifneq ($(IN_PARALLEL_JOBS_SETUP),)
MBS_PARALLEL_JOBS_SETUP=$(IN_PARALLEL_JOBS_SETUP)
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_SETUP),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_SETUP),1)
MBS_PARALLEL_JOBS_SETUP=
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_SETUP),1)
ifneq ($(INS_PARALLEL_JOBS_SETUP),)
MBS_PARALLEL_JOBS_SETUP=$(INS_PARALLEL_JOBS_SETUP)
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_SETUP),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_SETUP),1)
MBS_PARALLEL_JOBS_SETUP=
MBS_ISSET_PARALLEL_JOBS_SETUP=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_SETUP),1)
MBS_PARALLEL_JOBS_SETUP=$(ING_DEFAULT_PARALLEL_JOBS_SETUP)
endif

# MBS_PARALLEL_SETUP is a transform of MBS_MBS_PARALLEL_JOBS_SETUP
#

MBS_PARALLEL_SETUP=$(foreach zX,$(MBS_PARALLEL_JOBS_SETUP),-j $(zX))

# MBS_TARGETS_TEST definition
#
# Assign default value of IN4_TARGETS_TEST
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_TEST),1)
ING_TARGETS_TEST=$(ING_DEFAULT_TARGETS_TEST)
endif

MBS_TARGETS_TEST=$(INL_TARGETS_TEST) $(ING_TARGETS_TEST)$ $(INS_TARGETS_TEST) 
$(IN_TARGETS_TEST)

# MBS_PARALLEL_JOBS_TEST definition
#
# Pick the option for MBS_PARALLEL_JOBS_TEST - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_TEST),)
MBS_PARALLEL_JOBS_TEST=$(INL_PARALLEL_JOBS_TEST)
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_TEST),1)
MBS_PARALLEL_JOBS_TEST=
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_TEST),1)
ifneq ($(IN_PARALLEL_JOBS_TEST),)
MBS_PARALLEL_JOBS_TEST=$(IN_PARALLEL_JOBS_TEST)
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_TEST),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_TEST),1)
MBS_PARALLEL_JOBS_TEST=
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_TEST),1)
ifneq ($(INS_PARALLEL_JOBS_TEST),)
MBS_PARALLEL_JOBS_TEST=$(INS_PARALLEL_JOBS_TEST)
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_TEST),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_TEST),1)
MBS_PARALLEL_JOBS_TEST=
MBS_ISSET_PARALLEL_JOBS_TEST=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_TEST),1)
MBS_PARALLEL_JOBS_TEST=$(ING_DEFAULT_PARALLEL_JOBS_TEST)
endif

# MBS_PARALLEL_TEST is a transform of MBS_MBS_PARALLEL_JOBS_TEST
#

MBS_PARALLEL_TEST=$(foreach zX,$(MBS_PARALLEL_JOBS_TEST),-j $(zX))

# MBS_TARGETS_CLEAN definition
#
# Assign default value of IN4_TARGETS_CLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_CLEAN),1)
ING_TARGETS_CLEAN=$(ING_DEFAULT_TARGETS_CLEAN)
endif

MBS_TARGETS_CLEAN=$(INL_TARGETS_CLEAN) $(ING_TARGETS_CLEAN)$ $(INS_TARGETS_CLEAN) 
$(IN_TARGETS_CLEAN)

# MBS_PARALLEL_JOBS_CLEAN definition
#
# Pick the option for MBS_PARALLEL_JOBS_CLEAN - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_CLEAN),)
MBS_PARALLEL_JOBS_CLEAN=$(INL_PARALLEL_JOBS_CLEAN)
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_CLEAN),1)
MBS_PARALLEL_JOBS_CLEAN=
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CLEAN),1)
ifneq ($(IN_PARALLEL_JOBS_CLEAN),)
MBS_PARALLEL_JOBS_CLEAN=$(IN_PARALLEL_JOBS_CLEAN)
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CLEAN),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_CLEAN),1)
MBS_PARALLEL_JOBS_CLEAN=
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CLEAN),1)
ifneq ($(INS_PARALLEL_JOBS_CLEAN),)
MBS_PARALLEL_JOBS_CLEAN=$(INS_PARALLEL_JOBS_CLEAN)
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CLEAN),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_CLEAN),1)
MBS_PARALLEL_JOBS_CLEAN=
MBS_ISSET_PARALLEL_JOBS_CLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CLEAN),1)
MBS_PARALLEL_JOBS_CLEAN=$(ING_DEFAULT_PARALLEL_JOBS_CLEAN)
endif

# MBS_PARALLEL_CLEAN is a transform of MBS_MBS_PARALLEL_JOBS_CLEAN
#

MBS_PARALLEL_CLEAN=$(foreach zX,$(MBS_PARALLEL_JOBS_CLEAN),-j $(zX))

# MBS_TARGETS_MOSTLYCLEAN definition
#
# Assign default value of IN4_TARGETS_MOSTLYCLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_MOSTLYCLEAN),1)
ING_TARGETS_MOSTLYCLEAN=$(ING_DEFAULT_TARGETS_MOSTLYCLEAN)
endif

MBS_TARGETS_MOSTLYCLEAN=$(INL_TARGETS_MOSTLYCLEAN) $(ING_TARGETS_MOSTLYCLEAN)$ 
$(INS_TARGETS_MOSTLYCLEAN) $(IN_TARGETS_MOSTLYCLEAN)

# MBS_PARALLEL_JOBS_MOSTLYCLEAN definition
#
# Pick the option for MBS_PARALLEL_JOBS_MOSTLYCLEAN - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_MOSTLYCLEAN),)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=$(INL_PARALLEL_JOBS_MOSTLYCLEAN)
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
ifneq ($(IN_PARALLEL_JOBS_MOSTLYCLEAN),)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=$(IN_PARALLEL_JOBS_MOSTLYCLEAN)
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
ifneq ($(INS_PARALLEL_JOBS_MOSTLYCLEAN),)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=$(INS_PARALLEL_JOBS_MOSTLYCLEAN)
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=
MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_MOSTLYCLEAN),1)
MBS_PARALLEL_JOBS_MOSTLYCLEAN=$(ING_DEFAULT_PARALLEL_JOBS_MOSTLYCLEAN)
endif

# MBS_PARALLEL_MOSTLYCLEAN is a transform of MBS_MBS_PARALLEL_JOBS_MOSTLYCLEAN
#

MBS_PARALLEL_MOSTLYCLEAN=$(foreach zX,$(MBS_PARALLEL_JOBS_MOSTLYCLEAN),-j $(zX))

# MBS_TARGETS_DISTCLEAN definition
#
# Assign default value of IN4_TARGETS_DISTCLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_DISTCLEAN),1)
ING_TARGETS_DISTCLEAN=$(ING_DEFAULT_TARGETS_DISTCLEAN)
endif

MBS_TARGETS_DISTCLEAN=$(INL_TARGETS_DISTCLEAN) $(ING_TARGETS_DISTCLEAN)$ 
$(INS_TARGETS_DISTCLEAN) $(IN_TARGETS_DISTCLEAN)

# MBS_PARALLEL_JOBS_DISTCLEAN definition
#
# Pick the option for MBS_PARALLEL_JOBS_DISTCLEAN - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_DISTCLEAN),)
MBS_PARALLEL_JOBS_DISTCLEAN=$(INL_PARALLEL_JOBS_DISTCLEAN)
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_DISTCLEAN),1)
MBS_PARALLEL_JOBS_DISTCLEAN=
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DISTCLEAN),1)
ifneq ($(IN_PARALLEL_JOBS_DISTCLEAN),)
MBS_PARALLEL_JOBS_DISTCLEAN=$(IN_PARALLEL_JOBS_DISTCLEAN)
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DISTCLEAN),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_DISTCLEAN),1)
MBS_PARALLEL_JOBS_DISTCLEAN=
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DISTCLEAN),1)
ifneq ($(INS_PARALLEL_JOBS_DISTCLEAN),)
MBS_PARALLEL_JOBS_DISTCLEAN=$(INS_PARALLEL_JOBS_DISTCLEAN)
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DISTCLEAN),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_DISTCLEAN),1)
MBS_PARALLEL_JOBS_DISTCLEAN=
MBS_ISSET_PARALLEL_JOBS_DISTCLEAN=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DISTCLEAN),1)
MBS_PARALLEL_JOBS_DISTCLEAN=$(ING_DEFAULT_PARALLEL_JOBS_DISTCLEAN)
endif

# MBS_PARALLEL_DISTCLEAN is a transform of MBS_MBS_PARALLEL_JOBS_DISTCLEAN
#

MBS_PARALLEL_DISTCLEAN=$(foreach zX,$(MBS_PARALLEL_JOBS_DISTCLEAN),-j $(zX))

# MBS_TARGETS_DOCS definition
#
# Assign default value of IN4_TARGETS_DOCS
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_DOCS),1)
ING_TARGETS_DOCS=$(ING_DEFAULT_TARGETS_DOCS)
endif

MBS_TARGETS_DOCS=$(INL_TARGETS_DOCS) $(ING_TARGETS_DOCS)$ $(INS_TARGETS_DOCS) 
$(IN_TARGETS_DOCS)

# MBS_PARALLEL_JOBS_DOCS definition
#
# Pick the option for MBS_PARALLEL_JOBS_DOCS - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_DOCS),)
MBS_PARALLEL_JOBS_DOCS=$(INL_PARALLEL_JOBS_DOCS)
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_DOCS),1)
MBS_PARALLEL_JOBS_DOCS=
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DOCS),1)
ifneq ($(IN_PARALLEL_JOBS_DOCS),)
MBS_PARALLEL_JOBS_DOCS=$(IN_PARALLEL_JOBS_DOCS)
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DOCS),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_DOCS),1)
MBS_PARALLEL_JOBS_DOCS=
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DOCS),1)
ifneq ($(INS_PARALLEL_JOBS_DOCS),)
MBS_PARALLEL_JOBS_DOCS=$(INS_PARALLEL_JOBS_DOCS)
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DOCS),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_DOCS),1)
MBS_PARALLEL_JOBS_DOCS=
MBS_ISSET_PARALLEL_JOBS_DOCS=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_DOCS),1)
MBS_PARALLEL_JOBS_DOCS=$(ING_DEFAULT_PARALLEL_JOBS_DOCS)
endif

# MBS_PARALLEL_DOCS is a transform of MBS_MBS_PARALLEL_JOBS_DOCS
#

MBS_PARALLEL_DOCS=$(foreach zX,$(MBS_PARALLEL_JOBS_DOCS),-j $(zX))

# MBS_TARGETS_UNINSTALL definition
#
# Assign default value of IN4_TARGETS_UNINSTALL
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_UNINSTALL),1)
ING_TARGETS_UNINSTALL=$(ING_DEFAULT_TARGETS_UNINSTALL)
endif

MBS_TARGETS_UNINSTALL=$(INL_TARGETS_UNINSTALL) $(ING_TARGETS_UNINSTALL)$ 
$(INS_TARGETS_UNINSTALL) $(IN_TARGETS_UNINSTALL)

# MBS_PARALLEL_JOBS_UNINSTALL definition
#
# Pick the option for MBS_PARALLEL_JOBS_UNINSTALL - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_UNINSTALL),)
MBS_PARALLEL_JOBS_UNINSTALL=$(INL_PARALLEL_JOBS_UNINSTALL)
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_UNINSTALL),1)
MBS_PARALLEL_JOBS_UNINSTALL=
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_UNINSTALL),1)
ifneq ($(IN_PARALLEL_JOBS_UNINSTALL),)
MBS_PARALLEL_JOBS_UNINSTALL=$(IN_PARALLEL_JOBS_UNINSTALL)
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_UNINSTALL),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_UNINSTALL),1)
MBS_PARALLEL_JOBS_UNINSTALL=
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_UNINSTALL),1)
ifneq ($(INS_PARALLEL_JOBS_UNINSTALL),)
MBS_PARALLEL_JOBS_UNINSTALL=$(INS_PARALLEL_JOBS_UNINSTALL)
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_UNINSTALL),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_UNINSTALL),1)
MBS_PARALLEL_JOBS_UNINSTALL=
MBS_ISSET_PARALLEL_JOBS_UNINSTALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_UNINSTALL),1)
MBS_PARALLEL_JOBS_UNINSTALL=$(ING_DEFAULT_PARALLEL_JOBS_UNINSTALL)
endif

# MBS_PARALLEL_UNINSTALL is a transform of MBS_MBS_PARALLEL_JOBS_UNINSTALL
#

MBS_PARALLEL_UNINSTALL=$(foreach zX,$(MBS_PARALLEL_JOBS_UNINSTALL),-j $(zX))

# MBS_TARGETS_CVSADD_ALL definition
#
# Assign default value of IN4_TARGETS_CVSADD_ALL
#
ifneq ($(ING_SUPPRESS_DEFAULT_TARGETS_CVSADD_ALL),1)
ING_TARGETS_CVSADD_ALL=$(ING_DEFAULT_TARGETS_CVSADD_ALL)
endif

MBS_TARGETS_CVSADD_ALL=$(INL_TARGETS_CVSADD_ALL) $(ING_TARGETS_CVSADD_ALL)$ 
$(INS_TARGETS_CVSADD_ALL) $(IN_TARGETS_CVSADD_ALL)

# MBS_PARALLEL_JOBS_CVSADD_ALL definition
#
# Pick the option for MBS_PARALLEL_JOBS_CVSADD_ALL - priority in L, <none>, S, G order
#
ifneq ($(INL_PARALLEL_JOBS_CVSADD_ALL),)
MBS_PARALLEL_JOBS_CVSADD_ALL=$(INL_PARALLEL_JOBS_CVSADD_ALL)
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif

ifeq ($(INL_UNSET_PARALLEL_JOBS_CVSADD_ALL),1)
MBS_PARALLEL_JOBS_CVSADD_ALL=
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL),1)
ifneq ($(IN_PARALLEL_JOBS_CVSADD_ALL),)
MBS_PARALLEL_JOBS_CVSADD_ALL=$(IN_PARALLEL_JOBS_CVSADD_ALL)
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL),1)
ifeq ($(IN_UNSET_PARALLEL_JOBS_CVSADD_ALL),1)
MBS_PARALLEL_JOBS_CVSADD_ALL=
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL),1)
ifneq ($(INS_PARALLEL_JOBS_CVSADD_ALL),)
MBS_PARALLEL_JOBS_CVSADD_ALL=$(INS_PARALLEL_JOBS_CVSADD_ALL)
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL),1)
ifeq ($(INS_UNSET_PARALLEL_JOBS_CVSADD_ALL),1)
MBS_PARALLEL_JOBS_CVSADD_ALL=
MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL=1
endif
endif

ifneq ($(MBS_ISSET_PARALLEL_JOBS_CVSADD_ALL),1)
MBS_PARALLEL_JOBS_CVSADD_ALL=$(ING_DEFAULT_PARALLEL_JOBS_CVSADD_ALL)
endif

# MBS_PARALLEL_CVSADD_ALL is a transform of MBS_MBS_PARALLEL_JOBS_CVSADD_ALL
#

MBS_PARALLEL_CVSADD_ALL=$(foreach zX,$(MBS_PARALLEL_JOBS_CVSADD_ALL),-j $(zX))

# MBS_BUILDDIR definition
#
# Pick the option for MBS_BUILDDIR - priority in L, <none>, S, G order
#
ifneq ($(INL_BUILDDIR),)
MBS_BUILDDIR=$(INL_BUILDDIR)
MBS_ISSET_BUILDDIR=1
endif

ifeq ($(INL_UNSET_BUILDDIR),1)
MBS_BUILDDIR=
MBS_ISSET_BUILDDIR=1
endif

ifneq ($(MBS_ISSET_BUILDDIR),1)
ifneq ($(IN_BUILDDIR),)
MBS_BUILDDIR=$(IN_BUILDDIR)
MBS_ISSET_BUILDDIR=1
endif
endif

ifneq ($(MBS_ISSET_BUILDDIR),1)
ifeq ($(IN_UNSET_BUILDDIR),1)
MBS_BUILDDIR=
MBS_ISSET_BUILDDIR=1
endif
endif

ifneq ($(MBS_ISSET_BUILDDIR),1)
ifneq ($(INS_BUILDDIR),)
MBS_BUILDDIR=$(INS_BUILDDIR)
MBS_ISSET_BUILDDIR=1
endif
endif

ifneq ($(MBS_ISSET_BUILDDIR),1)
ifeq ($(INS_UNSET_BUILDDIR),1)
MBS_BUILDDIR=
MBS_ISSET_BUILDDIR=1
endif
endif

ifneq ($(MBS_ISSET_BUILDDIR),1)
MBS_BUILDDIR=$(ING_DEFAULT_BUILDDIR)
endif

# MBS_BUILDPREFIX definition

ifneq ($(MBS_BUILDDIR),)
MBS_BUILDPREFIX=$(MBS_BUILDDIR)/
else
MBS_BUILDPREFIX=
endif

# MBS_LIBS definition
#
# Assign default value of IN4_LIBS
#
ifneq ($(ING_SUPPRESS_DEFAULT_LIBS),1)
ING_LIBS=$(ING_DEFAULT_LIBS)
endif

MBS_LIBS=$(INL_LIBS) $(ING_LIBS)$ $(INS_LIBS) $(IN_LIBS)

# MBS_LIBS_OPTS is a transform of MBS_MBS_LIBS
#

MBS_LIBS_OPTS=$(foreach Popt,$(MBS_LIBS),-l $(Popt))

# MBS_SUBMAKEFILES definition
#
# Assign default value of IN4_SUBMAKEFILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_SUBMAKEFILES),1)
ING_SUBMAKEFILES=$(ING_DEFAULT_SUBMAKEFILES)
endif

MBS_SUBMAKEFILES=$(INL_SUBMAKEFILES) $(ING_SUBMAKEFILES)$ $(INS_SUBMAKEFILES) 
$(IN_SUBMAKEFILES)

# MBS_SUBMAKEFDIRS is a transform of MBS_SUBMAKEFILES changing suffixes of /Makefile 
to 
#

MBS_SUBMAKEFDIRS=$(MBS_SUBMAKEFILES:%/Makefile=%)

# MBS_SUBMAKEDIRS definition
#
# Assign default value of IN4_SUBMAKEDIRS
#
ifneq ($(ING_SUPPRESS_DEFAULT_SUBMAKEDIRS),1)
ING_SUBMAKEDIRS=$(ING_DEFAULT_SUBMAKEDIRS)
endif

MBS_SUBMAKEDIRS=$(INL_SUBMAKEDIRS) $(ING_SUBMAKEDIRS)$ $(INS_SUBMAKEDIRS) 
$(IN_SUBMAKEDIRS)

# MBS_CXXFILES definition
#
# Assign default value of IN4_CXXFILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_CXXFILES),1)
ING_CXXFILES=$(ING_DEFAULT_CXXFILES)
endif

MBS_CXXFILES=$(INL_CXXFILES) $(ING_CXXFILES)$ $(INS_CXXFILES) $(IN_CXXFILES)

# MBS_CXXOBJS is a transform of MBS_CXXFILES changing suffixes of .cc to .o
#

MBS_CXXOBJS=$(MBS_CXXFILES:%.cc=$(MBS_BUILDPREFIX)%.o)

# MBS_CFILES definition
#
# Assign default value of IN4_CFILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_CFILES),1)
ING_CFILES=$(ING_DEFAULT_CFILES)
endif

MBS_CFILES=$(INL_CFILES) $(ING_CFILES)$ $(INS_CFILES) $(IN_CFILES)

# MBS_COBJS is a transform of MBS_CFILES changing suffixes of .c to .o
#

MBS_COBJS=$(MBS_CFILES:%.c=$(MBS_BUILDPREFIX)%.o)

# MBS_YYACC_FILES definition
#
# Assign default value of IN4_YYACC_FILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_YYACC_FILES),1)
ING_YYACC_FILES=$(ING_DEFAULT_YYACC_FILES)
endif

MBS_YYACC_FILES=$(INL_YYACC_FILES) $(ING_YYACC_FILES)$ $(INS_YYACC_FILES) 
$(IN_YYACC_FILES)

# MBS_YYACCCXX_FILES is a transform of MBS_YYACC_FILES changing suffixes of .yy to 
.tab.cc
#

MBS_YYACCCXX_FILES=$(MBS_YYACC_FILES:%.yy=$(MBS_BUILDPREFIX)%.tab.cc)

# MBS_YYACCHXX_FILES is a transform of MBS_YYACC_FILES changing suffixes of .yy to 
.tab.hh
#

MBS_YYACCHXX_FILES=$(MBS_YYACC_FILES:%.yy=$(MBS_BUILDPREFIX)%.tab.hh)

# MBS_YYACCOBJ_FILES is a transform of MBS_YYACC_FILES changing suffixes of .yy to 
.tab.o
#

MBS_YYACCOBJ_FILES=$(MBS_YYACC_FILES:%.yy=$(MBS_BUILDPREFIX)%.tab.o)

# MBS_TEST_CXXFILES definition
#
# Assign default value of IN4_TEST_CXXFILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_TEST_CXXFILES),1)
ING_TEST_CXXFILES=$(ING_DEFAULT_TEST_CXXFILES)
endif

MBS_TEST_CXXFILES=$(INL_TEST_CXXFILES) $(ING_TEST_CXXFILES)$ $(INS_TEST_CXXFILES) 
$(IN_TEST_CXXFILES)

# MBS_TEST_CXXOBJS is a transform of MBS_TEST_CXXFILES changing suffixes of .cc to .o
#

MBS_TEST_CXXOBJS=$(MBS_TEST_CXXFILES:%.cc=$(MBS_BUILDPREFIX)%.o)

# MBS_TEST_CFILES definition
#
# Assign default value of IN4_TEST_CFILES
#
ifneq ($(ING_SUPPRESS_DEFAULT_TEST_CFILES),1)
ING_TEST_CFILES=$(ING_DEFAULT_TEST_CFILES)
endif

MBS_TEST_CFILES=$(INL_TEST_CFILES) $(ING_TEST_CFILES)$ $(INS_TEST_CFILES) 
$(IN_TEST_CFILES)

# MBS_TEST_COBJS is a transform of MBS_TEST_CFILES changing suffixes of .c to .o
#

MBS_TEST_COBJS=$(MBS_TEST_CFILES:%.c=$(MBS_BUILDPREFIX)%.o)

# MBS_BUILD_HOME definition
#
# Pick the option for MBS_BUILD_HOME - priority in L, <none>, S, G order
#
ifneq ($(INL_BUILD_HOME),)
MBS_BUILD_HOME=$(INL_BUILD_HOME)
MBS_ISSET_BUILD_HOME=1
endif

ifeq ($(INL_UNSET_BUILD_HOME),1)
MBS_BUILD_HOME=
MBS_ISSET_BUILD_HOME=1
endif

ifneq ($(MBS_ISSET_BUILD_HOME),1)
ifneq ($(IN_BUILD_HOME),)
MBS_BUILD_HOME=$(IN_BUILD_HOME)
MBS_ISSET_BUILD_HOME=1
endif
endif

ifneq ($(MBS_ISSET_BUILD_HOME),1)
ifeq ($(IN_UNSET_BUILD_HOME),1)
MBS_BUILD_HOME=
MBS_ISSET_BUILD_HOME=1
endif
endif

ifneq ($(MBS_ISSET_BUILD_HOME),1)
ifneq ($(INS_BUILD_HOME),)
MBS_BUILD_HOME=$(INS_BUILD_HOME)
MBS_ISSET_BUILD_HOME=1
endif
endif

ifneq ($(MBS_ISSET_BUILD_HOME),1)
ifeq ($(INS_UNSET_BUILD_HOME),1)
MBS_BUILD_HOME=
MBS_ISSET_BUILD_HOME=1
endif
endif

ifneq ($(MBS_ISSET_BUILD_HOME),1)
MBS_BUILD_HOME=$(ING_DEFAULT_BUILD_HOME)
endif

# MBS_BUILD_HOME_DIRS definition
#
# Assign default value of IN4_BUILD_HOME_DIRS
#
ifneq ($(ING_SUPPRESS_DEFAULT_BUILD_HOME_DIRS),1)
ING_BUILD_HOME_DIRS=$(ING_DEFAULT_BUILD_HOME_DIRS)
endif

MBS_BUILD_HOME_DIRS=$(INL_BUILD_HOME_DIRS) $(ING_BUILD_HOME_DIRS)$ 
$(INS_BUILD_HOME_DIRS) $(IN_BUILD_HOME_DIRS)

# MBS_BUILD_NAMES is a transform of MBS_MBS_BUILD_HOME_DIRS
#

MBS_BUILD_NAMES=$(foreach 
name,$(MBS_BUILD_HOME_DIRS),$(MBS_BUILD_HOME)/$(MBS_BUILDPREFIX)$(name))

# MBS_IDIRS definition
#
# Assign default value of IN4_IDIRS
#
ifneq ($(ING_SUPPRESS_DEFAULT_IDIRS),1)
ING_IDIRS=$(ING_DEFAULT_IDIRS)
endif

MBS_IDIRS=$(INL_IDIRS) $(ING_IDIRS)$ $(INS_IDIRS) $(IN_IDIRS)

# MBS_ICFLAGS is a transform of MBS_MBS_IDIRS
#

MBS_ICFLAGS=$(foreach Popt,$(MBS_IDIRS),-I $(Popt))

# MBS_LDIRS definition
#
# Assign default value of IN4_LDIRS
#
ifneq ($(ING_SUPPRESS_DEFAULT_LDIRS),1)
ING_LDIRS=$(ING_DEFAULT_LDIRS)
endif

MBS_LDIRS=$(INL_LDIRS) $(ING_LDIRS)$ $(INS_LDIRS) $(IN_LDIRS)

# MBS_LCFLAGS is a transform of MBS_MBS_LDIRS
#

MBS_LCFLAGS=$(foreach Popt,$(MBS_LDIRS),-L$(Popt))

# MBS_LINKOBJS definition
#
# Assign default value of IN4_LINKOBJS
#
ifneq ($(ING_SUPPRESS_DEFAULT_LINKOBJS),1)
ING_LINKOBJS=$(ING_DEFAULT_LINKOBJS)
endif

MBS_LINKOBJS=$(INL_LINKOBJS) $(ING_LINKOBJS)$ $(INS_LINKOBJS) $(IN_LINKOBJS)

# MBS_LDFLAGS definition
#
# Assign default value of IN4_LDFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_LDFLAGS),1)
ING_LDFLAGS=$(ING_DEFAULT_LDFLAGS)
endif

MBS_LDFLAGS=$(INL_LDFLAGS) $(ING_LDFLAGS)$ $(INS_LDFLAGS) $(IN_LDFLAGS)

# MBS_CXXLIBS definition
#
# Assign default value of IN4_CXXLIBS
#
ifneq ($(ING_SUPPRESS_DEFAULT_CXXLIBS),1)
ING_CXXLIBS=$(ING_DEFAULT_CXXLIBS)
endif

MBS_CXXLIBS=$(INL_CXXLIBS) $(ING_CXXLIBS)$ $(INS_CXXLIBS) $(IN_CXXLIBS)

# MBS_CXXLIBS_OPTS is a transform of MBS_MBS_CXXLIBS
#

MBS_CXXLIBS_OPTS=$(foreach Popt,$(MBS_CXXLIBS),-l$(Popt))

# MBS_OCFLAGS definition
#
# Assign default value of IN4_OCFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_OCFLAGS),1)
ING_OCFLAGS=$(ING_DEFAULT_OCFLAGS)
endif

MBS_OCFLAGS=$(INL_OCFLAGS) $(ING_OCFLAGS)$ $(INS_OCFLAGS) $(IN_OCFLAGS)

# MBS_CFLAGS definition
#
# Assign default value of IN4_CFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_CFLAGS),1)
ING_CFLAGS=$(ING_DEFAULT_CFLAGS)
endif

MBS_CFLAGS=$(INL_CFLAGS) $(ING_CFLAGS)$ $(INS_CFLAGS) $(IN_CFLAGS)

# MBS_CXXFLAGS definition
#
# Assign default value of IN4_CXXFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_CXXFLAGS),1)
ING_CXXFLAGS=$(ING_DEFAULT_CXXFLAGS)
endif

MBS_CXXFLAGS=$(INL_CXXFLAGS) $(ING_CXXFLAGS)$ $(INS_CXXFLAGS) $(IN_CXXFLAGS)

# MBS_ASFLAGS definition
#
# Assign default value of IN4_ASFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_ASFLAGS),1)
ING_ASFLAGS=$(ING_DEFAULT_ASFLAGS)
endif

MBS_ASFLAGS=$(INL_ASFLAGS) $(ING_ASFLAGS)$ $(INS_ASFLAGS) $(IN_ASFLAGS)

# MBS_CPPFLAGS definition
#
# Assign default value of IN4_CPPFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_CPPFLAGS),1)
ING_CPPFLAGS=$(ING_DEFAULT_CPPFLAGS)
endif

MBS_CPPFLAGS=$(INL_CPPFLAGS) $(ING_CPPFLAGS)$ $(INS_CPPFLAGS) $(IN_CPPFLAGS)

# MBS_YFLAGS definition
#
# Assign default value of IN4_YFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_YFLAGS),1)
ING_YFLAGS=$(ING_DEFAULT_YFLAGS)
endif

MBS_YFLAGS=$(INL_YFLAGS) $(ING_YFLAGS)$ $(INS_YFLAGS) $(IN_YFLAGS)

# MBS_LFLAGS definition
#
# Assign default value of IN4_LFLAGS
#
ifneq ($(ING_SUPPRESS_DEFAULT_LFLAGS),1)
ING_LFLAGS=$(ING_DEFAULT_LFLAGS)
endif

MBS_LFLAGS=$(INL_LFLAGS) $(ING_LFLAGS)$ $(INS_LFLAGS) $(IN_LFLAGS)

# MBS_FILES_CLEAN definition
#
# Assign default value of IN4_FILES_CLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_FILES_CLEAN),1)
ING_FILES_CLEAN=$(ING_DEFAULT_FILES_CLEAN)
endif

MBS_FILES_CLEAN=$(INL_FILES_CLEAN) $(ING_FILES_CLEAN)$ $(INS_FILES_CLEAN) 
$(IN_FILES_CLEAN)

# MBS_FILES_MOSTLYCLEAN definition
#
# Assign default value of IN4_FILES_MOSTLYCLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_FILES_MOSTLYCLEAN),1)
ING_FILES_MOSTLYCLEAN=$(ING_DEFAULT_FILES_MOSTLYCLEAN)
endif

MBS_FILES_MOSTLYCLEAN=$(INL_FILES_MOSTLYCLEAN) $(ING_FILES_MOSTLYCLEAN)$ 
$(INS_FILES_MOSTLYCLEAN) $(IN_FILES_MOSTLYCLEAN)

# MBS_FILES_DISTCLEAN definition
#
# Assign default value of IN4_FILES_DISTCLEAN
#
ifneq ($(ING_SUPPRESS_DEFAULT_FILES_DISTCLEAN),1)
ING_FILES_DISTCLEAN=$(ING_DEFAULT_FILES_DISTCLEAN)
endif

MBS_FILES_DISTCLEAN=$(INL_FILES_DISTCLEAN) $(ING_FILES_DISTCLEAN)$ 
$(INS_FILES_DISTCLEAN) $(IN_FILES_DISTCLEAN)



#
# Some special defines

# MBS_MAKEDIRS - all subdirectories that need to be built.
MBS_MAKEDIRS=$(MBS_SUBMAKEFDIRS) $(MBS_SUBMAKEDIRS)

#
# Defined some standard macros using the MBS macros
#
CFLAGS=$(MBS_CFLAGS) $(MBS_OCFLAGS)
CXXFLAGS=$(MBS_CXXFLAGS) $(MBS_OCFLAGS)
LDFLAGS=$(MBS_LCFLAGS) $(MBS_LIBS_OPTS) $(MBS_LDFLAGS) $(MBS_CXXLIBS_OPTS)
CPPFLAGS=$(MBS_CPPFLAGS) $(MBS_ICFLAGS)
ASFLAGS=$(MBS_ASFLAGS) $(MBS_OCFLAGS)
YFLAGS=$(MBS_LFLAGS)
LFLAGS=$(MBS_LFLAGS)



.PRECIOUS: $(ICX_OBJDIR)/%.so $(ICX_OBJDIR)/%.o $(ICX_OBJDIR)/%.dep \
 $(ICX_OBJDIR)/%.c++ %_control.xml %_app.xml





.PHONY : all
all : $(MBS_TARGETS_ALL)


.PHONY : setup
setup : $(MBS_TARGETS_SETUP)


.PHONY : test
test : $(MBS_TARGETS_TEST)


.PHONY : clean
clean : $(MBS_TARGETS_CLEAN)
        $(RMRF) $(MBS_FILES_CLEAN)

.PHONY : mostlyclean
mostlyclean : $(MBS_TARGETS_MOSTLYCLEAN)
        $(RMRF) $(MBS_FILES_MOSTLYCLEAN)

.PHONY : distclean
distclean : $(MBS_TARGETS_DISTCLEAN)
        $(RMRF) $(MBS_FILES_DISTCLEAN)

.PHONY : docs
docs : $(MBS_TARGETS_DOCS)


.PHONY : uninstall
uninstall : $(MBS_TARGETS_UNINSTALL)


.PHONY : cvsadd_all
cvsadd_all : $(MBS_TARGETS_CVSADD_ALL)
        ( $(CVS) add *; true)







.SUFFIXES: .yy

#
# Keep all build intermediate files
#
.PRECIOUS: $(MBS_BUILDPREFIX)%.cc $(MBS_YYACCCXX_FILES)

#
#
# MBS_OBJDIR_DEP is the dependantcy for $(MBS_BUILDPREFIX)
#
ifeq ($(wildcard $(MBS_BUILDDIR)),)
MBS_OBJDIR_DEP=$(MBS_BUILDPREFIX)
else
MBS_OBJDIR_DEP=
endif

#
# Suffix for depends files
#
MBS_DEPSUFFIX=.dep

#
# Basic MBS rules
#

#
# Build bison generated files as c++ files - extension .yy
# these generate .tab.hh and .tab.cc files.
#

$(MBS_BUILDPREFIX)%.tab.cc $(MBS_BUILDPREFIX)%.tab.hh : %.yy $(MBS_OBJDIR_DEP)
        $(RMRF) $*.yy.tab.h $(MBS_BUILDPREFIX)$*.tab.hh $*.yy.tab.c 
$(MBS_BUILDPREFIX)$*.tab.cc
        $(BISON) -d $<
        $(MV) $*.yy.tab.h $(MBS_BUILDPREFIX)$*.tab.hh
        $(MV) $*.yy.tab.c $(MBS_BUILDPREFIX)$*.tab.cc

#
# Build c++ files (sitting in the build directory)
#
$(MBS_BUILDPREFIX)%.o : $(MBS_BUILDPREFIX)%.cc $(MBS_OBJDIR_DEP)
        ( \
                $(RMF) $(@) $(@)$(MBS_DEPSUFFIX); \
                export DEPENDENCIES_OUTPUT="$(@)$(MBS_DEPSUFFIX) $(@)"; \
                $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ \
        )

#
# Build regular c++ into the build directory
#
$(MBS_BUILDPREFIX)%.o : %.cc $(MBS_OBJDIR_DEP)
        ( \
                $(RMF) $(@) $(@)$(MBS_DEPSUFFIX); \
                export DEPENDENCIES_OUTPUT="$(@)$(MBS_DEPSUFFIX) $(@)"; \
                $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ \
        )

#
# Build c files (sitting in the build directory)
#
$(MBS_BUILDPREFIX)%.o : $(MBS_BUILDPREFIX)%.c $(MBS_OBJDIR_DEP)
        ( \
                $(RMF) $(@) $(@)$(MBS_DEPSUFFIX); \
                export DEPENDENCIES_OUTPUT="$(@)$(MBS_DEPSUFFIX) $(@)"; \
                $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ \
        )

#
# Link c++ objects
#
$(MBS_BUILDPREFIX)% : %.cc $(MBS_LINKOBJS) $(MBS_OBJDIR_DEP)
                $(CXX) $(CXXFLAGS) $(MBS_LINKOBJS) $(LDFLAGS) -o $@

#
# Build regular c++ into the build directory
#
$(MBS_BUILDPREFIX)%.o : %.c $(MBS_OBJDIR_DEP)
        ( \
                $(RMF) $(@) $(@)$(MBS_DEPSUFFIX); \
                export DEPENDENCIES_OUTPUT="$(@)$(MBS_DEPSUFFIX) $(@)"; \
                $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ \
        )





#
# Install rule for lib
#
$(MBS_BUILD_LIB)/% : $(MBS_BUILDPREFIX)%
        @echo "Installing $@"
        $(RMF) $@
        $(LN) $< $@



#
# Install rule for bin
#
$(MBS_BUILD_BIN)/% : $(MBS_BUILDPREFIX)%
        @echo "Installing $@"
        $(RMF) $@
        $(LN) $< $@




# Looking for header files
#
# This is to help editors that look for header files
#
# look for files in the MBS_IDIRS list of directories
#       prune out "//" to "/" using sed
#
whereis/% :
        @for dir in $(MBS_IDIRS) /usr/include; do \
                if [ -f $$dir/$(notdir $@) ] ; then \
                        echo $$dir/$(notdir $@) | sed -e s%//%/%; \
                fi; \
        done

#
# Create the work directory ifit's not already there 
#
ifneq ($(MBS_OBJDIR_DEP),)
$(MBS_OBJDIR_DEP) :
        @echo "creating $(MBS_OBJDIR_DEP)"
        -$(MKDIR) -p $(MBS_OBJDIR_DEP)
endif

ifneq ($(MBS_MAKEDIRS),)

MBS_SUBDIR_TARG_ALL=$(MBS_MAKEDIRS:%=%/all)
.PHONY: $(MBS_SUBDIR_TARG_ALL)
all : $(MBS_SUBDIR_TARG_ALL)

$(MBS_SUBDIR_TARG_ALL) :
        $(MAKE) $(MBS_PARALLEL_ALL) -C $(@D) all


MBS_SUBDIR_TARG_SETUP=$(MBS_MAKEDIRS:%=%/setup)
.PHONY: $(MBS_SUBDIR_TARG_SETUP)
setup : $(MBS_SUBDIR_TARG_SETUP)

$(MBS_SUBDIR_TARG_SETUP) :
        $(MAKE) $(MBS_PARALLEL_SETUP) -C $(@D) setup


MBS_SUBDIR_TARG_TEST=$(MBS_MAKEDIRS:%=%/test)
.PHONY: $(MBS_SUBDIR_TARG_TEST)
test : $(MBS_SUBDIR_TARG_TEST)

$(MBS_SUBDIR_TARG_TEST) :
        $(MAKE) $(MBS_PARALLEL_TEST) -C $(@D) test


MBS_SUBDIR_TARG_CLEAN=$(MBS_MAKEDIRS:%=%/clean)
.PHONY: $(MBS_SUBDIR_TARG_CLEAN)
clean : $(MBS_SUBDIR_TARG_CLEAN)

$(MBS_SUBDIR_TARG_CLEAN) :
        $(MAKE) $(MBS_PARALLEL_CLEAN) -C $(@D) clean


MBS_SUBDIR_TARG_MOSTLYCLEAN=$(MBS_MAKEDIRS:%=%/mostlyclean)
.PHONY: $(MBS_SUBDIR_TARG_MOSTLYCLEAN)
mostlyclean : $(MBS_SUBDIR_TARG_MOSTLYCLEAN)

$(MBS_SUBDIR_TARG_MOSTLYCLEAN) :
        $(MAKE) $(MBS_PARALLEL_MOSTLYCLEAN) -C $(@D) mostlyclean


MBS_SUBDIR_TARG_DISTCLEAN=$(MBS_MAKEDIRS:%=%/distclean)
.PHONY: $(MBS_SUBDIR_TARG_DISTCLEAN)
distclean : $(MBS_SUBDIR_TARG_DISTCLEAN)

$(MBS_SUBDIR_TARG_DISTCLEAN) :
        $(MAKE) $(MBS_PARALLEL_DISTCLEAN) -C $(@D) distclean


MBS_SUBDIR_TARG_DOCS=$(MBS_MAKEDIRS:%=%/docs)
.PHONY: $(MBS_SUBDIR_TARG_DOCS)
docs : $(MBS_SUBDIR_TARG_DOCS)

$(MBS_SUBDIR_TARG_DOCS) :
        $(MAKE) $(MBS_PARALLEL_DOCS) -C $(@D) docs


MBS_SUBDIR_TARG_UNINSTALL=$(MBS_MAKEDIRS:%=%/uninstall)
.PHONY: $(MBS_SUBDIR_TARG_UNINSTALL)
uninstall : $(MBS_SUBDIR_TARG_UNINSTALL)

$(MBS_SUBDIR_TARG_UNINSTALL) :
        $(MAKE) $(MBS_PARALLEL_UNINSTALL) -C $(@D) uninstall


MBS_SUBDIR_TARG_CVSADD_ALL=$(MBS_MAKEDIRS:%=%/cvsadd_all)
.PHONY: $(MBS_SUBDIR_TARG_CVSADD_ALL)
cvsadd_all : $(MBS_SUBDIR_TARG_CVSADD_ALL)

$(MBS_SUBDIR_TARG_CVSADD_ALL) :
        $(MAKE) $(MBS_PARALLEL_CVSADD_ALL) -C $(@D) cvsadd_all


endif

#
# include all generated depend files
#
MBS_DEPLIST=$(wildcard $(MBS_BUILDPREFIX)*$(MBS_DEPSUFFIX))
ifneq ($(strip $(MBS_DEPLIST)),)
include $(MBS_DEPLIST)
endif
#

Reply via email to