From 2cebef3a9e2f58c0260c54915440dc62e3d02594 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 10 Sep 2006 11:53:44 +0000 Subject: r18333: $< is broken in older BSD version: when $@ is foo/bar.o, $< could be torture/foo/bar.c if it also exists. So better use $* which is foo/bar to get foo/bar.c metze (This used to be commit 7aad9f81d927778bd3da6a37afc0489f1fefdc58) --- source4/main.mk | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'source4') diff --git a/source4/main.mk b/source4/main.mk index 270c9b3ff5..7a309a1fbe 100644 --- a/source4/main.mk +++ b/source4/main.mk @@ -330,26 +330,33 @@ include/includes.d: include/includes.h @echo "Generating dependencies for $<" @$(CC) -M -MG -MT include/includes.h.gch -MT $@ $(CFLAGS) $< -o $@ +# +# $< is broken in older BSD versions: +# when $@ is foo/bar.o, $< could be torture/foo/bar.c +# if it also exists. So better use $* which is foo/bar +# and append .c manually to get foo/bar.c +# .c.o: @if test -n "$(CC_CHECKER)"; then \ - echo "Checking $< with '$(CC_CHECKER)'"; \ - $(CC_CHECKER) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@; \ + echo "Checking $*.c with '$(CC_CHECKER)'"; \ + $(CC_CHECKER) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@; \ fi - @echo "Compiling $<" - @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@ && exit 0;\ + @echo "Compiling $*.c" + @$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ && exit 0;\ echo "The following command failed:" 1>&2;\ - echo "$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@" 1>&2;\ - echo "@: $@";\ - echo "<: $<";\ - echo "*: $*";\ - $(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $< -o $@ >/dev/null 2>&1 + echo "$(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@" 1>&2;\ + echo "@: $@" 1>&2;\ + echo "<: $<" 1>&2;\ + echo "*: $*" 1>&2;\ + echo "*.c: $*.c" 1>&2;\ + $(CC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) $(PICFLAG) -c $*.c -o $@ >/dev/null 2>&1 .c.ho: - @echo "Compiling $< with host compiler" - @$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $< -o $@ && exit 0;\ + @echo "Compiling $*.c with host compiler" + @$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ && exit 0;\ echo "The following command failed:" 1>&2;\ - echo "$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $< -o $@" 1>&2;\ - $(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $< -o $@ >/dev/null 2>&1 + echo "$(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@" 1>&2;\ + $(HOSTCC) `$(PERL) $(srcdir)/script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ >/dev/null 2>&1 .h.h.gch: @echo "Precompiling $<" -- cgit