svn commit: samba r22047 - in branches/SAMBA_4_0/source/build/smb_build: .

jpeach at samba.org jpeach at samba.org
Mon Apr 2 21:21:57 GMT 2007


Author: jpeach
Date: 2007-04-02 21:21:56 +0000 (Mon, 02 Apr 2007)
New Revision: 22047

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22047

Log:
Move suffix rules into smb_build. Enable $< if we are building with
GNU Make. This lets GNU Make users bild with $srcdir != $builddir.

Modified:
   branches/SAMBA_4_0/source/build/smb_build/makefile.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/smb_build/makefile.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2007-04-02 20:19:00 UTC (rev 22046)
+++ branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2007-04-02 21:21:56 UTC (rev 22047)
@@ -46,6 +46,7 @@
 	$self->output("default: all\n\n");
 
 	$self->_prepare_path_vars();
+	$self->_prepare_suffix_rules();
 	$self->_prepare_compiler_linker();
 
 	if (!$self->{automatic_deps}) {
@@ -104,6 +105,57 @@
 );
 }
 
+sub _prepare_suffix_rules($)
+{
+	my ($self) = @_;
+	my $first_prereq = '$*.c';
+
+	if ($self->{config}->{GNU_MAKE} eq 'yes') {
+		$first_prereq = '$<';
+	}
+
+	$self->output(<< "__EOD__"
+# Dependencies command
+DEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.o) -MT \$@ \\
+    `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(CFLAGS) $first_prereq-o \$@
+# Dependencies for host objects
+HDEPENDS = \$(CC) -M -MG -MP -MT \$(<:.c=.ho) -MT \$@ \\
+    `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(HOSTCC_CFLAGS) $first_prereq -o \$@
+# Dependencies for precompiled headers
+PCHDEPENDS = \$(CC) -M -MG -MT include/includes.h.gch -MT \$@ \\
+    \$(CFLAGS) $first_prereq -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
+#
+# If we have GNU Make, it is safe to use \$<, which also lets
+# building with \$srcdir != \$builddir work.
+
+# Run a static analysis checker
+CHECK = \$(CC_CHECKER) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(CFLAGS) \$(PICFLAG) -c $first_prereq -o \$@
+
+# Run the configured compiler
+COMPILE = \$(CC) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(CFLAGS) \$(PICFLAG) -c $first_prereq -o \$@
+
+# Run the compiler for the build host
+HCOMPILE = \$(HOSTCC) `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(HOSTCC_CFLAGS) -c $first_prereq -o \$@
+
+# Precompile headers
+PCHCOMPILE = @\$(CC) -Ilib/replace \\
+    `\$(PERL) \$(srcdir)/script/cflags.pl \$@` \\
+    \$(CFLAGS) \$(PICFLAG) -c $first_prereq -o \$@
+
+__EOD__
+);
+}
+
 sub _prepare_compiler_linker($)
 {
 	my ($self) = @_;



More information about the samba-cvs mailing list