[anjuta] Partial fix bgo #569992 - support makefiles named GNUmakefile.am



commit 0cfa19040140dbbd50928b853a8e8d9ca4d72a33
Author: Nanci de Brito Bonfim <nancibonfim gmail com>
Date:   Wed Oct 13 07:59:09 2010 +0200

    Partial fix bgo #569992 - support makefiles named GNUmakefile.am

 plugins/build-basic-autotools/plugin.c  |   17 ++++++++++++++---
 plugins/gbf-am/gbf-am-parse.in          |   14 +++++++++++---
 plugins/gbf-am/gbf-am-project.c         |    6 ++++--
 plugins/gbf-mkfile/gbf-mkfile-project.c |    6 ++++++
 4 files changed, 35 insertions(+), 8 deletions(-)
---
diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c
index af7f67b..559aee7 100644
--- a/plugins/build-basic-autotools/plugin.c
+++ b/plugins/build-basic-autotools/plugin.c
@@ -212,11 +212,22 @@ directory_has_makefile_am (BasicAutotoolsPlugin *bb_plugin, const char *dirname
 	}
 	g_free (configure);
 
-	/* Check for Makefile.am */
+	/* Check for Makefile.am or GNUmakefile.am */
+	
+	makefile_am_exists = TRUE;
+	
 	makefile_am = g_build_filename (dirname, "Makefile.am", NULL);
-	makefile_am_exists = g_file_test (makefile_am, G_FILE_TEST_EXISTS);
-	g_free (makefile_am);
+	if (! g_file_test (makefile_am, G_FILE_TEST_EXISTS)) {
+		g_free (makefile_am);
 
+		makefile_am = g_build_filename (dirname, "GNUmakefile.am", NULL);
+		if (!g_file_test (makefile_am, G_FILE_TEST_EXISTS)) {
+			g_free (makefile_am);
+	
+			makefile_am_exists = FALSE;
+		}
+	}
+	
 	return makefile_am_exists;
 }
 
diff --git a/plugins/gbf-am/gbf-am-parse.in b/plugins/gbf-am/gbf-am-parse.in
index 220579e..a48a1bd 100644
--- a/plugins/gbf-am/gbf-am-parse.in
+++ b/plugins/gbf-am/gbf-am-parse.in
@@ -940,7 +940,7 @@ sub expand_variables
 	my $sources = join ' ', @{$targets{$target}{sources}};
 	$sources = &expand_one_var ($sources, %macros);
 	# Remove any reference to the Makefile itself
-	$sources =~ s/\s+Makefile\s+//g;
+	$sources =~ s/\s+(GNU)?Makefile\s+//g;
 	$targets{$target}{sources} = [ split '\s+', &trim ($sources) ];
 
 	# Expand built_files
@@ -1096,10 +1096,15 @@ sub create_group
 		  project  => $project };
 
     my $full_prefix = $project->{prefix} . $prefix;
-    $group->{makefile} = &parse_am_file ("${full_prefix}Makefile.am");
 
+    my $makefile_name = "${full_prefix}Makefile.am";
+    if (! -f $makefile_name) {
+        $makefile_name = "${full_prefix}GNUmakefile.am"
+    }
+
+    $group->{makefile} = &parse_am_file ($makefile_name);
     if (! $group->{makefile}) {
-	return undef;
+        return undef;
     };
 
     &group_process ($group);
@@ -1112,6 +1117,9 @@ sub create_group
 	    if ($subgroup ne ".") {
 		&debug ("${full_prefix}: Recursing into '$subgroup'");
 		my $makefile = "${full_prefix}$subgroup/Makefile.am";
+        if (! -f $makefile ) {
+            $makefile = "${full_prefix}$subgroup/GNUmakefile.am";
+        }
 		if (-f $makefile ) {
 		    my $new_prefix = $prefix ne "" ? "$prefix$subgroup/" : $subgroup;
 		    $group->{groups}{$subgroup} = &create_group ($new_prefix, 
diff --git a/plugins/gbf-am/gbf-am-project.c b/plugins/gbf-am/gbf-am-project.c
index 67bf5a2..37c3c65 100644
--- a/plugins/gbf-am/gbf-am-project.c
+++ b/plugins/gbf-am/gbf-am-project.c
@@ -2792,7 +2792,8 @@ impl_probe (GbfProject  *_project,
 	if (normalized_uri != NULL) {
 		root_path = anjuta_util_get_local_path_from_uri (normalized_uri);
 		if (root_path != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
-			retval = (file_exists (root_path, "Makefile.am") &&
+			retval = ((file_exists (root_path, "Makefile.am") ||
+				   file_exists (root_path, "GNUmakefile.am")) &&
 				  (file_exists (root_path, "configure.in") ||
 				   file_exists (root_path, "configure.ac")));
 			g_free (root_path);
@@ -4191,7 +4192,8 @@ gbf_am_project_probe (GFile *file, GError **err)
 
 	root_path = g_file_get_path (file);
 	if ((root_path != NULL) && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
-		retval = (file_exists (root_path, "Makefile.am") &&
+		retval = ((file_exists (root_path, "Makefile.am") ||
+			   file_exists (root_path, "GNUmakefile.am")) &&
 			  (file_exists (root_path, "configure.in") ||
 			   file_exists (root_path, "configure.ac")));
 	}
diff --git a/plugins/gbf-mkfile/gbf-mkfile-project.c b/plugins/gbf-mkfile/gbf-mkfile-project.c
index 7e90e47..971a192 100644
--- a/plugins/gbf-mkfile/gbf-mkfile-project.c
+++ b/plugins/gbf-mkfile/gbf-mkfile-project.c
@@ -2764,8 +2764,11 @@ impl_probe (GbfProject  *_project,
 	g_object_unref (file);
 	if (root_path != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 		retval = ((file_exists (root_path, "Makefile") ||
+			   file_exists (root_path, "GNUmakefile") ||
 				   file_exists (root_path, "makefile")) &&
 				   !(file_exists (root_path, "Makefile.am") || 
+				     file_exists (root_path, "GNUmakefile.am") ||
+				     file_exists (root_path, "GNUmakefile.in") ||
 					 file_exists (root_path, "Makefile.in")));
 		g_free (root_path);
 	}
@@ -3914,8 +3917,11 @@ gbf_mkfile_project_probe (GFile *file, GError **err)
 	root_path = g_file_get_path (file);
 	if ((root_path) != NULL && g_file_test (root_path, G_FILE_TEST_IS_DIR)) {
 		retval = ((file_exists (root_path, "Makefile") ||
+			   file_exists (root_path, "GNUmakefile") ||
 				   file_exists (root_path, "makefile")) &&
 				   !(file_exists (root_path, "Makefile.am") || 
+				     file_exists (root_path, "GNUmakefile.am") ||
+				     file_exists (root_path, "GNUmakefile.in") ||
 					 file_exists (root_path, "Makefile.in")));
 	}
 	g_free (root_path);



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