Sign in to follow this  
KulSeran

makefile help

Recommended Posts

I've got a build process I'm running. And while I can mostly marshal the makefile to do what I want, I'm hopeing someone can help me get the last steps into it. I got my main segment: assetName: [files] #build asset levelName: assetName #build level all: levelName #build code Now, the part that confuses me is I have something rather simple in the form of data\assetName\assetName.x data\assetName\STUFF\assetName.y data\assetName\OTHERDIR\assetName.z etc. each of those files is made from src\assetName\assetName.a src\assetName\STUFF\assetName.b etc. and 90% of my files follow that format the rest i can probably marshal into that format. And for the moment, i've resorted to copy paste. But shouldn't there be a way where i can define ASSETS = cat cow box and have: data\cat\cat.bakedmodel: cat\model\cat.model cat: data\cat\cat.bakedmodel #tie all the asset parts together done up for each item in that list?

Share this post


Link to post
Share on other sites
It really depends on which kind of make you're using (GNU make, nmake, BSD make, etc). They all have different macros and commands for this kind of thing.

If it's GNU make, the online manual isn't too bad.

Share this post


Link to post
Share on other sites
Look into suffix rules. That is, you want to try something like this:
.SUFFIXES : .model .bakedmodel

MODELS = cat.bakedmodel cow.bakedmodel box.bakedmodel

all_models.bin : $(MODELS)
merge -o $@ $(MODELS)

.model.bakedmodel :
process_model -o $@ $?

Quote:
Original post by the_edd
It really depends on which kind of make you're using (GNU make, nmake, BSD make, etc). They all have different macros and commands for this kind of thing.
I should think this is a fairly standard feature, actually.

Share this post


Link to post
Share on other sites
Ok, the suffix thing kinda fixes my issue. but only kinda.
i have a path and a path
mmmmmmmm\SRCS\cat\SOURCE\cat.model
mmmmmmmm\DATA\cat\SOURCE\cat.bakedmodel

the TOOLS take the name "cat" and build the associated parts to the right places.
I thusly need these rules:


mmmmmmmm\DATA\cat\SOURCE\cat.bakedmodel: mmmmmmmm\SRCS\cat\SOURCE\cat.model
ProcessModel cat

LevelCatHouse : mmmmmmmm\DATA\cat\SOURCE\cat.bakedmodel # other files put in the level go here.
ProcessLevel cathouse

allCode: LevelCatHouse
generateLevelSpecificCodeStubs cathouse
devenv project.sln /Build "DEBUG"


I don't really need make to know most the file names, I was just hoping to use it to process all the files (based on does X need updates? remake it) Mostly since the .sln is just wrapping a makefile project, I want to even get away from that for my case, since i just want a commandline tool to rebuild all the assets that have changed for this part of the project. so maybe there is some other tool for windows that I could use to make this happen?

My big issue is that it is VERY easy for me to look at a checkin and see "oh someone updated something in "\SRCS\cat\", that is in my level, i should run "buildcreature cat". But when there are tonnes of checkins, and I dont notice that something in my level was updated, I may be way out of date on my files next time i run the game, causing a crash or other other problem because my data doesnt line up with what the game now expects.
So i was making this file, but there is a lot of verbose typing for something that is really easy to parse visually for the issue, but a pain in the ass to type out a few hundred times.


[Edited by - KulSeran on October 26, 2008 11:43:15 PM]

Share this post


Link to post
Share on other sites
I'm not sure I see exactly what it is that you want to automate.
Some make implementations, such as gmake, have extensions to manipulate sets of filenames, to place the output file in a different directory or whatever. Though it's not what I'd call clean (but then again string manipulation rarely is.) To be honest Make was never really designed to handle directories and it shows.
Another possible solution is to generate makefiles dynamically from a separate script. Or you could let your tools themselves compare the modification dates. And of course you can always switch to a more powerful build tool, like scons, jam, or whatever.

Honestly I don't see this as much of a problem. Any old five cent shell/batch script hack job could piece this together for you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this