Re: Makefile woes

Daniel Glastonbury <[email protected]> Wed, 11 May 2005 13:40:51 +1000
Newsgroups gmane.games.devel.windows
Organization The Creative Assembly
Message-ID <[email protected]>
It's been more than 2 years since I had to maintain makefiles, so this 
is all coming from memory.

Brett Bibby wrote:

>1. I want to check for the existence of a directory, and if it doesn't exist
>create it.
>
>Most of the linux/unix examples do something like:
>
>.PHONY: $(SUBDIR)
>$(SUBDIR):
>	@[ -d $(SUBDIR) ] || mkdir -p $(SUBDIR)
>
>
>Obviously the mkdir needs to become md, but it seems to me that the brackets
>and the or'ing are using the shell to test for the directory? I don't know
>shell commands at all and it's frustrating trying to figure out this stuff.
>  
>
[ is a exe in unix, but more likely a shell builtin these days.  It 
might be a synonym for 'file'.  But it's using circuit evaluation to 
test if $(SUBDIR) exists, and if it doesn't then it creates the directory.

But if you're running under cygwin, you should have the unix shell, 
shouldn't you?  (And a version of the mkdir)

>2. I want to do some printf style debugging beyond the -d makefile switch.
>Something like:
>
><some makefile commands>
>echo "You got here"
><some more makefile commands>
>
>But this doesn't work. What is the way/format to output messages anywhere
>during the make build.
>  
>
Make builds dependencies.  You can only run commands as the result of 
make deciding it needs to build a dependency.

$(SUBDIR):
    @echo Creating dir $(SUBDIR)...
    @[ -d $(SUBDIR) ] || mkdir -p $(SUBDIR)
    @echo Done.

Doesn't really clarify anything, does it...

cheers
DanG



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Gamedevlists-windows mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=555