nested nmake

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I'm no nmake expert and so I'm running into trouble trying to do what I
assume is a simple task. I prefer to use nmake to build my projects rather
than the visual IDE. I'm building .NET 2.0 assemblies. I would like to
setup a hierarchical directory structure which will cascade nmakes. So
whatever level I run nmake at it will traverse down the directory structure
running nmake at each level. I don't need it to dynamically figure out what
directories are contained below and can code that into the make file. I'm
having trouble getting the correct targets to ripple through however. So if
I do an 'nmake clean' it want all the successive nmakes to make the 'clean'
target. I have the following makefile (which doesn't work) which I copied
from something I did a while ago which I thought was working. When I do an

nmake clean

it appears it's actually doing a

nmake

followed by a

nmake clean

Any ideas what I'm doing wrong or just suggestions on how I should be doing
this?

Services=Services
Services=$(Services:type=)
Frameworks=Frameworks
Frameworks=$(Frameworks:type=)

!ifndef OUTPUTBASE
OUTPUTBASE=bin
!endif

OUTPUTDIR=$(OUTPUTBASE)\buildtype
THIRDPARTY=3rdParty

!ifdef RELEASE
OUTPUTDIR=$(OUTPUTDIR:buildtype=release)
!else
OUTPUTDIR=$(OUTPUTDIR:buildtype=debug)
DEBUGFLAGS=/debug+
!endif

all: $(OUTPUTBASE) $(OUTPUTDIR) $(Services:type=) $(Frameworks:type=) \
$(OUTPUTDIR)\Cougar.exe

clean: $(Services:type=clean) $(Frameworks:type=clean)
!if EXISTS($(OUTPUTDIR)\Cougar.exe)
del $(OUTPUTDIR)\Cougar.exe
!endif
!if EXISTS($(OUTPUTDIR)\Cougar.pdb)
del $(OUTPUTDIR)\Cougar.pdb
!endif

rebuild: clean all

$(OUTPUTBASE):
md $(OUTPUTBASE)

$(OUTPUTDIR):
md $(OUTPUTDIR)

$(Services:type=)::
cd Services
set RELEASE=$(RELEASE)
set THIRDPARTY=..\$(THIRDPARTY)
set OUTPUTBASE=..\$(OUTPUTBASE)
nmake
cd ..

$(Frameworks:type=)::
cd Frameworks
set RELEASE=$(RELEASE)
set THIRDPARTY=..\$(THIRDPARTY)
set OUTPUTBASE=..\$(OUTPUTBASE)
nmake
cd ..

$(Services:type=clean)::
cd Services
set RELEASE=$(RELEASE)
set THIRDPARTY=..\$(THIRDPARTY)
set OUTPUTBASE=..\$(OUTPUTBASE)
nmake clean
cd ..

$(Frameworks:type=clean)::
cd Frameworks
set RELEASE=$(RELEASE)
set THIRDPARTY=..\$(THIRDPARTY)
set OUTPUTBASE=..\$(OUTPUTBASE)
nmake clean
cd ..

$(OUTPUTDIR)\Cougar.exe: Cougar.cs
csc $(DEBUGFLAGS) /out:$@ $**
--
Thanks,
Nick
.



Relevant Pages

  • RE: nested nmake
    ... > I'm no nmake expert and so I'm running into trouble trying to do what I ... > setup a hierarchical directory structure which will cascade nmakes. ... > I do an 'nmake clean' it want all the successive nmakes to make the 'clean' ... I have the following makefile which I copied ...
    (microsoft.public.win32.programmer.tools)
  • Dont know how to make
    ... The thing that's baffling me is that if I do "nmake clean", ... all the output files. ... $(stringclassfiles) and successfully makes and deploys it, ...
    (microsoft.public.vc.language)
  • RE: NMAKE : fatal error U1073: dont know how to make
    ... NMAKE fails because it cannot find s3c2440a_lcd_lib.lib ... SOURCELIBS: ... !IFDEF CLEARTYPE ... !ENDIF ...
    (microsoft.public.windowsce.platbuilder)