Forum Index | FAQ | New User | Login | Search

Make a New PostPrevious ThreadView All Threads**Show in Threaded Mode

SubjectMakefiles Reply to this message
Posted byfinaldave
Posted on04/14/04 06:56 AM

Hi guys, I have a Makefile which looks like this, but at he moment it chucks all the .objs and .pchs into the same directory as the source files.

I'm not that good with nmake Makefile syntax, do you know how (like the Vis Studio IDE does) you can get it to put the .objs into a subdirectory like say Debug/Direct.obj or Release/Direct.obj or XBox/Direct.obj to save cluttering up the source directory?

Cheers in advance...

CPP =d:\xdk\xbox\bin\vc71\cl.exe

CFLAGS=/nologo /D_XBOX /I. /Id:\xdk\xbox\include /W4 /Ox /MT /YX
LFLAGS= /libpath:d:\xdk\xbox\lib /subsystem:xbox /map

OBJS=DSound.obj Emu.obj Input.obj LightCal.obj Loop.obj Main.obj Rom.obj \
Direct.obj FileMenu.obj Font.obj TexScreen.obj \
Unzip.obj zlib.lib \

LIBS=d3d8.lib d3dx8.lib xapilib.lib xboxkrnl.lib xgraphics.lib dsound.lib

all : default.xbe

# Convert .exe to XBox .xbe:
default.xbe : default.exe
$(IMAGEBLD) default.exe /out:default.xbe
del default.exe
del *.map
xbcp /y /t default.xbe xe:\DegaBox\DegaBox.xbe

# Link into .exe:
default.exe : $(OBJS)
$(LINK) $(LFLAGS) /out:default.exe $(OBJS) $(LIBS)

# Compile .cpp files:
@$(CPP) $(CFLAGS) /c $*.cpp

CLEANUP=*.xbe default.exe *.map *.obj *.pch
clean :
for %i in ( $(CLEANUP) ) do if exist %i del %i

You learn something old everyday...

SubjectRe: Makefiles new Reply to this message
Posted bysmf
Posted on04/15/04 02:58 AM

to set the object name you do /Fo

so you'd need somthing like:

# Compile .cpp files:
@$(CPP) $(CFLAGS) /c $*.cpp /Fo $**

and I think

OBJS=objs\DSound.obj objs\Emu.obj objs\Input.obj objs\LightCal.obj objs\Loop.obj objs\Main.obj objs\Rom.obj \
objs\Direct.obj objs\FileMenu.obj objs\Font.obj objs\TexScreen.obj

However you will also need to tell it how to map the files, something like:

objs\TexScreen.obj: TexScreen.cpp

you might as well add any of your own files that TexScreen.c #includes

objs\TexScreen.obj: TexScreen.cpp DavesInclude.h

Some versions of nmake won't use the .cpp.obj: bit in that case and you end up having to do:

COMPILE=@$(CPP) $(CFLAGS) /c $*.cpp /Fo $**

objs\TexScreen.obj: TexScreen.cpp DavesInclude.h

By this point you'll probably write a program which generates these :-)


Previous ThreadView All Threads**Show in Threaded Mode