On Wed, Mar 27, 2013 at 8:53 PM, Nick Andrik <nick.and...@gmail.com> wrote: >>> My problem is that every time that I run make clean, the rules for >>> creating DEPS are executed again. >>> Is there any way to tell the Makefile to ignore the final include line >>> (or empty the DEPS var) when I run make clean? >> >> The really short answer is that you should read >> http://make.paulandlesley.org/autodep.html#advanced > > I have laready been through that, but I found no way to get rid of the > .d generation when I call clean
That webpage explain how: don't have the .d files as targets! The .d files should only be generated as a *side effect* of the generation of the .o files. ... >> When there are file that require two stages to build, the second of >> which may require dependencies that you cannot calculate until the >> first is done (the lexer.c file might not be compilable without the >> parser.tab.h file generated by bison). So, to auto-generate >> dependencies for the .o files you'll need to previously inform make of >> the relevant ".c: .y" and ".c: .l" dependencies. > > Sorry for not being clear up front. I do have rules for generating all > the .cpp .hh .hpp files needed for the other rules. I didn't include > these rules in my initial example because I wanted to keep it kind of > simple. We can consider that there are rules for every generated c++ > and header files. Ah, good. >> My preference is to declare the generated .h files to be order-only >> dependencies of *all* the .o files. That way make will know that it >> has to generate the .h before it tries to compile the .o's, but once >> the .h exists the .o's will only be recompiled if the auto-dependency >> bits generate a *real* dependency on the .h. >> >> ${OBJS} : | parser.tab.h >> >> (...or whatever the name of the generated .h file(s) are) > > Hmm, that's an interesting approach, but I still need to use the > -include directive, no? Yes, you still need the -include... > If I do, then my problem persists: .d files are created for each make > clean invocation ...but this won't happen if the .d files are not targets. > By the way, I might go on with some double calling of the makefile and > check if I can get away with the include directive Ick, that's strictly worse. Philip Guenther _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make