help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question: how to automatically define a group of variables


From: Günter Neiß
Subject: Re: question: how to automatically define a group of variables
Date: Tue, 30 Jan 2001 13:20:33 +0100

"Resnick, David" schrieb:
> 
> I'm struggling to simplify a Makefile that is getting cluttered up with
> repetition every time we add support for a new language.  We have
> sets of statements like the following:
> 
> *************************************************
> NONBI_SRCS_FRFR = lang-kernel.frfr.c lang-util.c
> NONBI_SRCS_DEDE = lang-kernel.dede.c lang-util.c
> NONBI_SRCS_ITIT = lang-kernel.itit.c lang-util.c
> NONBI_SRCS_PTBR = lang-kernel.ptbr.c lang-util.c
> NONBI_SRCS_ESCL = lang-kernel.escl.c lang-util.c
> 
> tdb%-bi.c: $(NONBI_SRCS_%:.c=.o)
> *************************************************
> 
> I originally naively thought I could do something like the following
> (disregarding the
> upper/lower case issue for now):
> 
> *************************************************
> define newline
> 
> endef
> lc_ccs = frfr dede itit ptbr escl
> $(foreach lccc, $(lc_ccs), NONBI_SRCS_$(lccc) = lang-kernel.$(lccc).c
> lang-util.c $(newline))
> *************************************************
> 
> Alas, that results in a '*** missing separator.  Stop.' error.  What I want
> for it to do is
> to expand, e.g., to:
> NONBI_SRCS_frfr = lang-kernel.frfr.c lang-util.c
> before Make decides that the line doesn't have a form like var = defn or
> TARGETS: blah blah blah.
> 
> I pawed through the info file for some time, and asked the local Make
> experts, but couldn't come
> up with a satisfactory answer.  Any help on how to do this (or a pointer to
> where I might find
> the answer) would be greatly appreciated.  If it is relevant, we're running
> make-3.79.1.
> 
> Thanks,
> -David
 

As far as I know, You can't do it that way...
The $(foreach...) will expand to:
NONBI_SRCS_frfr = lang-kernel.frfr.c lang-util.c \n NONBI_SRCS_dede =
lang-kernel.dede.c lang-util.c ...
And thats assigned to ??? 
The result of $(foreach...) is a string, not a sequence of statements
for make !

You migth write:
lccc:=  frfr
NONBI_SRCS_$(lccc) = lang-kernel.$(lccc).c lang-util.c
lccc:=  dede 
NONBI_SRCS_$(lccc) = lang-kernel.$(lccc).c lang-util.c
...

which will work as You expected...

if You do that a little bit more tricky:

lc_ccs = frfr dede itit ptbr escl
all:
        for vers in $(lc_ccs); do \
          $(MAKE) -f AnotherMakeFile lccc=$$vers ; \
        done

In AnotherMakeFile:
NONBI_SRCS_$(lccc) = lang-kernel.$(lccc).c lang-util.c
...

You get a recursive make for all this....

That's the idea behind my 'VersionMake':
Write one Makefile(-part) that does the normal work, but requires the
actual Version that should be made given before.

I write something like that:

AllVersions:=   frfr dede itit ptbr escl

ifeq ($(strip $(VERSION)),)
 
#############################################################################
  # Make all Versions
  # the special target 'force' may be used to force the make even if one
fails
 
#############################################################################

  Goal:=        DoAllVers$(subst force,Force,$(filter force,$(MAKECMDGOALS)))
  DoTargets:=   $(filter-out force,$(MAKECMDGOALS))
  DoTargets:=   $(if $(DoTargets),$(DoTargets),all)
  $(DoTargets): $(Goal)

  .PHONY:       force Show DoAllVers DoAllVersForce $(AllVersions)

  force:        $(DoTargets)

  Show:
                @echo VersionMake: Goal: $(Goal)
                @echo VersionMake: DoTargets: $(DoTargets)
                @echo VersionMake: AllVersions: $(AllVersions)

  DoAllVers:    $(AllVersions)

  DoAllVersForce:
                @for version in $(AllVersions); do \
                  @echo VersionMake: Version: $@
                  $(MAKE) -s VERSION=$$dir $(DoTargets) ; \
                done

  $(AllVersions):
                @echo VersionMake: Version: $@
                @$(MAKE) VERSION=$@ $(DoTargets)

 else
 
#############################################################################
  # Make Version specified on Command-Line
 
#############################################################################
  # in may case There is a file BasicMake, that 'makes' one Version
  # You might insert the normal rules for Your project here
  # Error:=     $(if $(findstring /src/,$(CURDIR))/,,$(error VersionMake:
Current Dir does not contain '/src/'))
  # include     $(firstword $(subst /src/,/src ,$(CURDIR)/))/BasicMake

  # Construct Your Strings here, VERSION is one of the above defined
  NONBI_SRCS_Version:= lang-kernel.$(VERSION).c lang-util.c

  # proceed here with normal make-statements.., using
'NONBI_SRCS_Version' instead of 'NONBI_SRCS_FRFR'...
endif

Now You might simply call 'make [<goal>]' without setting the VERSION
and make will be called for every entry in 'AllVersions'
Or You call 'make VERSION=frfr [<goal>] and only this version will be
made.

As You migth see the above code is only a snippet for my actual
Makefile-hirachy, that contains:
- a 'BasicMake' that defines the rules needed in any make for a actual
project
- a 'SubDirMake' that does the actions nessesary to generate code for
defined subdirs
- a 'VersionMake' that generates different versions from the same
source, based on different defines.

I attach these files in case they might help You. (They need GNU-Make
Version >=2.78 !!)
These files assume that the actual project-tree is set up as follows:
ProjectDir              The root for this project (any name, any deepth)
          /src          Here are the files 'BasicMake' 'SubdirMake' and
'VersionMake'
              /lib1     Source-files for Library 1
              /lib2     Source-files for Library 2
              /exe1     Source-files for executable 1
              /exe2     Source-files for executable 2

The results will be stored under (if these dirs are non existend they
will be created)
          /OS           Actual OS might be Hp or Lx (You may add more)
             /bin       here the results are stored (executables)
             /lib       here the genereated libs are stored
             /obj/...   here all generated intermediate files will be
stored.

The idea behind this is to keep the 'src' part clean (holding only real
source). To save a project, I only save the SRC-part.
Everything that can be remade from this is stored into the other
dir-parts.
Furthermore I am able to compile the project (residing on a fileserver)
on different systems (in my case HP-UX and Linux) without any influence.

Any suggestions / comments to this are highly recomented.
If You (or somebody else) adds more functionality I like to here from
it.

greetings
  Günter
###############################################################################
# Variables that SHALL be defined before including 'VersionMake'
###############################################################################

AllVersions:=

TARGET:=

SRCS:=

###############################################################################
# Version depended DEFS & SRCS
# replace version1, version2... by your defined Version-names
# if Version dependend CDEFS SRCS or USE_VXI is not needed, the corrosponding
# defined may be omitted
###############################################################################

#version1CDEFS:=
#version2CDEFS:=

#version1SRCS:=
#version2SRCS:=

#version1USE_VXI:=      yes
#version2USE_VXI:=      no

###############################################################################
# Variables that MAY be defined before including 'VersionMake'
###############################################################################

# Project-Libraries used in this make
# Format: <reldir>/<libname>
#  <reldir>:    pel-path from 'src'-Dir
#  <libname>:   full name of library (including extension)
PRJLIBS:=

# System-Libraries used in this make
#SYSLIBS:=

# If 'yes' VISA or SICL will be used for this make
#USE_VXI:=      yes

# Extra DEFS and/or INCLUDES
#CPPDEFS:=
#CDEFS:=
#CXXDEFS:=

#CINCLUDE:=
#CXXINCLUDE:=

# Extra Commands after the normal make
#EXTRA_MAKE_CMDS:=

# if OPTFLAGS not defined, Debug Version (-g) is assumed
#OPTFLAGS:=

# Extra SUFFIXES used
#EXTRASUFFIXES:=

# Extra Flags / other Translators
#CPPFLAGS:=
#CFLAGS:=
#CXXFLAGS:=
#LDFLAGS:=
#ARFLAGS:=

#CC:=           gcc
#CXX:=          g++
#LD:=           g++
#AR:=           ar
#RANLIB:=       ranlib

###############################################################################
# And now include the Basic-Part
###############################################################################

Error:=         $(if $(findstring /src/,$(CURDIR))/,,$(error Current Dir does 
not contain '/src/'))
include         $(firstword $(subst /src/,/src ,$(CURDIR)/))/VersionMake

###############################################################################
# Additional Dependencies / Rules
###############################################################################

###############################################################################
# Variables that SHALL be defined before including 'BasicMake'
###############################################################################

TARGET:=

SRCS:=

###############################################################################
# Variables that MAY be defined before including 'BasicMake'
###############################################################################

# Project-Libraries used in this make
#PRJLIBS:=

# System-Libraries used in this make
#SYSLIBS:=

# If 'yes' VISA or SICL will be used for this make
#USE_VXI:=      yes

# Extra DEFS and/or INCLUDES
#CPPDEFS:=
#CDEFS:=
#CXXDEFS:=

#CINCLUDE:=
#CXXINCLUDE:=

# Extra Commands after the normal make clean
#EXTRA_MAKE_CMDS:=
#EXTRA_CLEAN_CMDS:=

# if OPTFLAGS not defined, Debug Version (-g) is assumed
#OPTFLAGS:=

# Extra SUFFIXES used
#EXTRASUFFIXES:=

# Extra Flags / other Translators
#CPPFLAGS:=
#CFLAGS:=
#CXXFLAGS:=
#LDFLAGS:=
#ARFLAGS:=

#CC:=           gcc
#CXX:=          g++
#LD:=           g++
#AR:=           ar
#RANLIB:=       ranlib

###############################################################################
# And now include the Basic-Part
###############################################################################

Error:=         $(if $(findstring /src/,$(CURDIR))/,,$(error Current Dir does 
not contain '/src/'))
include         $(firstword $(subst /src/,/src ,$(CURDIR)/))/BasicMake

###############################################################################
# Additional Dependencies / Rules
###############################################################################

###############################################################################
# SubdirMake
#
# This Makefile processes all Makefiles in the SubDirectories defined by:
# 'SubPrjs'
# the special target 'force' may be used to force all makes even if one fails
###############################################################################

###############################################################################
# Check Variables that SHALL be defined before including 'SubdirMake'
###############################################################################

Error:=         $(if $(SubPrjs),,$(error SubdirMake: Variable SubPrjs not 
specified))

###############################################################################
# Check Variables that MAY be defined before including 'SubdirMake'
###############################################################################

###############################################################################
# Make all projects / subdirs
###############################################################################

Goal:=          DoSubPrjs$(subst force,Force,$(filter force,$(MAKECMDGOALS)))

MakeTargets:=   $(filter-out force,$(MAKECMDGOALS))
MakeTargets:=   $(if $(MakeTargets),$(MakeTargets),all)

$(MakeTargets): $(Goal)

.PHONY:         force Show DoSubPrjs DoSubPrjsForce $(SubPrjs)

force:          $(MakeTargets)

Show:
                @echo SubdirMake: SubPrjs: $(SubPrjs)
                @echo SubdirMake: Goal: $(Goal)
                @echo SubdirMake: MakeTargets: $(MakeTargets)

DoSubPrjs:      $(SubPrjs)

DoSubPrjsForce:
                @for dir in $(SubPrjs); do \
                  echo SubdirMake : $(PrjStr)/$$dir ; \
                  $(MAKE) -s -C $$dir PrjStr=$(PrjStr)/$$dir $(MakeTargets) ; \
                done

$(SubPrjs):
                @echo SubdirMake : $(PrjStr)/$@
                @$(MAKE) -s -C $@ PrjStr=$(PrjStr)/$@ $(MakeTargets)

###############################################################################
# Variables that SHALL be defined before including 'SubdirMake'
###############################################################################

SubPrjs:=

# Text that indicates the Basic Prj that was made
ifdef PrjStr
  PrjStr+=      /PrjName
 else
  PrjStr=       PrjName
endif

###############################################################################
# Variables that MAY be defined before including 'SubdirMake'
###############################################################################

###############################################################################
# And now include the Basic-Part
###############################################################################

Error:=         $(if $(findstring /src/,$(CURDIR))/,,$(error Current Dir does 
not contain '/src/'))
include         $(firstword $(subst /src/,/src ,$(CURDIR)/))/SubdirMake

###############################################################################
# Additional Dependencies / Rules
###############################################################################


###############################################################################
# VersionMake
#
# This Makefile makes all Versions of a Target defined by:
# 'AllVersions'
# the special target 'force' may be used to force all makes even if one fails
###############################################################################

###############################################################################
# Check Variables that SHALL be defined before including 'VersionMake'
###############################################################################

Error:=         $(if $(AllVersions),,$(error VersionMake: Variable AllVersions 
not specified))

###############################################################################
# Check Variables that MAY be defined before including 'VersionMake'
###############################################################################


###############################################################################
# VERSION or VERSION_NR specified on Command-Line ?
# if yes make this, else make all
###############################################################################

ifdef VERSION_NR
  VERSION:=     $(word $(VERSION_NR),$(AllVersions))
  Error:=       $(if $(strip $(VERSION)),,$(error VersionMake: Wrong VERSION_NR 
given))
endif

ifdef VERSION
  Error:=       $(if $(strip $(filter $(VERSION),$(AllVersions))),,$(error 
VersionMake: Unknow VERSION: '$(VERSION)' given))
endif

ifeq ($(strip $(VERSION)),)
  #############################################################################
  # Make all Versions
  # the special target 'force' may be used to force the make even if one fails
  #############################################################################

  Goal:=        DoAllVers$(subst force,Force,$(filter force,$(MAKECMDGOALS)))

  DoTargets:=   $(filter-out force,$(MAKECMDGOALS))
  DoTargets:=   $(if $(DoTargets),$(DoTargets),all)

  $(DoTargets): $(Goal)

  .PHONY:       force Show DoAllVers DoAllVersForce $(AllVersions)

  force:        $(DoTargets)

  Show:
                @echo VersionMake: Goal: $(Goal)
                @echo VersionMake: DoTargets: $(DoTargets)
                @echo VersionMake: AllVersions: $(AllVersions)

  DoAllVers:    $(AllVersions)

  DoAllVersForce:
                @for version in $(AllVersions); do \
                  @echo VersionMake: Version: $@
                  $(MAKE) -s VERSION=$$dir $(DoTargets) ; \
                done

  $(AllVersions):
                @echo VersionMake: $(PrjStr) Version: $@
                @$(MAKE) -s VERSION=$@ PrjStr=$(PrjStr) VersStr=$@ $(DoTargets)

 else
  #############################################################################
  # Make Version specified on Command-Line
  #############################################################################

  Error:=       $(if $(findstring /src/,$(CURDIR))/,,$(error VersionMake: 
Current Dir does not contain '/src/'))
  include       $(firstword $(subst /src/,/src ,$(CURDIR)/))/BasicMake

endif




###############################################################################
# BasicMake
#
# This Makefile assumes the following:
#
# The current working directory is the directory containing the source of the
# (sub)project.
# The directory-tree of the project shall looks like this:
#
# ProjectRoot -+- src -+- (Sub)Project1
#              |       !- (Sub)Project2
#              +- os --+- obj   *.o and *.d files
#                      +- lib   *.a and *.so files
#                      !- bin   executables
###############################################################################

###############################################################################
# Macro-Functions
###############################################################################

# If origin of Variable (par1) was a default or undefined, return para2, else 
Value of Variable
IfDefaultOrUndefined=   $(if $(findstring $(origin $(1)),default 
undefined),$(2),$($(1)))

# If Variable (para1) was defined return the Value of Variable (para2)
IfDefined=      $(if $(findstring $(origin $(1)),undefined),,$($(2)))

###############################################################################
# Check Variables that SHALL be defined before including 'BasicMake'
###############################################################################

Error:=         $(if $(TARGET),,$(error BasicMake: Variable TARGET not 
specified))
Error:=         $(if $(SRCS),,$(error BasicMake: Variable SRCS not specified))

###############################################################################
# Checks to support optional Version depended make
###############################################################################

VERSION:=       $(strip $(VERSION))
ifneq ($(VERSION),)
  VERSION_MAKE:=        yes
endif

###############################################################################
# Check Variables that MAY be defined before including 'BasicMake'
###############################################################################

OPTFLAGS?=      -g

PRJLIBS?=

SYSLIBS?=

EXTRASUFFIXES?=

CPPDEFS?=
CDEFS?=
CDEFS+=         $(call IfDefined,VERSION_MAKE,$(VERSION)CDEFS)
CXXDEFS?=       $(CDEFS)
CXXDEFS+=       $(call IfDefined,VERSION_MAKE,$(VERSION)CXXDEFS)

CINCLUDE?=
CXXINCLUDE?=    $(CINCLUDE)

CPPFLAGS?=
CFLAGS?=        -pipe -Wall -W -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations
CXXFLAGS?=      -pipe -Wall -W -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Woverloaded-virtual
LDFLAGS?=

ARFLAGS:=       $(call IfDefaultOrUndefined,ARFLAGS,rcus)

CC:=            $(call IfDefaultOrUndefined,CC,gcc)
CXX:=           $(call IfDefaultOrUndefined,CXX,g++)
LD:=            $(call IfDefaultOrUndefined,LD,g++)
AR:=            $(call IfDefaultOrUndefined,AR,ar)
RANLIB:=        $(call IfDefaultOrUndefined,RANLIB,ranlib)

###############################################################################
# Determine OS we are running on { HP_UX(HP) or Linux(LX) }
###############################################################################

HP-UXShortcut:= Hp
LinuxShortcut:= Lx

Os:=            $($(shell uname)Shortcut)
Error:=         $(if $(Os),,$(error BasicMake: Unknown OS: $(shell uname)))

###############################################################################
# OS depended Constants
###############################################################################

HpCFlags:=
LxCFlags:=      -mpentium

HpCxxFlags:=
LxCxxFlags:=    -mpentium

HpLdFlags:=     -Wl,-z -Wl,+n
LxLdFlags:=     -lg++

HpSysLibs:=     -lm
hxSysLibs:=

#HpVxiInc:=     -I/usr/e1485/include
HpVxiInc:=
LxVxiInc:=      -I/usr/local/vxipnp/linux/include

HpVxiLib:=      -lsicl
LxVxiLib:=      -lvisa

#HpVxiDef:=     -Dsicl -D_HPUX_SOURCE
HpVxiDef:=      -Dsicl
LxVxiDef:=      -Dvisa

###############################################################################
# Calculate OS depended Vars
###############################################################################

OsCFlags:=      $($(Os)CFlags)
OsCxxFlags:=    $($(Os)CxxFlags)
OsLdFlags:=     $($(Os)LdFlags)
OsSysLibs:=     $($(Os)SysLibs)

USE_VXI?=       $(call IfDefined,VERSION_MAKE,$(VERSION)USE_VXI)

OsVxiInc:=      $(if $(findstring $(USE_VXI),yes),$($(Os)VxiInc))
OsVxiLib:=      $(if $(findstring $(USE_VXI),yes),$($(Os)VxiLib))
OsVxiDef:=      $(if $(findstring $(USE_VXI),yes),$($(Os)VxiDef))

###############################################################################
# Calculate Dirs
###############################################################################

BaseDir:=       $(firstword $(subst /src/, src/,$(CURDIR)))
RelSrcDir:=     $(subst $(BaseDir)/src/,,$(CURDIR))

RelObjDir:=     $(Os)/obj/$(RelSrcDir)$(if $(VERSION),/$(VERSION))

SrcDir:=        $(BaseDir)/src/$(RelSrcDir)
ObjDir:=        $(BaseDir)/$(RelObjDir)
LibDir:=        $(BaseDir)/$(Os)/lib
BinDir:=        $(BaseDir)/$(Os)/bin

###############################################################################
# Determine what TYPE should be make { LIBRARY(lib) or EXE(exe) }
###############################################################################

TypeName:=      exe
aTypeName:=     lib
soTypeName:=    lib

Type:=          $($(subst .,,$(suffix $(TARGET)))TypeName)
Error:=         $(if $(Type),,$(error BasicMake: Unknown TargetType: $(TARGET)))

###############################################################################
# TYPE depended Constants
###############################################################################

exePath:=       $(BinDir)
libPath:=       $(LibDir)

define exeDo
        @echo   Linking: $(notdir $(TargetPath))...
        @$(CXX) $(CxxFlags) $(ObjsPath) -o $(TargetPath) $(LdFlags) 
$(PrjLibsLib) $(SysLibs)
endef

define libDo
        @echo   Make Lib: $(notdir $(TargetPath))...
        $(AR) $(ArFlags) $(TargetPath) $(ObjsPath)
        $(RANLIB) $(TargetPath)
endef

exeDir:=        $(BinDir)
libDir:=        $(LibDir)

exeMakeLibsTarget=      $(PrjLibsLib)
libMakeLibsTarget=      _DUMMY_

TypeMakeLibsTarget=     $($(Type)MakeLibsTarget)

exeMakeLibsPrereq=      $(PrjLibsLib)
libMakeLibsPrereq=

TypeMakeLibsPrereq=     $($(Type)MakeLibsPrereq)

###############################################################################
# Calculate TYPE depended Vars
###############################################################################

TypePath:=      $($(Type)Path)
TypeDo=         $($(Type)Do)
TypeDir:=       $($(Type)Dir)

###############################################################################
# Create TARGET depended Dirs
###############################################################################

Tmp:=           $(shell if ! test -d $(ObjDir) ; then mkdir -p $(ObjDir); fi)
Tmp:=           $(shell if ! test -d $(TypeDir) ; then mkdir -p $(TypeDir); fi)

###############################################################################
# Calculate TARGET depended Vars
###############################################################################

TargetExt:=     $(suffix $(TARGET))
TargetName:=    $(basename $(notdir $(TARGET)))$(if $(VERSION),_$(VERSION))
TargetPath:=    $(TypePath)/$(TARGET)$(if $(VERSION),_$(VERSION))

###############################################################################
# Calculate Automatic Variables
###############################################################################

SRCS+=          $(call IfDefined,VERSION_MAKE,$(VERSION)SRCS)

Objs:=          $(addsuffix .o,$(basename $(SRCS)))
ObjsPath:=      $(addprefix $(ObjDir)/,$(Objs))

Deps:=          $(addsuffix .d,$(basename $(SRCS)))
DepsPath:=      $(addprefix $(ObjDir)/,$(Deps))

PrjLibsDir:=    $(dir $(PRJLIBS))
PrjLibsNoDir:=  $(notdir $(PRJLIBS))

PrjLibsInc:=    $(addprefix -I$(BaseDir)/src/,$(PrjLibsDir))
PrjLibsLib:=    $(addprefix $(LibDir)/,$(PrjLibsNoDir))

SysLibs:=       $(SYSLIBS) $(OsSysLibs) $(OsVxiLib)

###############################################################################
# Calculate resulting Variables
###############################################################################

CppFlags:=      $(CPPFLAGS) $(CPPDEFS)
CFlags:=        $(CppFlags) $(CFLAGS)   $(OsCFlags)   $(OPTFLAGS) $(CDEFS)   
$(OsVxiDef) $(CINCLUDE)   $(OsVxiInc) $(PrjLibsInc)
CxxFlags:=      $(CppFlags) $(CXXFLAGS) $(OsCxxFlags) $(OPTFLAGS) $(CXXDEFS) 
$(OsVxiDef) $(CXXINCLUDE) $(OsVxiInc) $(PrjLibsInc)
LdFlags:=       $(LDFLAGS) $(OsLdFlags)
ArFlags:=       $(ARFLAGS)

Libs:=          $(PrjLibsLink) $(SysLibs)

###############################################################################
# Set SEARCH-PATH
###############################################################################

vpath %.o $(ObjDir)
vpath %.d $(ObjDir)
vpath %.a $(LibDir)
vpath %.so $(LibDir)

###############################################################################
# Pattern-Rules
###############################################################################

.SUFFIXES:
.SUFFIXES:      .c .cxx .h .hxx .d $(EXTRASUFFIXES)

$(ObjDir)/%.o: %.c
                @echo   Compiling: $(notdir $<)...
                @$(CC) $(CFlags) -c $< -o $@

$(ObjDir)/%.d: %.c
                @echo   Dependency: $(notdir $<)...
                @set -e; $(CC) $(CFlags) -MM $< \
                | sed 's§$*\.o[ :]*§$(ObjDir)/$*\.o $@ : §' > $@; \
                [ -s $@ ] || rm -f $@

$(ObjDir)/%.o: %.cxx
                @echo   Compiling: $(notdir $<)...
                @$(CXX) $(CxxFlags) -c $< -o $@

$(ObjDir)/%.d: %.cxx
                @echo   Dependency: $(notdir $<)...
                @set -e; $(CXX) $(CxxFlags) -MM $< \
                | sed 's§$*\.o[ :]*§$(ObjDir)/$*\.o $@ : §' > $@; \
                [ -s $@ ] || rm -f $@

###############################################################################
# Rules
###############################################################################

.PHONY:         all build dep clean make show Show _DUMMY_

all:            make

build:
                @echo   Building: $(notdir $(TargetPath))...
                @$(MAKE) -s clean
                @$(MAKE) -s make

clean:
                @echo   Cleaning: $(RelObjDir)...
                @-rm -f $(TargetPath)
                @-cd $(ObjDir) ; rm -f *.o
                $(EXTRA_CLEAN_CMDS)

fullclean:
                @echo   FullCleaning: $(RelObjDir)...
                @$(MAKE) -s clean
                @-cd $(ObjDir) ; rm -f *.d

make:           $(TargetPath)

$(TargetPath):  $(ObjsPath) $(TypeMakeLibsPrereq)
                $(TypeDo)
                $(EXTRA_MAKE_CMDS)

$(TypeMakeLibsTarget):
                @echo   Making Lib '$(notdir $@)' needed by: $(basename 
$(TargetPath))...
                $(MAKE) -C $(BaseDir)/src/$(dir $(filter %$(notdir 
$@),$(PRJLIBS)))

show:
                @echo BasicMake: SRCS: $(SRCS)
                @echo BasicMake: ObjsPath: $(ObjsPath)

Show:
                @echo BasicMake: TARGET: _$(TARGET)_
#               @echo BasicMake: SRCS: _$(SRCS)_

                @echo BasicMake: USE_VXI: _$(USE_VXI)_

                @echo BasicMake: OPTFLAGS: _$(OPTFLAGS)_

                @echo BasicMake: PRJLIBS: _$(PRJLIBS)_
                @echo BasicMake: SYSLIBS: _$(SYSLIBS)_

                @echo BasicMake: EXTRASUFFIXES: _$(EXTRASUFFIXES)_

                @echo BasicMake: CPPDEFS: _$(CPPDEFS)_
                @echo BasicMake: CDEFS: _$(CDEFS)_
                @echo BasicMake: CXXDEFS: _$(CXXDEFS)_

                @echo BasicMake: CINCLUDE: _$(CINCLUDE)_
                @echo BasicMake: CXXINCLUDE: _$(CXXINCLUDE)_

                @echo BasicMake: CPPFLAGS: _$(CPPFLAGS)_
                @echo BasicMake: CFLAGS: _$(CFLAGS)_
                @echo BasicMake: CXXFLAGS: _$(CXXFLAGS)_
                @echo BasicMake: LDFLAGS: _$(LDFLAGS)_
                @echo BasicMake: ARFLAGS: _$(ARFLAGS)_

                @echo BasicMake: CC: _$(CC)_
                @echo BasicMake: CXX: _$(CXX)_
                @echo BasicMake: LD: _$(LD)_
                @echo BasicMake: AR: _$(AR)_
                @echo BasicMake: RANLIB: _$(RANLIB)_


                @echo BasicMake: Os: _$(Os)_
                @echo BasicMake: OsLdFlags: _$(OsLdFlags)_
                @echo BasicMake: OsSysLibs: _$(OsSysLibs)_
                @echo BasicMake: OsVxiInc: _$(OsVxiInc)_
                @echo BasicMake: OsVxiLib: _$(OsVxiLib)_
                @echo BasicMake: OsVxiDef: _$(OsVxiDef)_

                @echo BasicMake: BaseDir: _$(BaseDir)_
                @echo BasicMake: RelSrcDir: _$(RelSrcDir)_
                @echo BasicMake: SrcDir: _$(SrcDir)_
                @echo BasicMake: ObjDir: _$(ObjDir)_
                @echo BasicMake: LibDir: _$(LibDir)_
                @echo BasicMake: BinDir: _$(BinDir)_

                @echo BasicMake: Type: _$(Type)_
                @echo BasicMake: TypePath: _$(TypePath)_
#               @echo BasicMake: TypeDo: _$(TypeDo)_
                @echo BasicMake: TypeDir: _$(TypeDir)_

                @echo BasicMake: TargetExt: _$(TargetExt)_
                @echo BasicMake: TargetName: _$(TargetName)_

#               @echo BasicMake: Objs: _$(Objs)_
#               @echo BasicMake: ObjsPath: _$(ObjsPath)_

                @echo BasicMake: CFlags: _$(CFlags)_
                @echo BasicMake: CxxFlags: _$(CxxFlags)_
                @echo BasicMake: LdFlags: _$(LdFlags)_
                @echo BasicMake: ArFlags: _$(ArFlags)_

                @echo BasicMake: PrjLibsDir: _$(PrjLibsDir)_
                @echo BasicMake: PrjLibsNoDir: _$(PrjLibsNoDir)_
                @echo BasicMake: PrjLibsInc: _$(PrjLibsInc)_
                @echo BasicMake: PrjLibsLink: _$(PrjLibsLink)_

###############################################################################
# include the *.d (dependency) files
###############################################################################

ifneq ($(MAKECMDGOALS),clean)
  ifneq ($(MAKECMDGOALS),build)
    ifneq ($(MAKECMDGOALS),fullclean)
      include   $(DepsPath)
    endif
  endif
endif

Attachment: smime.p7s
Description: Kryptographische Unterschrift mit S/MIME


reply via email to

[Prev in Thread] Current Thread [Next in Thread]