perl-Glib r1056 - trunk



Author: tsch
Date: Sun Jan 18 13:34:20 2009
New Revision: 1056
URL: http://svn.gnome.org/viewvc/perl-Glib?rev=1056&view=rev

Log:
Add Glib::MakeHelper->postamble_precompiled_headers to generate a make target
for precompiling headers.


Modified:
   trunk/ChangeLog
   trunk/MakeHelper.pm

Modified: trunk/MakeHelper.pm
==============================================================================
--- trunk/MakeHelper.pm	(original)
+++ trunk/MakeHelper.pm	Sun Jan 18 13:34:20 2009
@@ -171,12 +171,14 @@
 
 =cut
 
+our @ADDITIONAL_FILES_TO_CLEAN = ();
+
 sub postamble_clean
 {
 	shift; # package name
 "
 realclean ::
-	-\$(RM_RF) build perl-\$(DISTNAME).spec ".join(" ", @_)."
+	-\$(RM_RF) build perl-\$(DISTNAME).spec @ADDITIONAL_FILES_TO_CLEAN @_
 ";
 }
 
@@ -508,6 +510,37 @@
 ";
 }
 
+=item string = Glib::MakeHelper->postamble_precompiled_headers (@headers)
+
+Create and return the text of Makefile rules for a 'precompiled-headers' target
+that precompiles I<@headers>.  If you call this before you call
+C<postamble_clean>, all temporary files will be removed by the 'realclean'
+target.
+
+=cut
+
+sub postamble_precompiled_headers
+{
+	shift; # package name
+	my @headers = @_;
+	my @precompiled_headers = ();
+	my $rules = "";
+	foreach my $header (@headers) {
+		my $output = $header . '.gch';
+		push @precompiled_headers, $output;
+		push @ADDITIONAL_FILES_TO_CLEAN, $output;
+		$rules .= <<PCH;
+
+$output: $header
+	\$(CCCMD) \$(CCCDLFLAGS) "-I\$(PERL_INC)" \$(PASTHRU_DEFINE) \$(DEFINE) $header
+PCH
+	}
+	$rules .= <<PCH;
+
+precompiled-headers: @precompiled_headers
+PCH
+}
+
 package MY;
 
 =back



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]