[Resending with less quoted lines to please mailing list software] On 09/04/2010 08:32 AM, Andre Majorel wrote:
On 09/03/2010 12:39 AM, Ingo van Lil wrote:* yadex-makedepend.patch: I couldn't find the "makedepend" tool in F13, so the yadex.dep rule always silently created an empty file (the error messages were hidden by the redirection of stderr). So I've added an alternative way to create the dependencies using gcc.They call it the way forward ; I call it the war against portability.
If you want compatibility you might want to consider switching to autoconf/automake. It will also take care of all the dependency stuff, building distribution files, installing to alternative destinations, etc.
I can give it a shot if you want.
Looks good. Only nitpick, it appends to yadex.dep so if an error occurs, you're left with a yadex.dep that is truncated but recent, so never rebuilt.
Actually, that's exactly what happened to me with your solution: The makedepend utility was missing, but the problem was hidden because only the last exit code in the pipe is regarded (i.e. the status of awk). With my solution, if the gcc call fails make will terminate before touching yadex.dep. If for some reason sed fails the yadex.dep file might be truncated. Can be fixed with a second temp file (see new patch).
-include cache/yadex.dep +-include cache/yadex.depCan you tell me the reasoning behind this change ?
It avoids an error message if yadex.dep is initially missing, e.g. because it's just been removed to force a rebuild. With this change it would also be possible to delete the file on "make clean" and to leave it out of the distribution packages.
Just ignore it if you think it's not a good idea. Cheers, Ingo
commit 826db64f444ab850e8389122f98622f79a0cc8df Author: Ingo van Lil <inguin@xxxxxx> Date: Tue Aug 31 21:08:37 2010 +0200 Use gcc (if available) to generate yadex.dep file. diff --git a/GNUmakefile b/GNUmakefile index 61c4652..b16cb10 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -767,6 +767,13 @@ $(OBJDIR)/files_share.man: $(OBJDIR)/config.share $(MAKEFILE) cache/yadex.dep: $(SRC_NON_GEN) src/config.h @echo "Generating $@" @test -d cache || mkdir cache +ifeq ($(CC), gcc) + @gcc -MM $(CFLAGS) $(SRC_NON_GEN) >$(@D)/.$(@F) + @sed 's,^.*\.o:,$(OBJDIR)/&,' $(@D)/.$(@F) >$@.new + @sed 's,^.*\.o:,$(DOBJDIR)/&,' $(@D)/.$(@F) >>$@.new + @rm $(@D)/.$(@F) + @mv $@.new $@ +else @makedepend -f- -Y -Iatclib $(SRC_NON_GEN) 2>/dev/null \ | $(AWK) 'sub (/^src/, "") == 1 { \ print "'$(OBJDIR)'" $$0; \ @@ -774,6 +781,7 @@ cache/yadex.dep: $(SRC_NON_GEN) src/config.h next; \ }' >$(@D)/.$(@F) @mv -f $(@D)/.$(@F) $@ +endif cache/copyright.man: $(MAKEFILE) scripts/copyright docsrc/copyright @echo "Generating $@"