Re: [GD-Windows] Makefile woes
Brought to you by:
vexxed72
From: Daniel G. <dgl...@cr...> - 2005-05-11 03:41:06
|
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 |