[anjuta] am-project: bgo #549440 - LIBADD is added at the wrong position in Makefile.am if it doesn't exist
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: bgo #549440 - LIBADD is added at the wrong position in Makefile.am if it doesn't exist
- Date: Sun, 13 Feb 2011 18:56:30 +0000 (UTC)
commit 27025c1fe68d6ea40e6f2b4d4eb8d51589135784
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sun Feb 13 19:39:37 2011 +0100
am-project: bgo #549440 - LIBADD is added at the wrong position in Makefile.am if it doesn't exist
plugins/am-project/am-writer.c | 40 ++++++++++++-
plugins/am-project/tests/properties.at | 89 +++++++++++++++++++++++++++++
plugins/am-project/tests/target_module.at | 4 +-
3 files changed, 128 insertions(+), 5 deletions(-)
---
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 03d9031..9d8a5be 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -60,7 +60,6 @@ anjuta_token_find_target_property_position (AmpTargetNode *target,
GList *list;
AmpGroupNode *group;
AnjutaToken *makefile;
-
group = AMP_GROUP_NODE (anjuta_project_node_parent (ANJUTA_PROJECT_NODE (target)));
@@ -115,9 +114,17 @@ anjuta_token_find_target_property_position (AmpTargetNode *target,
{
AnjutaProjectNode *prev = ANJUTA_PROJECT_NODE (target);
AnjutaProjectNode *next = ANJUTA_PROJECT_NODE (target);
+ AmpTargetNode *sibling;
AnjutaTokenFile *makefile;
+ AnjutaToken *target_list = NULL;
GList *link;
+ link = amp_target_node_get_token (target, ANJUTA_TOKEN_ARGUMENT);
+ if ((link != NULL) && (link->data != NULL))
+ {
+ target_list = anjuta_token_list ((AnjutaToken *)link->data);
+ }
+
makefile = amp_group_node_get_make_token_file (group);
if (makefile != NULL)
@@ -133,7 +140,7 @@ anjuta_token_find_target_property_position (AmpTargetNode *target,
prev = anjuta_project_node_prev_sibling (prev);
if (anjuta_project_node_get_node_type (prev) == ANJUTA_PROJECT_TARGET) break;
}
- list = prev == NULL ? NULL : amp_target_node_get_all_token (AMP_TARGET_NODE (prev));
+ sibling = AMP_TARGET_NODE (prev);
}
else
{
@@ -142,9 +149,36 @@ anjuta_token_find_target_property_position (AmpTargetNode *target,
next = anjuta_project_node_next_sibling (next);
if (anjuta_project_node_get_node_type (next) == ANJUTA_PROJECT_TARGET) break;
}
- list = next == NULL ? NULL : amp_target_node_get_all_token (AMP_TARGET_NODE (next));
+ sibling = AMP_TARGET_NODE (next);
}
+ list = sibling == NULL ? NULL : amp_target_node_get_all_token (sibling);
+
+ /* Check that the target is in the same list */
+ if ((list != NULL) && (target_list != NULL))
+ {
+ AnjutaToken *token;
+
+ link = amp_target_node_get_token (sibling, ANJUTA_TOKEN_ARGUMENT);
+ if ((link != NULL) && (link->data != NULL))
+ {
+ token = anjuta_token_list ((AnjutaToken *)link->data);
+ }
+ if ((token != NULL) && (target_list != token))
+ {
+ /* Target is in another list, do not use it, nor following ones */
+ list = NULL;
+ if (after)
+ {
+ prev = NULL;
+ }
+ else
+ {
+ next = NULL;
+ }
+ }
+ }
+
if (list != NULL)
{
gsize best = 0;
diff --git a/plugins/am-project/tests/properties.at b/plugins/am-project/tests/properties.at
index 599b68c..1a836c6 100644
--- a/plugins/am-project/tests/properties.at
+++ b/plugins/am-project/tests/properties.at
@@ -235,4 +235,93 @@ AT_CHECK([diff output expect])
+AT_DATA([expect],
+[[ GROUP (): empty9
+ TARGET (): target1
+ PROPERTY (Installation directory): bindir
+ PROPERTY (Libraries): $(GDL_LIBS)
+ SOURCE (): source2
+ TARGET (): target2
+ PROPERTY (Installation directory): bindir
+ PROPERTY (Libraries): $(GDL_LIBS)
+ SOURCE (): source1
+ TARGET (): library1.la
+ PROPERTY (Installation directory): libdir
+]])
+AT_DATA([reference.am],
+[[
+bin_PROGRAMS = target1 \
+ target2
+
+target1_SOURCES = \
+ source2
+
+target1_LDADD = $(GDL_LIBS)
+
+target2_SOURCES = \
+ source1
+
+target2_LDADD = $(GDL_LIBS)
+
+lib_LTLIBRARIES = \
+ library1.la
+]])
+AT_PARSER_CHECK([load empty8 \
+ move empty9 \
+ add target 0 library1.la lib \
+ list \
+ save])
+AT_CHECK([diff -b empty9/Makefile.am reference.am])
+AT_PARSER_CHECK([load empty9 \
+ list])
+AT_CHECK([diff output expect])
+
+
+
+AT_DATA([expect],
+[[ GROUP (): empty10
+ TARGET (): target1
+ PROPERTY (Installation directory): bindir
+ PROPERTY (Libraries): $(GDL_LIBS)
+ SOURCE (): source2
+ TARGET (): target2
+ PROPERTY (Installation directory): bindir
+ PROPERTY (Libraries): $(GDL_LIBS)
+ SOURCE (): source1
+ TARGET (): library1.la
+ PROPERTY (Installation directory): libdir
+ PROPERTY (Libraries): $(GDL_LIBS)
+]])
+AT_DATA([reference.am],
+[[
+bin_PROGRAMS = target1 \
+ target2
+
+target1_SOURCES = \
+ source2
+
+target1_LDADD = $(GDL_LIBS)
+
+target2_SOURCES = \
+ source1
+
+target2_LDADD = $(GDL_LIBS)
+
+lib_LTLIBRARIES = \
+ library1.la
+
+library1_la_LIBADD = $(GDL_LIBS)
+]])
+AT_PARSER_CHECK([load empty9 \
+ move empty10 \
+ set 0:2 lib '$(GDL_LIBS)' \
+ list \
+ save])
+AT_CHECK([diff -b empty10/Makefile.am reference.am])
+AT_PARSER_CHECK([load empty10 \
+ list])
+AT_CHECK([diff output expect])
+
+
+
AT_CLEANUP
diff --git a/plugins/am-project/tests/target_module.at b/plugins/am-project/tests/target_module.at
index 8c9b496..2d684f5 100644
--- a/plugins/am-project/tests/target_module.at
+++ b/plugins/am-project/tests/target_module.at
@@ -45,8 +45,8 @@ AT_DATA([expect],
PROPERTY (Libraries): $(MODULE1_LIBS)
MODULE (): MODULE1
TARGET (): program
- PROPERTY (Libraries): $(MODULE1_LIBS)
PROPERTY (Do not install): true
+ PROPERTY (Libraries): $(MODULE1_LIBS)
MODULE (): MODULE1
]])
AT_PARSER_CHECK([load simple1 \
@@ -68,8 +68,8 @@ AT_DATA([expect],
TARGET (): library.la
PROPERTY (Installation directory): libdir
TARGET (): program
- PROPERTY (Libraries): $(MODULE1_LIBS)
PROPERTY (Do not install): true
+ PROPERTY (Libraries): $(MODULE1_LIBS)
MODULE (): MODULE1
]])
AT_PARSER_CHECK([load simple2 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]