diff --git a/compiler2/makefile.c b/compiler2/makefile.c
index ae9c621ac34901e92c0627bd04a0cc10b87c9ec8..8f73f538958511082dedb5e8ea61f84e55c2e5a4 100644
--- a/compiler2/makefile.c
+++ b/compiler2/makefile.c
@@ -4156,27 +4156,6 @@ static void usage(void)
     error_flag = TRUE;\
     } else x##flag = TRUE
 
-void free_string_list(struct string_list* act_elem)
-{
-  while (act_elem) {
-    struct string_list* next_elem = act_elem->next;
-    Free(act_elem->str);
-    Free(act_elem);
-    act_elem = next_elem;
-  }
-}
-
-void free_string2_list(struct string2_list* act_elem)
-{
-  while (act_elem) {
-    struct string2_list* next_elem = act_elem->next;
-    Free(act_elem->str1);
-    Free(act_elem->str2);
-    Free(act_elem);
-    act_elem = next_elem;
-  }
-}
-
 int main(int argc, char *argv[])
 {
   boolean
diff --git a/compiler2/xpather.cc b/compiler2/xpather.cc
index 2c6cf1e3273b3bce835b5c9f1c4595d73d8281f8..658be18d97145f050aae629d4ba8b7194cd69baa 100644
--- a/compiler2/xpather.cc
+++ b/compiler2/xpather.cc
@@ -621,6 +621,549 @@ const char* get_act_config(struct string2_list* cfg, const char* project_name) {
   return NULL;
 }
 
+void free_string_list(struct string_list* act_elem)
+{
+  while (act_elem) {
+    struct string_list* next_elem = act_elem->next;
+    Free(act_elem->str);
+    Free(act_elem);
+    act_elem = next_elem;
+  }
+}
+
+void free_string2_list(struct string2_list* act_elem)
+{
+  while (act_elem) {
+    struct string2_list* next_elem = act_elem->next;
+    Free(act_elem->str1);
+    Free(act_elem->str2);
+    Free(act_elem);
+    act_elem = next_elem;
+  }
+}
+
+void free_config_list(struct config_list* act_elem) {
+  while (act_elem) {
+    struct config_list* next_elem = act_elem->next;
+    Free(act_elem->str1);
+    Free(act_elem->str2);
+    Free(act_elem);
+    act_elem = next_elem;
+  }
+}
+
+void free_config_struct(struct config_struct* act_elem) {
+  while (act_elem) {
+    struct config_struct* next_elem = act_elem->next;
+    Free(act_elem->project_name);
+    Free(act_elem->project_conf);
+    free_string_list(act_elem->dependencies);
+    free_string2_list(act_elem->requirements);
+    free_string_list(act_elem->children);
+    Free(act_elem);
+    act_elem = next_elem;
+  }
+}
+
+// Initialize a config_struct to NULL-s
+static void config_struct_init(struct config_struct* const list) {
+  list->project_name = list->project_conf = NULL;
+  list->is_active = FALSE;
+  list->dependencies = (struct string_list*)Malloc(sizeof(struct string_list));
+  list->dependencies->str = NULL;
+  list->dependencies->next = NULL;
+  list->requirements = (struct string2_list*)Malloc(sizeof(struct string2_list));
+  list->requirements->str1 = NULL;
+  list->requirements->str2 = NULL;
+  list->requirements->next = NULL;
+  list->children = (struct string_list*)Malloc(sizeof(struct string_list));
+  list->children->str = NULL;
+  list->children->next = NULL;
+  list->processed = FALSE;
+  list->next = NULL;
+}
+
+// This function fills up the dependencies field of the config_structs
+// using the children fields.
+static void config_struct_fillup_deps(struct config_struct* const list) {
+  struct config_struct* last = list;
+  while (last && last->project_name != NULL) {  // Go through the projects
+    struct config_struct* lastest = list;
+    while (lastest && lastest->project_name != NULL) { // Go through the projects again n^2 complexity
+      struct string_list* lastest_child = lastest->children;
+      while (lastest_child && lastest_child->str != NULL) {
+        if (strcmp(last->project_name, lastest_child->str) == 0) { // If a project is a child of another project
+          // Add the other project to the project's dependencies
+          // But first check if it is already in the dependencies
+          boolean already_in = FALSE;
+          struct string_list* last_dep = last->dependencies;
+          while (last_dep && last_dep->str != NULL) {
+            if (strcmp(last_dep->str, lastest->project_name) == 0) {
+              already_in = TRUE;
+              break;
+            }
+            last_dep = last_dep->next;
+          }
+          if (already_in == FALSE) {
+            last_dep->str = mcopystr(lastest->project_name);
+            struct string_list* last_dep_next = (struct string_list*)Malloc(sizeof(string_list));
+            last_dep_next->str = NULL;
+            last_dep_next->next = NULL;
+            last_dep->next = last_dep_next;
+            break;
+          }
+        }
+        lastest_child = lastest_child->next;
+      }
+      lastest = lastest->next;
+    }
+    last = last->next;
+  }
+}
+
+// This function inserts project_name project's project_config configuration
+// into the required configurations. This function can detect errors.
+// If an error is detected FALSE is returned, otherwise TRUE.
+static boolean insert_to_required_config(const struct config_struct* all_configs, const char* project_name, const char* project_config, struct string2_list* const required_configs) {
+
+  boolean found_project = FALSE;
+  boolean found_config = FALSE;
+  boolean result = TRUE;
+  
+  //Check that it is a valid configuration for a valid project
+  const struct config_struct* last = all_configs;
+  while(last && last->project_name != NULL && last->project_conf != NULL) {
+    if (strcmp(last->project_name, project_name) == 0) {
+      found_project = TRUE;
+      if (strcmp(last->project_conf, project_config) == 0) {
+        found_config = TRUE;
+        break;
+      }
+    }
+    last = last->next;
+  }
+  // If the project or the configuration is not found
+  if (found_project == FALSE || found_config == FALSE) {
+    result = FALSE;
+  }
+  
+  // Check if the project is already in the required configurations
+  // or if the project is present with a different configuration
+  boolean already_in = FALSE;
+  struct string2_list* last_required_config = required_configs;
+  while (last_required_config && last_required_config->str1 != NULL && last_required_config->str2 != NULL) {
+    // If we have a record of this project
+    if (strcmp(last_required_config->str1, project_name) == 0) {
+      if (strcmp(last_required_config->str2, project_config) == 0) {
+        // This project configuration is already in the required_configs
+        already_in = TRUE;
+      } else {
+        // This project configuration is different than it is in the required_configs
+        result = FALSE;
+      }
+    }
+    last_required_config = last_required_config->next;
+  }
+  // If the project's configuration is not already present in the required
+  // configs then we insert it. We insert it even when the result is FALSE.
+  if (last_required_config && already_in == FALSE) {
+    // Make copies of strings
+    last_required_config->str1 = mcopystr(project_name);
+    last_required_config->str2 = mcopystr(project_config);
+    // Init next required configuration
+    struct string2_list* last_required_config_next = (struct string2_list*)Malloc(sizeof(struct string2_list));
+    last_required_config_next->str1 = NULL;
+    last_required_config_next->str2 = NULL;
+    last_required_config_next->next = NULL;
+    last_required_config->next = last_required_config_next;
+  }
+  return result;
+}
+
+// Inserts project_name project with project_config configuration to the tmp_configs
+// Return TRUE if the configuration is inserted
+// Returns FALSE if the configuration is not inserted
+// Returns 2 if the configuration is already in the tmp_configs (still inserted)
+static boolean insert_to_tmp_config(struct config_list* const tmp_configs, const char* project_name, const char* project_config, const boolean is_active) {
+  //First we check that it is a valid configuration for a valid project
+  boolean found_project = FALSE;
+  boolean found_config = FALSE;
+  boolean active = FALSE;
+  boolean result = TRUE;
+  
+  //Check if we have the same project with same configuration in the tmp_configs
+  struct config_list* last = tmp_configs;
+  while(last && last->str1 != NULL && last->str2 != NULL) {
+    if (strcmp(last->str1, project_name) == 0) {
+      found_project = TRUE;
+      active = last->is_active;
+      if (strcmp(last->str2, project_config) == 0) {
+        found_config = TRUE;
+        break;
+      }
+    }
+    last = last->next;
+  }
+  
+  //The case of same project with same configuration
+  if (found_project == TRUE && found_config == TRUE) {
+    result = 2;
+    
+  // The case of same project different configuration and the configuration
+  // is not default
+  } else if(found_project == TRUE && active == FALSE) {
+    return FALSE;
+  }
+  // Go to the end of list
+  while (last->next) {
+    last = last->next;
+  }
+  // Insert new config into the tmp_configs
+  last->str1 = mcopystr(project_name); 
+  last->str2 = mcopystr(project_config);
+  last->is_active = is_active;
+  last->next = (struct config_list*)Malloc(sizeof(config_list));
+  last->next->str1 = NULL;
+  last->next->str2 = NULL;
+  last->next->is_active = FALSE;
+  last->next->next = NULL;
+
+  return result;
+}
+
+// Removes the last element from the tmp_configs
+static void remove_from_tmp_config(struct config_list* const tmp_configs, const char* /*project_name*/, const char* /*project_config*/) {
+  struct config_list* last = tmp_configs;
+  while (last->next && last->next->next != NULL) {
+    last = last->next;
+  }
+
+  Free(last->str1);
+  Free(last->str2);
+  last->str1 = NULL;
+  last->str2 = NULL;
+  last->is_active = FALSE;
+  Free(last->next);
+  last->next = NULL;
+}
+
+// This function detects a circle originating from start_project.
+// act_project is the next project which might be in the circle
+// needed_in is a project that is needed to be inside the circle
+// list is a temporary list which contains the elements of circle
+static boolean is_circular_dep(const struct config_struct* all_configs, const char* start_project, const char* act_project, const char* needed_in, struct string_list** list) {
+  if (*list == NULL) {
+    *list = (struct string_list*)Malloc(sizeof(string_list));
+    (*list)->str = mcopystr(start_project);
+    (*list)->next = (struct string_list*)Malloc(sizeof(string_list));
+    (*list)->next->str = NULL;
+    (*list)->next->next = NULL;
+  }
+  //Circle detection
+  struct string_list* last_list = *list;
+  while (last_list && last_list->str != NULL) {
+    struct string_list* last_list2 = last_list;
+    while (last_list2 && last_list2->str != NULL) {
+      // If the pointers are different but the project name is the same
+      if (last_list != last_list2 && strcmp(last_list->str, last_list2->str) == 0) {
+        // We look for the circle which starts from the start_project
+        if (strcmp(last_list->str, start_project) != 0) {
+          return FALSE;
+        } else {
+          // Check if needed_in is inside the circle
+          while (last_list != last_list2) {
+            if (needed_in != NULL && strcmp(last_list->str, needed_in) == 0) {
+              return TRUE;
+            }
+            last_list = last_list->next;
+          }
+          return FALSE;
+        }
+      }
+      last_list2 = last_list2->next;
+    }
+    last_list = last_list->next;
+  }
+  // Insert next element and call recursively for all the referenced projects
+  const struct config_struct* last = all_configs;
+  while (last && last->project_name) {
+    //Find an act_project configuration
+    if (strcmp(last->project_name, act_project) == 0) {
+      // Go through its children
+      struct string_list* children = last->children;
+      while (children && children->str != NULL) {
+        // Insert child into list
+        last_list->str = mcopystr(children->str);
+        last_list->next = (struct string_list*)Malloc(sizeof(string_list));
+        last_list->next->str = NULL;
+        last_list->next->next = NULL;
+        // Call recursively
+        if (is_circular_dep(all_configs, start_project, children->str, needed_in, list) == TRUE) {
+          return TRUE;
+        }
+        // Remove child
+        last_list = *list;
+        while(last_list && last_list->str) {
+          last_list = last_list->next;
+        }
+        Free(last_list->str);
+        Free(last_list->next);
+        last_list->str = NULL;
+        last_list->next = NULL;
+        children = children->next;
+      }
+    }
+    last = last->next;
+  }
+  return FALSE;
+}
+
+// check if project_name project does not exists todo
+// Project config == NULL means that we need to analyse the children of the project, todo why
+// This function analyses project_name project to get the required configuration
+// of this project.
+// project_config may be NULL. It is not null when we are not certain of the
+// project_name project's configuration.
+// tmp_configs acts like a stack. It contains the history calls of anal_child. It
+// is used to detect circles therefore prevents infinite recursions.
+static boolean analyse_child(struct config_struct* const all_configs, const char* project_name, const char* project_config, struct string2_list* const required_configs, struct config_list* const tmp_configs) {
+  boolean result = TRUE;
+  const char* act_config = get_act_config(required_configs, project_name);
+  // If the required configuration is known of project_name project
+  if (act_config != NULL) {
+    struct config_struct* tmp = all_configs;
+    // Get the project_name's act_config config_struct (tmp holds it)
+    while (tmp && tmp->project_name != NULL && tmp->project_conf != NULL) {
+      if (strcmp(tmp->project_name, project_name) == 0 && strcmp(tmp->project_conf, act_config) == 0) {
+        break;
+      }
+      tmp = tmp->next;
+    }
+    if (tmp->processed == TRUE) {
+      // We already processed this project there is nothing to be done
+      return result;
+    }
+    // Set the project to processed
+    tmp->processed = TRUE;
+    // Get the last (empty) required configuration
+    struct string2_list* last_required_config = required_configs;
+    while (last_required_config->next != NULL) {
+      last_required_config = last_required_config->next;
+    }
+    // Insert all required config of project_name project's act_config configuration
+    struct string2_list* last_proj_config = tmp->requirements;
+    while (last_proj_config && last_proj_config->str1 != NULL && last_proj_config->str2 != NULL) {
+      result = insert_to_required_config(all_configs, last_proj_config->str1, last_proj_config->str2, required_configs);
+      last_proj_config = last_proj_config->next;
+    }
+    // Analyse the children of this project too.
+    result = insert_to_tmp_config(tmp_configs, project_name, act_config, TRUE);
+    struct string_list* last_child = tmp->children;
+    while (last_child && last_child->str != NULL) {
+      result = analyse_child(all_configs, last_child->str, NULL, required_configs, tmp_configs);
+      if (result == FALSE) return result;
+      last_child = last_child->next;
+    }
+    remove_from_tmp_config(tmp_configs, project_name, act_config);
+    
+  } else {
+    
+    // The required configuration of the project_name project is unknown
+    boolean found = FALSE; // True if someone requires a configuration about project_name project
+    boolean is_active = FALSE;
+    
+    // Go through every required configuration to check if someone requires
+    // something about project_name project.
+    struct config_struct* last = all_configs;
+    while (last && last->requirements != NULL) {
+      struct string2_list* req_config = last->requirements;
+      while (req_config && req_config->str1 != NULL && req_config->str2 != NULL) {
+        // If someone requires something about project_name project
+        if (strcmp(req_config->str1, project_name) == 0) {
+          const struct config_struct* tmp = all_configs;
+          // Get the active configuration of project_name project
+          while (tmp && tmp->project_name != NULL && tmp->project_conf != NULL) {
+            if (strcmp(tmp->project_name, project_name) == 0 && tmp->is_active == TRUE) {
+              act_config = tmp->project_conf;
+              is_active = TRUE;
+              break;
+            }
+            tmp = tmp->next;
+          }
+          found = TRUE;
+          
+          // Insert the project_name with its active configuration
+          result = insert_to_tmp_config(tmp_configs, project_name, act_config, is_active);
+          if (result == FALSE) {
+            return FALSE;
+          } else if (result == 2) { // result is 2 if a circle is detected (this will cause error later)
+            result = insert_to_required_config(all_configs, project_name, act_config, required_configs);
+            if (result == FALSE) return result;
+          }
+          
+          // Analyse the project that requires something about project_name project
+          result = analyse_child(all_configs, last->project_name, last->project_conf, required_configs, tmp_configs);
+          remove_from_tmp_config(tmp_configs, project_name, act_config);
+          // If some errors happened during the analysis of last->project_conf project
+          if (result == FALSE) {
+            req_config = req_config->next;
+            continue;
+          }
+
+          // If we still don't know anything about the project_name project's configuration
+          if (get_act_config(required_configs, project_name) == NULL) {
+            // Go to the next required config
+            req_config = req_config->next;
+            continue;
+          }
+          
+          // Get the project_name's act_config config_struct (tmp holds it)
+          tmp = all_configs;
+          while (tmp && tmp->project_name != NULL && tmp->project_conf != NULL) {
+            if (strcmp(tmp->project_name, project_name) == 0 && strcmp(tmp->project_conf, act_config) == 0) {
+              break;
+            }
+            tmp = tmp->next;
+          }
+
+          // We know for sure that the project_name project's configuration is
+          // act_config, so we insert all the required configs of project_name 
+          // project's act_config configuration
+          struct string2_list* last_proj_config = tmp->requirements;
+          while (last_proj_config && last_proj_config->str1 != NULL && last_proj_config->str2 != NULL) {
+            result = insert_to_required_config(all_configs, last_proj_config->str1, last_proj_config->str2, required_configs);
+            if (result == FALSE) return result;
+            last_proj_config = last_proj_config->next;
+          }
+          insert_to_tmp_config(tmp_configs, project_name, act_config, is_active);
+          
+          // Analyse referenced project's of project_name project
+          struct string_list* last_child = tmp->children;
+          while (last_child && last_child->str != NULL) {
+            result = analyse_child(all_configs, last_child->str, NULL, required_configs, tmp_configs);
+            if (result == FALSE) return result;
+            last_child = last_child->next;
+          }
+          remove_from_tmp_config(tmp_configs, tmp->project_name, tmp->project_conf);
+        }
+        req_config = req_config->next;
+      }
+      last = last->next;
+    }
+    
+    if (found == FALSE) { // No one said anything about this project's configuration
+      //Get the active configuration of this project
+      last = all_configs;
+      while (last && last->project_name != NULL && last->project_conf != NULL) {
+        if (strcmp(last->project_name, project_name) == 0 && last->is_active) {
+          act_config = last->project_conf;
+          break;
+        }
+        last = last->next;
+      }
+      if (last->processed == TRUE) {
+        // We already processed this project
+        return TRUE;
+      }
+      
+      last->processed = TRUE;
+      // Insert the active configuration to the required_configs
+      result = insert_to_required_config(all_configs, project_name, act_config, required_configs);
+      if (result == FALSE) return result;
+   
+      //Insert the project requirements of the project_name project's active configuration
+      struct string2_list* last_proj_config = last->requirements;
+      while (last_proj_config && last_proj_config->str1 != NULL && last_proj_config->str2 != NULL) {
+        struct config_list* tmp_tmp = tmp_configs;
+        // Detect circle in all_configs, which is started from last_proj_config->str1 and
+        // project_name is an element of the circle
+        struct string_list* list = NULL;
+        boolean circular = is_circular_dep(all_configs, last_proj_config->str1, last_proj_config->str1, project_name, &list);
+        free_string_list(list);
+        // Go through the tmp_configs to check inconsistency
+        while (tmp_tmp && tmp_tmp->str1 != NULL && tmp_tmp->str2 != NULL) {
+          if (strcmp(tmp_tmp->str1, last_proj_config->str1) == 0 && 
+             (strcmp(tmp_tmp->str2, last_proj_config->str2) != 0 &&
+             (!tmp_tmp->is_active || circular))) {
+            // Insert the configuration. This will cause an error later.
+            insert_to_required_config(all_configs, tmp_tmp->str1, tmp_tmp->str2, required_configs);
+            result = FALSE;
+          }
+          tmp_tmp = tmp_tmp->next;
+        }
+        // Important to && the result at the end. If the result is FALSE from the
+        // while cycle above, then it must remain FALSE
+        result = insert_to_required_config(all_configs, last_proj_config->str1, last_proj_config->str2, required_configs) && result;
+        if (result == FALSE) return result;
+        last_proj_config = last_proj_config->next;
+      }
+      insert_to_tmp_config(tmp_configs, project_name, act_config, last->is_active);
+      // Analyse children of the project_name project
+      struct string_list* last_child = last->children;
+      while (last_child && last_child->str != NULL) {
+        result = analyse_child(all_configs, last_child->str, NULL, required_configs, tmp_configs);
+        if (result == FALSE) return result;
+        last_child = last_child->next;
+      }
+      remove_from_tmp_config(tmp_configs, project_name, act_config);
+    }
+  }
+  return result;
+}
+
+static tpd_result config_struct_get_required_configs(struct config_struct* const all_configs, struct string2_list* const required_configs, struct config_list** tmp_configs) {
+  // Init tmp_configs, which will be used to detect circularity
+  *tmp_configs = (struct config_list*)Malloc(sizeof(config_list));
+  (*tmp_configs)->str1 = NULL;
+  (*tmp_configs)->str2 = NULL;
+  (*tmp_configs)->is_active = FALSE;
+  (*tmp_configs)->next = NULL;
+  
+  // Fill up dependencies of the configurations
+  config_struct_fillup_deps(all_configs);
+  struct config_struct* last = all_configs;
+  // The top level project is always the first project and we need the active configuration of the project
+  while (last) {
+    if (last->project_name != NULL && all_configs->project_name != NULL) {
+      if (strcmp(all_configs->project_name, last->project_name) == 0 && last->is_active == TRUE && last->processed == FALSE) {
+        boolean result = TRUE;
+        
+        // Insert the top level project's active configuration to the required configs.
+        result = insert_to_required_config(all_configs, last->project_name, last->project_conf, required_configs);
+        if (result == FALSE) return TPD_FAILED;
+        insert_to_tmp_config(*tmp_configs, last->project_name, last->project_conf, TRUE);
+        
+        // last variable holds the top level project's active configuration which needed to be analysed
+        // Insert every required config of the top level project active configuration
+        struct string2_list* last_proj_config = last->requirements;
+        while (last_proj_config && last_proj_config->str1 != NULL && last_proj_config->str2 != NULL) { // todo ezek a null cuccok mindenhova, every param should not be null
+          struct string_list* children = last->children;
+          // This if allows that a top level project can require an other project's configuration
+          // without referencing it.
+          if (children->str != NULL || strcmp(last_proj_config->str1, last->project_name) == 0) {
+            result = insert_to_required_config(all_configs, last_proj_config->str1, last_proj_config->str2, required_configs);
+            if (result == FALSE) return TPD_FAILED;
+          }
+          last_proj_config = last_proj_config->next;
+        }
+        last->processed = TRUE;
+        
+        //Analyse the referenced project of the top level project
+        struct string_list* last_child = last->children;
+        while (last_child && last_child->str != NULL) {
+          result = analyse_child(all_configs, last_child->str, NULL, required_configs, *tmp_configs); // todo check if everywhere is handled
+          if (result == FALSE) return TPD_FAILED;
+          last_child = last_child->next;
+        }
+        remove_from_tmp_config(*tmp_configs, last->project_name, last->project_conf);
+        break; // No more needed
+      }
+    }
+    last = last->next;
+  }
+  return TPD_SUCCESS;
+}
+
 static tpd_result process_tpd_internal(const char *p_tpd_name, char* tpdName, const char *actcfg,
   const char *file_list_path, int *p_argc, char ***p_argv,
   int *p_optind, char **p_ets_name, char **p_project_name,
@@ -639,7 +1182,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char* tpdName, co
   struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchp, boolean Vflag, boolean Dflag,
   boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, 
   struct string2_list* run_command_list, map<cstring, int>& seen_tpd_files, struct string2_list* required_configs, struct string_list** profiled_file_list,
-  const char **search_paths, size_t n_search_paths);
+  const char **search_paths, size_t n_search_paths, struct config_struct * const all_configs);
 
 extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg,
   const char *file_list_path, int *p_argc, char ***p_argv,
@@ -666,6 +1209,12 @@ extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg,
   projGenHelper.setZflag(*p_Zflag);
   projGenHelper.setWflag(prefix_workdir);
   projGenHelper.setHflag(*p_Hflag);
+
+  struct config_struct* all_configs = (struct config_struct*)Malloc(sizeof(struct config_struct));
+  config_struct_init(all_configs);
+  
+  // The first round only collects the configurations about the tpd-s into the
+  // all_configs variable. It does not do anything else.
   tpd_result success = process_tpd_internal(p_tpd_name, tpdName,
       actcfg, file_list_path, p_argc, p_argv, p_optind, p_ets_name, p_project_name,
       p_gflag, p_sflag, p_cflag, p_aflag, preprocess,
@@ -682,9 +1231,39 @@ extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg,
       linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
       p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, 
       run_command_list, seen_tpd_files, required_configs, profiled_file_list,
-      search_paths, n_search_paths);
-
-  if (TPD_FAILED == success) exit(EXIT_FAILURE);
+      search_paths, n_search_paths, all_configs);
+  
+  if (success == TPD_SUCCESS) {
+    struct config_list* tmp_configs = NULL;
+    config_struct_get_required_configs(all_configs, required_configs, &tmp_configs);
+    free_config_list(tmp_configs);
+    free_config_struct(all_configs);
+    all_configs = NULL;
+    
+    // In the second round every configuration is known for every project in the
+    // optimal case. In the not optimal case errors are produced.
+    // This round does get the information from the tpd to generate the makefile.
+    success = process_tpd_internal(p_tpd_name, tpdName,
+      actcfg, file_list_path, p_argc, p_argv, p_optind, p_ets_name, p_project_name,
+      p_gflag, p_sflag, p_cflag, p_aflag, preprocess,
+      p_Rflag, p_lflag, p_mflag, p_Pflag,
+      p_Lflag, recursive, force_overwrite, gen_only_top_level,
+      output_file, abs_work_dir_p, sub_project_dirs,
+      program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes,
+      ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines,
+      prep_undefines, p_csflag, p_quflag, p_dsflag, cxxcompiler,
+      optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag,
+      p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag,
+      p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_diflag, solspeclibs, sol8speclibs,
+      linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep,
+      linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
+      p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, 
+      run_command_list, seen_tpd_files, required_configs, profiled_file_list,
+      search_paths, n_search_paths, all_configs);
+  }
+  if (TPD_FAILED == success){
+    exit(EXIT_FAILURE);
+  }
 
   if (false == projGenHelper.sanityCheck()) {
     fprintf (stderr, "makefilegen exits\n");
@@ -732,7 +1311,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
   string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag,
   boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
   struct string2_list* run_command_list, map<cstring, int>& seen_tpd_files, struct string2_list* required_configs, struct string_list** profiled_file_list,
-  const char **search_paths, size_t n_search_paths)
+  const char **search_paths, size_t n_search_paths, struct config_struct * const all_configs)
 {
   tpd_result result = TPD_SUCCESS;
   // read-only non-pointer aliases
@@ -740,6 +1319,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
   int const& local_argc = *p_argc;
   int const& local_optind = *p_optind;
   *abs_work_dir_p = NULL;
+  const boolean get_config_mode = all_configs != NULL;
 
   assert(local_optind >= 2 // at least '-ttpd_name' must be in the args
     || local_optind == 0); // if called for a referenced project
@@ -823,7 +1403,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
     return TPD_FAILED;
   }
 
-  if (!Vflag) {
+  if (!Vflag && get_config_mode) {
     // try schema validation if tpd schema file was found
     bool tpd_is_valid = false;
     const char* ttcn3_dir = getenv("TTCN3_DIR");
@@ -856,12 +1436,94 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
   // This is because the keys (not the values) are owned by the XmlDoc.
 
   map<cstring, const char> path_vars;
+  
+  autostring workdir;
+  
+  autostring proj_abs_workdir;
+
+  autostring abs_workdir;
 
   XPathContext xpathCtx(xmlXPathNewContext(doc));
   if (xpathCtx == NULL) {
     fprintf(stderr,"Error: unable to create new XPath context\n");
     return TPD_FAILED;
   }
+  
+    /////////////////////////////////////////////////////////////////////////////
+  {
+    char *projectNameXpath = mprintf("/TITAN_Project_File_Information/ProjectName/text()");
+    XPathObject projectNameObj(run_xpath(xpathCtx, projectNameXpath));
+    Free(projectNameXpath);
+    if (projectNameObj->nodesetval && projectNameObj->nodesetval->nodeNr > 0) {
+      *p_project_name = mcopystr((const char*)projectNameObj->nodesetval->nodeTab[0]->content);
+      projGenHelper.addTarget(*p_project_name);
+      projGenHelper.setToplevelProjectName(*p_project_name);
+      ProjectDescriptor* projDesc = projGenHelper.getTargetOfProject(*p_project_name);
+      if (projDesc) projDesc->setProjectAbsTpdDir((const char*)abs_tpd_dir);
+    }
+  }
+  
+  /////////////////////////////////////////////////////////////////////////////
+  
+  if (!actcfg && !get_config_mode) {
+    actcfg = get_act_config(required_configs, *p_project_name);
+  }
+
+  if (actcfg == NULL) {
+    // Find out the active config
+    XPathObject  activeConfig(run_xpath(xpathCtx,
+      "/TITAN_Project_File_Information/ActiveConfiguration/text()"));
+    if (activeConfig->nodesetval && activeConfig->nodesetval->nodeNr == 1) {
+      // there is one node
+      actcfg = (const char*)activeConfig->nodesetval->nodeTab[0]->content;
+    }
+  }
+  
+  if (actcfg == NULL) {
+    ERROR("Can not find the active build configuration.");
+    for (size_t i = 0; i < folders.size(); ++i) {
+      Free(const_cast<char*>(folders.get_nth_elem(i)));
+    }
+    folders.clear();
+    return TPD_FAILED;
+  }
+
+  { // check if the active configuration exists
+    expstring_t xpathActCfg= mprintf(
+      "/TITAN_Project_File_Information/Configurations/"
+        "Configuration[@name='%s']/text()", actcfg); // todo
+    XPathObject theConfigEx(run_xpath(xpathCtx, xpathActCfg));
+    Free(xpathActCfg);
+
+    xmlNodeSetPtr nodes = theConfigEx->nodesetval;
+    if (nodes == NULL) {
+      ERROR("The active build configuration named '%s' does not exist",
+          actcfg);
+      for (size_t i = 0; i < folders.size(); ++i) {
+        Free(const_cast<char*>(folders.get_nth_elem(i)));
+      }
+      folders.clear();
+      return TPD_FAILED;
+    }
+  }
+
+  if (!get_config_mode) {
+    struct string2_list* last_elem = required_configs;
+    //                        To ensure that the first elem is checked too if last_elem->next is null
+    while (last_elem && last_elem->str1 != NULL && last_elem->str2 != NULL) {
+      if (!strcmp(last_elem->str1, *p_project_name) && strcmp(last_elem->str2, actcfg)) {
+        ERROR("Required configuration is inconsistent : Project '%s' cannot have 2 "
+              "different configuration '%s' and '%s'",
+              last_elem->str1, actcfg, last_elem->str2);
+        for (size_t i = 0; i < folders.size(); ++i) {
+          Free(const_cast<char*>(folders.get_nth_elem(i)));
+        }
+        folders.clear();
+        return TPD_FAILED;
+      }
+      last_elem = last_elem->next;
+    }
+
   // Collect path variables
   {
     XPathObject pathsObj(run_xpath(xpathCtx,
@@ -933,63 +1595,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
     } // next FolderResource
   }
 
-  /////////////////////////////////////////////////////////////////////////////
-  {
-    char *projectNameXpath = mprintf("/TITAN_Project_File_Information/ProjectName/text()");
-    XPathObject projectNameObj(run_xpath(xpathCtx, projectNameXpath));
-    Free(projectNameXpath);
-    if (projectNameObj->nodesetval && projectNameObj->nodesetval->nodeNr > 0) {
-      *p_project_name = mcopystr((const char*)projectNameObj->nodesetval->nodeTab[0]->content);
-      projGenHelper.addTarget(*p_project_name);
-      projGenHelper.setToplevelProjectName(*p_project_name);
-      ProjectDescriptor* projDesc = projGenHelper.getTargetOfProject(*p_project_name);
-      if (projDesc) projDesc->setProjectAbsTpdDir((const char*)abs_tpd_dir);
-    }
-  }
-  /////////////////////////////////////////////////////////////////////////////
-
-  if (!actcfg) {
-    actcfg = get_act_config(required_configs,*p_project_name);
-  }
-  if (actcfg == NULL) {
-    // Find out the active config
-    XPathObject  activeConfig(run_xpath(xpathCtx,
-      "/TITAN_Project_File_Information/ActiveConfiguration/text()"));
-    if (activeConfig->nodesetval && activeConfig->nodesetval->nodeNr == 1) {
-      // there is one node
-      actcfg = (const char*)activeConfig->nodesetval->nodeTab[0]->content;
-    }
-  }
-
-  if (actcfg == NULL) {
-    ERROR("Can not find the active build configuration.");
-    for (size_t i = 0; i < folders.size(); ++i) {
-      Free(const_cast<char*>(folders.get_nth_elem(i)));
-    }
-    folders.clear();
-    return TPD_FAILED;
-  }
-
-  { // check if the active configuration exists
-    expstring_t xpathActCfg= mprintf(
-      "/TITAN_Project_File_Information/Configurations/"
-        "Configuration[@name='%s']/text()", actcfg);
-    XPathObject theConfigEx(run_xpath(xpathCtx, xpathActCfg));
-    Free(xpathActCfg);
-
-    xmlNodeSetPtr nodes = theConfigEx->nodesetval;
-    if (nodes == NULL) {
-      ERROR("The active build configuration named '%s' does not exist",
-          actcfg);
-      for (size_t i = 0; i < folders.size(); ++i) {
-        Free(const_cast<char*>(folders.get_nth_elem(i)));
-      }
-      folders.clear();
-      return TPD_FAILED;
-    }
-  }
   // working directory stuff
-  autostring workdir;
   {
     const char* workdirFromTpd = "bin"; // default value
     char *workdirXpath = mprintf(
@@ -1019,9 +1625,6 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
   const char *real_workdir = folders[workdir]; // This is relative to the location of the tpd file
   excluded_folders.add(real_workdir); // excluded by convention
 
-  autostring proj_abs_workdir;
-
-  autostring abs_workdir;
   // If -D flag was specified then we ignore the workdir
   // in the TPD (the current dir is considered the work dir).
   if (!Dflag) {
@@ -1959,64 +2562,90 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
       }
     }
   }
-
+  } // If get_config_mode
 // collect the required configurations
+  
+  struct config_struct* config_elem = all_configs;
   {
-    if (required_configs) {
-      char* cfgReqsXpath(mprintf(
-        "/TITAN_Project_File_Information/Configurations/Configuration[@name='%s']"
-        "/ProjectProperties/ConfigurationRequirements/configurationRequirement",
-        actcfg));
-      XPathObject reqcfgObjects(run_xpath(xpathCtx, cfgReqsXpath));
-      Free (cfgReqsXpath);
-      xmlNodeSetPtr configs = reqcfgObjects->nodesetval;
-      if (configs) for (int i = 0; i < configs->nodeNr; ++i) {
-        xmlNodePtr curNodePtr = configs->nodeTab[i]->children;
-        const char* projectName = NULL;
-        const char* reqConfig = NULL;
-        while(curNodePtr) {
-          if (!strcmp((const char*)curNodePtr->name, "projectName")) {
-            projectName = (const char*)curNodePtr->children->content;
-          }
-          if (!strcmp((const char*)curNodePtr->name, "rerquiredConfiguration") || // backward compatibility
-              !strcmp((const char*)curNodePtr->name, "requiredConfiguration")) {
-              reqConfig = (const char*)curNodePtr->children->content;
-          }
-          curNodePtr = curNodePtr->next;
-        }
-        struct string2_list* last_elem = required_configs;
-        bool duplicate = false;
-        while (last_elem->next) {
-          if (!strcmp(last_elem->str1, projectName) && !strcmp(last_elem->str2, reqConfig)) {
-            duplicate = true;
-          }
-          else if (!strcmp(last_elem->str1, projectName) && strcmp(last_elem->str2, reqConfig)) {
-            ERROR("Required configuration is inconsistent : Project '%s' cannot have 2 "
-                  "different configuration '%s' '%s'",
-                  last_elem->str1, last_elem->str2, reqConfig);
-            result = TPD_FAILED;
-          }
-          last_elem = last_elem->next;
-        }
-        // add string to last element if empty or create new last element and add it to that
-        if (last_elem->str1 && !duplicate) {
-          if (strcmp(last_elem->str1, projectName) || strcmp(last_elem->str2, reqConfig)) {
-            last_elem->next = (struct string2_list*)Malloc(sizeof(struct string2_list));
-            last_elem = last_elem->next;
-            last_elem->next = NULL;
+    if (required_configs && get_config_mode) {
+
+      char* cfgConfigsXpath(mprintf(
+        "/TITAN_Project_File_Information/Configurations/Configuration"));
+      XPathObject cfgConfigsObjects(run_xpath(xpathCtx, cfgConfigsXpath));
+      Free(cfgConfigsXpath);
+      xmlNodeSetPtr configs = cfgConfigsObjects->nodesetval;
+      if (configs) {
+        // Go through configurations
+        for (int i = 0; i < configs->nodeNr; ++i) {
+          xmlAttrPtr currentNode = configs->nodeTab[i]->properties;
+          const char* configName = NULL;
+          
+          for (xmlAttrPtr attr = currentNode; attr; attr = attr->next) {
+            if (!strcmp((const char*)attr->name, "name")) {
+              configName = (const char*)attr->children->content;
+            }
           }
-          else {
-            duplicate = true;
+          char* cfgReqsXpath(mprintf(
+            "/TITAN_Project_File_Information/Configurations/Configuration[@name='%s']"
+            "/ProjectProperties/ConfigurationRequirements/configurationRequirement"
+            , configName));
+
+          while(config_elem->next != NULL) {
+            config_elem = config_elem->next;
           }
-        }
-        if (!duplicate) {
-          last_elem->str1 = mcopystr(projectName);
-          last_elem->str2 = mcopystr(reqConfig);
-        }
-      }
+          config_elem->project_name = mcopystr(*p_project_name);
+          config_elem->project_conf = mcopystr(configName);
+          config_elem->is_active = strcmp(configName, actcfg) == 0;
+          struct config_struct* next_elem = (struct config_struct*)Malloc(sizeof(struct config_struct));
+          config_struct_init(next_elem);
+          config_elem->next = next_elem;
+
+          XPathObject reqcfgObjects(run_xpath(xpathCtx, cfgReqsXpath));
+          Free (cfgReqsXpath);
+          xmlNodeSetPtr reqConfigs = reqcfgObjects->nodesetval;
+          // Go through the required configurations of configurations
+          if (reqConfigs) for (int j = 0; j < reqConfigs->nodeNr; ++j) {
+            xmlNodePtr curNodePtr = reqConfigs->nodeTab[j]->children;
+            const char* projectName = NULL;
+            const char* reqConfig = NULL;
+            while(curNodePtr) {
+              if (!strcmp((const char*)curNodePtr->name, "projectName")) {
+                projectName = (const char*)curNodePtr->children->content;
+              }
+              if (!strcmp((const char*)curNodePtr->name, "rerquiredConfiguration") || // backward compatibility
+                  !strcmp((const char*)curNodePtr->name, "requiredConfiguration")) {
+                  reqConfig = (const char*)curNodePtr->children->content;
+              }
+              curNodePtr = curNodePtr->next;
+            }
+            
+            // Check if the required configuration is already inserted.
+            struct string2_list* last_req = config_elem->requirements;
+            boolean already_in = FALSE;
+            while (last_req && last_req->str1 != NULL && last_req->str2 != NULL && already_in == FALSE) {
+              if (strcmp(last_req->str1, projectName) == 0 && strcmp(last_req->str2, reqConfig) == 0) {
+                already_in = TRUE;
+                break;
+              }
+              last_req = last_req->next;
+            }
+            // If not, insert into the requirements of the configuration
+            if (already_in == FALSE) {
+              last_req->str1 = mcopystr(projectName);
+              last_req->str2 = mcopystr(reqConfig);
+              struct string2_list* next_req = (struct string2_list*)Malloc(sizeof(struct string2_list));
+              next_req->str1 = NULL;
+              next_req->str2 = NULL;
+              next_req->next = NULL;
+              last_req->next = next_req;
+              last_req = next_req;
+            }
+
+          } // ReqConfigs
+        } // Configs
+      } // If configs
     }
   }
-
   // Referenced projects
   {
     XPathObject subprojects(run_xpath(xpathCtx,
@@ -2077,7 +2706,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
 
         ProjectDescriptor* projDesc = projGenHelper.getTargetOfProject(*p_project_name);
         if (projDesc) projDesc->addToReferencedProjects(name);
-
+         
         const char *my_actcfg = NULL;
         int my_argc = 0;
         char *my_args[] = { NULL };
@@ -2104,6 +2733,33 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
 
         char* sub_proj_abs_work_dir = NULL;
         
+        //Insert children of the project
+        if (get_config_mode && config_elem->project_name != NULL) {
+          struct config_struct* tmp = all_configs;
+          boolean already_in = FALSE;
+          while (tmp && tmp->project_name != NULL && already_in == FALSE) {
+            if (strcmp(tmp->project_name, config_elem->project_name) == 0) {
+              struct string_list* last_child = tmp->children;
+              while(last_child && last_child->str != NULL) {
+                if (strcmp(last_child->str, name) == 0) {
+                  already_in = TRUE;
+                  break;
+                }
+                last_child = last_child->next;
+              }
+              if (already_in == FALSE) {
+                last_child->str = mcopystr(name);
+                struct string_list* next_child = (struct string_list*)Malloc(sizeof(string_list));
+                next_child->str = NULL;
+                next_child->next = NULL;
+                last_child->next = next_child;
+                last_child = next_child;
+              }
+            }
+            tmp = tmp->next;
+          }
+        }
+      
         tpd_result success = process_tpd_internal((const char*)abs_projectLocationURI, tpdName_loc,
           my_actcfg, file_list_path, &my_argc, &my_argv, &my_optind, &my_ets, &my_proj_name,
           &my_gflag, &my_sflag, &my_cflag, &my_aflag, preprocess, &my_Rflag, &my_lflag,
@@ -2116,11 +2772,11 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
           solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs,
           ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, FALSE, &my_Zflag, 
           &my_Hflag, NULL, NULL, prefix_workdir, run_command_list, seen_tpd_files, required_configs, profiled_file_list,
-          search_paths, n_search_paths);
-
+          search_paths, n_search_paths, all_configs);
+        
         autostring sub_proj_abs_work_dir_as(sub_proj_abs_work_dir); // ?!
 
-        if (success == TPD_SUCCESS) {
+        if (success == TPD_SUCCESS && !get_config_mode) {
           my_actcfg = get_act_config(required_configs, my_proj_name);
           if (recursive) { // call ttcn3_makefilegen on referenced project's tpd file
             // -r is not needed any more because top level process traverses all projects recursively
@@ -2332,10 +2988,14 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co
   if (local_argc > 0) { // it is the outermost call
     clear_seen_tpd_files(seen_tpd_files);
   }
-  // replace argv
-  *p_argv = new_argv;
-  *p_argc = new_argc;
-  *p_optind = 0;
+  // replace argv only if not config mode
+  if (!get_config_mode) {
+    *p_argv = new_argv;
+    *p_argc = new_argc;
+    *p_optind = 0;
+  } else {
+    Free(*p_project_name);
+  }
 
   // finally...
   for (size_t i = 0, e = files.size(); i < e; ++i) {
diff --git a/compiler2/xpather.h b/compiler2/xpather.h
index de3f9c91a5e47d6015955781a7abeb2b59376baa..b54b37324fe422d11654cd0e8c79a8780c6759fd 100644
--- a/compiler2/xpather.h
+++ b/compiler2/xpather.h
@@ -39,6 +39,28 @@ char* str2;
 struct string2_list* next;
 };
 
+// This contains a project's configuration and the 
+// data that are important for determining the required configurations.
+struct config_struct {
+char* project_name; // Name of the project
+char* project_conf; // Configuration of the project
+boolean is_active; // True if this configuration is an active configuration
+struct string_list* dependencies; // Projects that references this project
+struct string2_list* requirements; // Configuration requirements (Project, Config)
+struct string_list* children; // Projects that are being referenced by this project
+boolean processed; // True if this project is already processed.
+struct config_struct* next; // Pointer to the next element
+};
+
+// This contains a Project with it's configuration and the 
+// flag to determine if this configuration is the active one.
+struct config_list {
+char* str1; // Project name
+char* str2; // Configuration
+boolean is_active; // Is active configuration?
+struct config_list* next; // Pointer to the next element
+};
+
 #ifdef __cplusplus
 extern "C"
 #endif
@@ -144,6 +166,15 @@ extern "C"
 #endif
 boolean buildObjects(const char* projName, boolean add_referenced);
 
+#ifdef __cplusplus
+extern "C" 
+#endif
+void free_string_list(struct string_list* act_elem);
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+void free_string2_list(struct string2_list* act_elem);
 
 /**
  *
diff --git a/regression_test/compileonly/mfgen-tpd/Makefile b/regression_test/compileonly/mfgen-tpd/Makefile
index 2f084eea913b785b872a896e06ed17da00f7191d..f04e0ff6e39bf8a55753fdbd95c05ade2745207b 100644
--- a/regression_test/compileonly/mfgen-tpd/Makefile
+++ b/regression_test/compileonly/mfgen-tpd/Makefile
@@ -29,7 +29,9 @@ endif
 # then fail on every subsequent invocation until a 'make clean' is done. 
 MAKEPROG := ${MAKE}
 
-DIRLIST := buildconfig_param invalid_buildconfig_param invalid_buildconfig_tpd HP79745 HQ56829 HQ56834 HQ56848 library HR30356 flagTest HR30365 dependency_check
+DIRLIST := buildconfig_param invalid_buildconfig_param invalid_buildconfig_tpd \
+	HP79745 HQ56829 HQ56834 HQ56848 library HR30356 flagTest HR30365 dependency_check \
+	required_config
 
 # The default target.
 ifeq ($(findstring c,$(MFGEN_FLAGS)),) # no -c
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/1/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/1/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..5c8a97fe9c9d9016bb4430db0ac5603a98c1da18
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/1/Makefile
@@ -0,0 +1,45 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that the -b badConfig does not exists and an error is produced
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -b goodConfig  2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binGood" ./binGood/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 1 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf binDefault binGood output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/1/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/1/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..341003728e7ca326d1a7ce52dfd4f768399fc011
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/1/a.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="goodConfig">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binGood</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binGood</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/10/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/10/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..8f853e0a8254b1551c227b6bc8549864520f44d6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/10/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and 'a' requires
+#'b''s '1' configuration and 'c''s '2' configuration.
+#Additionally and 'b''s '1' configuration requires 'c''s '1' config.
+#This tests that two different configuration was required for 'c' and
+#an error is produced.
+#      a
+#     / \
+# b:1/   \c:2
+#   /     \
+#  b------>c
+#   b:1=>c:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'c' cannot have 2 different configuration '2' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 10 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault b_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/10/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/10/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..818e6df69c0c4e57b76cc5811949d3cd7093ef7c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/10/a.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/10/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/10/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..de23eb7e8e296459783063656d2064493e9cf5d0
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/10/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+      </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/10/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/10/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3e54fab0f88ef6ed38e1cf2dca482b968d19d2c8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/10/c.tpd
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/11/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/11/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..37a194fa37a6c9f49d0ba7f2f6e4749afbb6d939
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/11/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and 'a' requires
+#'b''s '1' configuration and 'c''s '2' configuration but 'c''s '2' configuration
+#does not exists.
+#Additionally and 'b''s '1' configuration requires 'c''s '1' config.
+#This tests that two different configuration was required for 'c' but
+#one of them does not exitst so a different error message produced than in test 10.
+#      a
+#     / \
+# b:1/   \c:2 (not exist)
+#   /     \
+#  b------>c
+#   b:1=>c:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: The active build configuration named '2' does not exist" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 11 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault b_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/11/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/11/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..818e6df69c0c4e57b76cc5811949d3cd7093ef7c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/11/a.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/11/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/11/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..de23eb7e8e296459783063656d2064493e9cf5d0
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/11/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+      </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/11/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/11/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2519b72551abdd344e425500ac9e257af1ab90de
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/11/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/12/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/12/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..7858cbf410163375274c6848435d79a42e948edd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/12/Makefile
@@ -0,0 +1,47 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a''s Default configuration requires 'a' with '1' configuration.
+#This behaviour emits an error.
+#      a(a:default=>a:1)
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'a' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 12 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/12/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/12/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ae51e64c03148f4d3928234a4ae6d671e99b476e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/12/a.tpd
@@ -0,0 +1,44 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>a</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/13/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/13/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..f81dfd458d9b0cf5034146648f6c9e6575e09502
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/13/Makefile
@@ -0,0 +1,57 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#    a
+#   / \
+#  b  c
+#  \  / d:1
+#   d
+#Result will be: a:Default, b:Default, c:Default, d:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/13/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/13/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/13/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/13/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/13/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b112856b922ffa9596bcb267114d410e4251b773
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/13/b.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/13/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/13/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..da949771b54c04557f83c40073a319ba5c3f89ea
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/13/c.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/13/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/13/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/13/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/14/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/14/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..b8eda66c2d434571a4d331754c8055fc7aa061a6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/14/Makefile
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         / b:1 \
+#         b <--  c
+# b:1=>d:1\     / d:1
+#          \   /
+#            d
+#Result will be: a:Default, b:1, c:Default, d:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 14 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 14 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 14 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 14 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_binDefault d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/14/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/14/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/14/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/14/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/14/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/14/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/14/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/14/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..434052d5e4e676cda4c133e1c5edf86b2f6da022
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/14/c.tpd
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/14/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/14/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/14/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/15/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/15/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..c127363b5bd1b8e35e12dd33438599eaef26ef5d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/15/Makefile
@@ -0,0 +1,53 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         / b:1 \
+#         b <--  c
+# b:1=>d:2\     / d:1
+#          \   /
+#            d
+#Result will be: Error: 'd' can't have '1' and '2' configuration at the same time.
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'd' cannot have 2 different configuration '1' and '2'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 15 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault b_bin1 c_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/15/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/15/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/15/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/15/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/15/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f1652a2ac1b738094ec820a36e42be3a6aad185a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/15/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/15/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/15/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..434052d5e4e676cda4c133e1c5edf86b2f6da022
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/15/c.tpd
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/15/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/15/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..0a51bfdaf402ee44d67894b73c110ba1eb6339b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/15/d.tpd
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/16/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/16/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..827570cda6e7cbb624bd13170012af994bc46e50
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/16/Makefile
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         / b:1 \
+#         b <--  c
+# b:1=>d:1\
+#          \
+#           d
+#Result will be: a:Default, b:1, c:Default, d:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 16 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 16 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 16 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 16 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_binDefault d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/16/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/16/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/16/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/16/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/16/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/16/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/16/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/16/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5b402657c41679cd3028d88232150e2fd307d94c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/16/c.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/16/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/16/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/16/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/17/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/17/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..134720988de58183b26d85aac1d9c81e9e872179
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/17/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#            |    |
+#            c    |b:1
+#            |    |
+#            d>--->
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 17 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/17/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/17/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/17/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/17/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/17/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/17/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/17/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/17/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/17/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/17/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/17/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..0b56fcd4b4555720706f74d44afe48422b0d79d3
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/17/d.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/18/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/18/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..e4b0847890221abbdb6fe37fa2f8fd386dca1914
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/18/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#         c:1|    |
+#            c    |b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 18 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/18/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/18/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/18/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/18/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/18/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..56de0488f820e832ce268b5f0784b6d4e45b938f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/18/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/18/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/18/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/18/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/18/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/18/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..6e6c91e3ba05b750d7877f4141186cbdca5297dc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/18/d.tpd
@@ -0,0 +1,51 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/19/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/19/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..c8c8ae0f958ad0226b6675f45ea8b8a4289e48c7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/19/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#  b:Def=>c:1|    |
+#            c    |d:1=>b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'c' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 19 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault b_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/19/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/19/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/19/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/19/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/19/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..56de0488f820e832ce268b5f0784b6d4e45b938f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/19/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/19/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/19/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/19/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/19/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/19/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/19/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/2/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/2/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..9fa5a86d2394b1f341a7115aebed935dda14593a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/2/Makefile
@@ -0,0 +1,45 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that the -b badConfig does not exists and an error is produced
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -b badConfig  2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: The active build configuration named 'badConfig' does not exist" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 2 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/2/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/2/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3ecf269362b9580820d7db729cd154a2df4ca8dc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/2/a.tpd
@@ -0,0 +1,28 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/20/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/20/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..5a523bae4d954279d74e7aba04552e664cbc7048
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/20/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#         b:1|
+#            b<---<
+#    b:1=>c:1|    |
+#            c    |d:1=>b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:1, c:1, d:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 20 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 20 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 20 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 20 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1 d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/20/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/20/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..82101ee12254bb20448b571367fdf135d2a91d19
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/20/a.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/20/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/20/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/20/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/20/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/20/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/20/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/20/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/20/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/20/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/21/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/21/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0ebd884eb91936ea36cab807647a6b749cd564a4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/21/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#            |    |
+#            c    |d:1=>b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 21 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 21 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 21 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 21 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/21/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/21/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/21/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/21/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/21/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/21/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/21/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/21/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/21/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/21/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/21/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/21/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/22/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/22/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a2b9ae0c56cf7f80717d37fecebdcc5935452952
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/22/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#         c:1|    |
+#            c    |
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:1, d:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 22 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 22 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 22 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 22 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_bin1 d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/22/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/22/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/22/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/22/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/22/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..56de0488f820e832ce268b5f0784b6d4e45b938f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/22/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/22/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/22/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/22/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/22/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/22/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..35b8333c99c8262fa3534f213e7284d7afdccabd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/22/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/23/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..65335e08191f9276fe68a5a7c2f9c98185219d01
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/Makefile
@@ -0,0 +1,60 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a---->e (b:1)
+#            |
+#            b<---<
+#    b:1=>c:1|    |
+#            c    |
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:1, c:1, d:1, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 23 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 23 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 23 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 23 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 23 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1 d_bin1 e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/23/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d4fa7f1734eedf687c8cc79dc3bffd3b5e0299b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/23/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/23/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/23/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..35b8333c99c8262fa3534f213e7284d7afdccabd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/23/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/23/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aaa5044b02e80f4cad7c175be31fc39452c9f7be
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/23/e.tpd
@@ -0,0 +1,34 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/24/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3fff354e5241bd07d064712baa035011b8965165
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/Makefile
@@ -0,0 +1,60 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e (b:Default)
+#            |    |
+#            b<---<
+#    b:1=>c:1|    |
+#            c    |
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 24 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 24 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 24 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 24 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 24 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/24/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d4fa7f1734eedf687c8cc79dc3bffd3b5e0299b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/24/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/24/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/24/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..35b8333c99c8262fa3534f213e7284d7afdccabd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/24/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/24/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..080542cb1dbf7862dcfd8a1cf9a2a6344b968437
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/24/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>Default</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/25/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..07430e19518e02374c5d2c70a5562db0bd0c31b4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e------<
+#            |    |(b:1) |
+#            b<---<      |
+#    b:1=>c:1|    |      |
+#            c    |      |d:1=>e:1
+#    c:1=>d:1|    |      |
+#            d>--->------>
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 25 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/25/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d4fa7f1734eedf687c8cc79dc3bffd3b5e0299b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/25/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/25/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/25/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5cd5b377ad76aa0ce5cedf8b115544f6bb1460d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/d.tpd
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/25/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/25/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..1dc522d70219fb7c461b201377c7228dd549470e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/25/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/26/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3dbe349944c822c4c376a4a7cec13b2458c2a709
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e------<
+#         b:2|    |(b:1) |
+#            b<---<      |
+#    b:1=>c:1|    |      |
+#            c    |      |d:1=>e:1
+#    c:1=>d:1|    |      |
+#            d>--->------>
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 26 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/26/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d4fa7f1734eedf687c8cc79dc3bffd3b5e0299b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/26/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/26/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/26/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5cd5b377ad76aa0ce5cedf8b115544f6bb1460d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/d.tpd
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/26/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/26/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bb38f6f902fac8febe40bc63830c4d2bf7d424af
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/26/e.tpd
@@ -0,0 +1,51 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/27/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..78f78eb44adc4a662230ef17fe65c095c86b407e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e------<
+#   b:Default|    |(b:1) |
+#            b<---<      |
+#    b:1=>c:1|    |      |
+#            c    |      |
+#    c:1=>d:1|    |      |
+#            d>--->------>
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 27 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/27/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a1587388f1f84e4c2830ff9217be59a50a14ee0c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/a.tpd
@@ -0,0 +1,36 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>Default</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/27/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/27/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/27/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5bea749af66a28a510cf8311dd2cf7c3434089d1
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/d.tpd
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/27/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/27/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..1dc522d70219fb7c461b201377c7228dd549470e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/27/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/28/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0d7be158b73a8eeee8ce139ef954136746757094
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/Makefile
@@ -0,0 +1,60 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e------<
+#            |    |(b:1) |
+#            b<---<      |
+#    b:1=>c:1|    |      |
+#            c    |      |
+#    c:1=>d:1|    |      |
+#            d>--->------>
+#Result will be: a:Default, b:1, c:1, d:1 e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 28 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 28 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 28 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 28 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 28 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1 d_bin1 e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/28/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..e9c6c613a3163a239b688b7cdff7167301bb27ea
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/a.tpd
@@ -0,0 +1,31 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/28/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/28/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/28/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5bea749af66a28a510cf8311dd2cf7c3434089d1
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/d.tpd
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/28/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/28/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bb38f6f902fac8febe40bc63830c4d2bf7d424af
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/28/e.tpd
@@ -0,0 +1,51 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/29/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..d14c071ce1c1f62f99511bbb1ad400c3e73a7860
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/Makefile
@@ -0,0 +1,51 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->
+#            |    |a:1
+#            <---<
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'a' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 29 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output
+
+clean:
+	-rm -rf binDefault binGood output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/29/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ea703ac61f3696f697411d69d2552b91cbe4576d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/a.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="a" projectLocationURI="a.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>a</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/29/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/29/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/29/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5cd5b377ad76aa0ce5cedf8b115544f6bb1460d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/d.tpd
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/29/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/29/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bb38f6f902fac8febe40bc63830c4d2bf7d424af
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/29/e.tpd
@@ -0,0 +1,51 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/3/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/3/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..557f3a6e0be83b63126e8064261d7c2b8e7a555e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/3/Makefile
@@ -0,0 +1,54 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'a''s Default configuration 
+#requires 'b''s '1' config.
+#
+#    a
+#    |
+#    |b:1
+#    |
+#    b
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 3 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 3 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/3/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/3/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..82101ee12254bb20448b571367fdf135d2a91d19
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/3/a.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/3/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/3/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..6e49df75b9796ce85835041f1d6ee5d034573b8f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/3/b.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/30/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..6143ee96f48fc432d6d4ded74097a33110b4c178
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/Makefile
@@ -0,0 +1,48 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a---->
+#            |    |a:1
+#            c<---b
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'a' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 30 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/30/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3e9f6be8f93495a1a882029cf3049048b90a2ff1
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/a.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>a</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/30/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..0220dd9d3c1632467d1fbbf76d2d6ff524b1affe
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/b.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/30/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..e6c329a13a11ef536b499a69cc0a9b532d0e5576
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="a" projectLocationURI="a.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/30/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5cd5b377ad76aa0ce5cedf8b115544f6bb1460d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/d.tpd
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/30/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/30/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bb38f6f902fac8febe40bc63830c4d2bf7d424af
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/30/e.tpd
@@ -0,0 +1,51 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/31/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..8239689f1740e1d165c456938677085f15cd791e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/Makefile
@@ -0,0 +1,53 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e-------->
+#            |    |b:1     |
+#            |    |        |
+#            b<---<---<    |
+#            |    |   |    |f:1
+#            c    |   |b:2 |
+#            |    |   |    |
+#            d>--->   <----f
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration '1' and '2'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 31 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault f_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a0323b463ef9ecf5d83b2aefd57ec5c8ed19637e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..12207521ffbcf1e361a52eac2c60371ac23a6cb8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/b.tpd
@@ -0,0 +1,49 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7e050111850057803f80d53458342aef577bb470
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/d.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ba59b0bc843f21d834a274fc6feb9a46e63cde69
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/e.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/31/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/31/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7703f595f51561a5d470a8c80c39aecd0a538255
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/31/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/32/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..1c5f058df719b4b9300a823fb3fc23e1ef6fc770
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/Makefile
@@ -0,0 +1,64 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e-------->
+#            |    |        |
+#            |    |        |
+#            b<---|---<    |
+#            |    |   |    |f:1
+#            c    |   |b:1 |
+#            |    |   |    |
+#            d>--->   <----f
+# d refers both b and e
+#Result will be: a:Default, b:1, c:Default, d:Default, e:Default, f:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./f_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 32 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_binDefault d_binDefault e_binDefault f_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a0323b463ef9ecf5d83b2aefd57ec5c8ed19637e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..12207521ffbcf1e361a52eac2c60371ac23a6cb8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/b.tpd
@@ -0,0 +1,49 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7e050111850057803f80d53458342aef577bb470
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/d.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..8a82700607af80b295064e1052beab679ed85627
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/32/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/32/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d6f9140c260aef5fabc5fdff32006eaa52e49086
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/32/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/33/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3d1351a052b4dafba97c486c8c0948874c1feb12
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e-------->
+#            |    |        |
+#            |    |        |
+#            b<---<---<    |
+#            |    |   |    |f:1
+#            c    |   |b:2 |
+#            |    |   |    |
+#            d>--->   <----f
+#              b:1
+#
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration '2' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 33 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault f_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a0323b463ef9ecf5d83b2aefd57ec5c8ed19637e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..12207521ffbcf1e361a52eac2c60371ac23a6cb8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/b.tpd
@@ -0,0 +1,49 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..fd47b1ae993a3b7975a2e00996d3b16fb66c9dcc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/d.tpd
@@ -0,0 +1,36 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..8a82700607af80b295064e1052beab679ed85627
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/33/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/33/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7703f595f51561a5d470a8c80c39aecd0a538255
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/33/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/34/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..6180210b122029b72fbf190a2933251bb0fbc231
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e-------->
+#            |    |        |
+#            |    |        |
+#            b<---<---<    |
+#    b:2=>d:1|    |   |    |f:1
+#            c    |   |b:2 |
+#            |    |   |    |
+#            d>--->   <----f
+#           d:1=>b:1
+#
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration '2' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 34 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault f_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a0323b463ef9ecf5d83b2aefd57ec5c8ed19637e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7aa001986f264ec8a735624ff3923aa513e338a4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/b.tpd
@@ -0,0 +1,55 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+   <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b3f629148d584903d7e5e136c14b3286acb6f275
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/d.tpd
@@ -0,0 +1,46 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..8a82700607af80b295064e1052beab679ed85627
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/34/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/34/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7703f595f51561a5d470a8c80c39aecd0a538255
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/34/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/35/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..fed5fab4cc1ba1609fae192cba7d2fa5c150954a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a--->e-------->
+#            |    |        |
+#            |    |        |
+#            b<---<---<    |
+#            |    |   |    |f:1
+#            c    |   |    |
+#            |    |   |    |
+#            d>--->   <----f
+#              b:1
+#
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'b' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 35 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault e_binDefault f_bin1 
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a0323b463ef9ecf5d83b2aefd57ec5c8ed19637e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..fd47b1ae993a3b7975a2e00996d3b16fb66c9dcc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/d.tpd
@@ -0,0 +1,36 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..8a82700607af80b295064e1052beab679ed85627
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/35/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/35/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a3eecb08b5cb669329f784f4a124d827764cc698
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/35/f.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/36/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/36/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..dff1509a0f246fa6c4a98e7c30f2eb8c624feccb
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/36/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#            |    |
+#            c    |d:1=>b:1
+#            |    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 36 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 36 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 36 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 36 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/36/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/36/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/36/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/36/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/36/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/36/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/36/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/36/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..e7a27084a79dc33682227a8403dd904ede25abd8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/36/c.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/36/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/36/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/36/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/37/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/37/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..fc0848f1b32596167371a8ae700e19282c64e434
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/37/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#            |    |
+#            c    |d:1=>b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 37 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 37 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 37 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 37 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/37/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/37/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/37/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/37/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/37/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/37/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/37/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/37/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/37/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/37/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/37/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/37/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/38/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/38/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3c9a00c54f6c4bfa99c7d5f23c7364ed5bae401f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/38/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#    b:1=>c:1|    |
+#            c    |d:1=>b:1
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 38 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 38 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 38 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 38 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/38/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/38/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/38/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/38/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/38/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/38/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/38/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/38/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/38/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/38/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/38/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ee68620411e509ad919ca423a4fc076433f7fc98
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/38/d.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/39/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/39/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..d14eceea736a89813fba922bcbe2742357fa84e4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/39/Makefile
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         / b:1 \
+#         b <--  c
+# b:1=>d:1\
+#          \
+#           d
+#Result will be: a:Default, b:1, c:Default, d:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 39 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 39 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 39 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 39 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_binDefault d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/39/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/39/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/39/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/39/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/39/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/39/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/39/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/39/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352e50fc11f37b4c5c67e872b0e94f934ee76545
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/39/c.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/39/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/39/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/39/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/4/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/4/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..d7695f6041c2b75904477e8d5bc87324400b7b38
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/4/Makefile
@@ -0,0 +1,52 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'a''s Default configuration 
+#requires 'b''s '2' config. But that config does not exists
+#so an error produced.
+#    a
+#    |
+#    |b:2
+#    |
+#    b
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g  2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: The active build configuration named '2' does not exist" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 4 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/4/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/4/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f68c8336ea10a66f99257f487a9dfeeb037d5245
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/4/a.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/4/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/4/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..6e49df75b9796ce85835041f1d6ee5d034573b8f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/4/b.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/40/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/40/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3fd53aa8e04aa3ffd1819cfdab927454ad6bb753
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/40/Makefile
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         /     \
+#         b      c (b:1)
+# b:1=>d:1\
+#          \
+#           d
+#Result will be: a:Default, b:1, c:Default, d:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 40 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 40 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 40 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 40 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_binDefault d_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/40/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/40/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/40/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/40/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/40/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/40/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/40/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/40/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..67695d80d658d24806340d34f7c8f5b908988bd8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/40/c.tpd
@@ -0,0 +1,34 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/40/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/40/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/40/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/41/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/41/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0d874a8988c4281ef0e995b9e577d560fdc61c9f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/41/Makefile
@@ -0,0 +1,59 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         /     \
+#         b      c
+# b:1=>d:1\
+#          \
+#           d
+#Result will be: a:Default, b:Default, c:Default, d:Default
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 41 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 41 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 41 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 41 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/41/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/41/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/41/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/41/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/41/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/41/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/41/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/41/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..9771890c5145c39bc544343a006ca2129f6c6ade
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/41/c.tpd
@@ -0,0 +1,28 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/41/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/41/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ce2f82ab4db8bc17d7de8aa32c200bf1259f8742
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/41/d.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/42/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..f6fd15c257c2838fa8492ec7ba293f4fc438cd02
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/Makefile
@@ -0,0 +1,60 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a---->e (b:1)
+#            |
+#            b<---<
+#    b:1=>c:1|    |
+#            c    |
+#    c:1=>d:1|    |
+#            d>--->
+#Result will be: a:Default, b:1, c:1, d:1, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 42 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 42 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 42 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./d_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 42 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 42 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1 d_bin1 e_binDefault output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/42/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..d4fa7f1734eedf687c8cc79dc3bffd3b5e0299b6
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/42/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/42/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..398d1978177e607b0dda94b11af5169e2ea8a19b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/c.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/42/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..35b8333c99c8262fa3534f213e7284d7afdccabd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/42/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/42/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aaa5044b02e80f4cad7c175be31fc39452c9f7be
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/42/e.tpd
@@ -0,0 +1,34 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/43/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..3fdf3a317408354146c6721ab79fbce4afaca82f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/Makefile
@@ -0,0 +1,70 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         /     \
+#         b      c
+# b:1=>d:1\      |e:1
+#          \     |  e:1=>f:1   f:1=>g:1
+#           d--->e----------->f--------->g
+#                |
+#                |e:1=>h:1
+#                h
+#Result will be: a:Default, b:Default, c:Default, d:Default, e:1, f:1, g:1, h:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./e_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./f_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./g_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./h_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 43 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault e_bin1 f_bin1 g_bin1 h_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..f5a4664842055d913894ffd4fbdb488d98deffff
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..c38ac36aca0d98378f585bc02210bb94c5523de7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/c.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..33e67adc2704b94245606fe3e340120711bd7ab1
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ff90c24f63c91bdb33f1a0ab7d351bfaff953543
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/e.tpd
@@ -0,0 +1,50 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+    <ReferencedProject name="h" projectLocationURI="h.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>h</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7cbf7d75e372b3674acdbb01a71a0f68bbbeaadd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="g" projectLocationURI="g.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>g</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/g.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/g.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..494d7b43aade46a9a74b27a88e20552d481a7508
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/g.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>g</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/43/h.tpd b/regression_test/compileonly/mfgen-tpd/required_config/43/h.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b826ed82e841b39f0918c05fe08502ac449e39d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/43/h.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>h</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/44/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..cf2adff51d0fa61aff260688d6816f8d4fa33185
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#          /   \
+#         /     \h:Default
+#         b      c
+# b:1=>d:1\      |e:1
+#          \     |  e:1=>f:1   f:1=>g:1
+#           d--->e----------->f--------->g
+#                |
+#                |e:1=>h:1
+#                h
+#Result will be: a:Default, b:Default, c:Default, d:Default, e:1, f:1, g:1, h:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'h' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 44 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf output a_binDefault b_binDefault c_binDefault d_binDefault e_bin1 f_bin1 g_bin1 h_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..95ee41d589646b0e8885462ab6c958694a093b73
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/a.tpd
@@ -0,0 +1,36 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>h</projectName>
+            <rerquiredConfiguration>Default</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b842d903654161583dec54dd99fe67299de9af8e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>d</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..c38ac36aca0d98378f585bc02210bb94c5523de7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/c.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..33e67adc2704b94245606fe3e340120711bd7ab1
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/d.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..ff90c24f63c91bdb33f1a0ab7d351bfaff953543
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/e.tpd
@@ -0,0 +1,50 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="f" projectLocationURI="f.tpd"/>
+    <ReferencedProject name="h" projectLocationURI="h.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>f</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>h</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/f.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/f.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..7cbf7d75e372b3674acdbb01a71a0f68bbbeaadd
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/f.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>f</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="g" projectLocationURI="g.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>g</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/g.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/g.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..494d7b43aade46a9a74b27a88e20552d481a7508
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/g.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>g</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/44/h.tpd b/regression_test/compileonly/mfgen-tpd/required_config/44/h.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..b826ed82e841b39f0918c05fe08502ac449e39d9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/44/h.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>h</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/45/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/45/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..09fd2ea08c65471cb5c956d90f87b08db6924ca8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/45/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a
+#            |
+#            b<---<
+#            |    |
+#            c    |
+#            |    |
+#            d>--->
+#Result will be: a:Default, b:Default, c:Default, d:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 13 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/45/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/45/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/45/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/45/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/45/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..cb40d177ea7612fb9331a53b168be01bfb2beb0a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/45/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/45/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/45/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..555023e279321bf341d694a0d12d9827e1489e3d
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/45/c.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/45/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/45/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..93fac9127d821c9ec6354c189908627a05bead30
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/45/d.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/46/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..0b34b6c17e5a9ef06962239c5e608dfd6c8e44ba
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#         c:1|     |
+#            c<----e
+#                
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 46 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 46 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 46 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 46 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 46 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_bin1 d_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/46/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/46/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..025aa6a0065a371c5bea80311ca4117c162ff31e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/b.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/46/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..db3ba8b53dcb7fbc34f64293bc979bd3cf6e047c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+<Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/46/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bd430f1f550ff7cf70005fb35ae12838f65316b4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/d.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/46/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/46/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..fc0866513c4564049309eb983d7656a9c94dc00f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/46/e.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>     
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/47/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..ae5284bbbd0e3be667b6decff1997fb51cb7d0ed
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#    b:1=>c:1|     |
+#            c<----e
+#                
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 47 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 47 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 47 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 47 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 47 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/47/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/47/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/47/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..db3ba8b53dcb7fbc34f64293bc979bd3cf6e047c
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+<Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/47/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bd430f1f550ff7cf70005fb35ae12838f65316b4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/d.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/47/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/47/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..05a201d1713197045d35c2636798ee224b9ec2ea
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/47/e.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/48/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..dd54e45998ddc28ad54e570344b31667e9f200da
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#    b:1=>c:1|     |
+#            c<----e
+#              c:1  
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 48 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 48 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 48 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 48 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 48 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_bin1 d_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/48/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/48/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/48/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2519b72551abdd344e425500ac9e257af1ab90de
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/48/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bd430f1f550ff7cf70005fb35ae12838f65316b4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/d.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/48/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/48/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a02e62f7054e5b7510dcbefe9d2d7c358a26861
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/48/e.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/49/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..6871d27d5bc543c08158fc54b6f2988328be6271
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#    b:1=>c:1|     |
+#            c<----e
+#              e:1=>c:1  
+
+
+#Result will be: a:Default, b:Default, c:Default, d:Default, e:Default
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 49 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 49 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 49 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 49 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./e_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 49 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault e_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/49/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/49/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/49/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2519b72551abdd344e425500ac9e257af1ab90de
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/49/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..bd430f1f550ff7cf70005fb35ae12838f65316b4
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/d.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/49/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/49/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352b8d4d270f6a6d5f1125bb57261ac46c0ad428
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/49/e.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/5/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/5/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..d978b26a18810e09cb91867421ffb91538719d0b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/5/Makefile
@@ -0,0 +1,53 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'a''s NotDefault configuration 
+#requires 'b''s '1' config.
+#    a
+#    |
+#    |a:NotDefault=>b:1
+#    |
+#    b
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -b NotDefault -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binNotDefault" ./a_binNotDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 5 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 5 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binNotDefault b_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/5/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/5/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..5a11e00517dd07166c05d91a915a1720221622ac
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/5/a.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="NotDefault">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binNotDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binNotDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/5/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/5/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..6e49df75b9796ce85835041f1d6ee5d034573b8f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/5/b.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/50/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..9807ed8f66bd4089ba4ba1eaaf56d70e8283b66b
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#    b:1=>c:1|     |e:1
+#            c<----e
+#              e:1=>c:1  
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 50 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 50 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 50 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 50 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./e_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 50 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_bin1 d_binDefault e_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/50/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/50/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3cc20cf9f0b5029dd85a75f55b7957c5af9a2161
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/50/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2519b72551abdd344e425500ac9e257af1ab90de
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/50/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aed3744b9123aed66217331a8c1aa2c24402b281
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/d.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/50/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/50/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352b8d4d270f6a6d5f1125bb57261ac46c0ad428
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/50/e.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/51/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..ea8e67049c9351db69551b3d35456f3f9b13e42f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/Makefile
@@ -0,0 +1,53 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#         c:2|     |e:1
+#            c<----e
+#              e:1=>c:1  
+
+
+#Result will be: Error
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c "error: Required configuration is inconsistent : Project 'c' cannot have 2 different configuration '2' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 51 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault d_binDefault e_bin1 output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/51/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/51/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..80570a388e1f44e0eede904f4e89ed7ca35ba98e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/b.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/51/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3e54fab0f88ef6ed38e1cf2dca482b968d19d2c8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/c.tpd
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/51/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aed3744b9123aed66217331a8c1aa2c24402b281
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/d.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/51/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/51/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352b8d4d270f6a6d5f1125bb57261ac46c0ad428
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/51/e.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/52/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..784df14170faa9063499212e288b3078c7c1bff7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/Makefile
@@ -0,0 +1,61 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d
+#    b:1=>c:2|     |e:1
+#            c<----e
+#              e:1=>c:1  
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 52 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 52 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 52 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./d_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 52 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./e_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 52 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_bin1 d_binDefault e_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/52/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/52/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..49295640b07cfbfe8ce29956f437548f38e964c7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/52/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..3e54fab0f88ef6ed38e1cf2dca482b968d19d2c8
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/c.tpd
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/52/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aed3744b9123aed66217331a8c1aa2c24402b281
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/d.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/52/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/52/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352b8d4d270f6a6d5f1125bb57261ac46c0ad428
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/52/e.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/53/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a827d3f4553b672a81c381899da11c1a8c8ff87a
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+# Hierarchy
+#            a----->
+#            |     |
+#            b     d<-----<
+#    b:1=>c:2|     |e:1   |
+#            c<----e      |
+#            |  e:1=>c:1  |
+#            |            |
+#            >------------>
+#
+
+
+#Result will be: a:Default, b:Default, c:1, d:Default, e:1
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g 2>&1 | tee output
+
+CheckTpd: BuildTpd
+	if [ `grep -c " error: Required configuration is inconsistent : Project 'e' cannot have 2 different configuration 'Default' and '1'" ./output` -ne 1 ]; \
+	then echo "Makefilegen required config test 53 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault d_binDefault output
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/53/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..989215938696eb163de0ba819a61e960d39047c9
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/a.tpd
@@ -0,0 +1,30 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/53/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..49295640b07cfbfe8ce29956f437548f38e964c7
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>2</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/53/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..e445cb0c79a9173698f85b97d8390d8509bc8fba
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/c.tpd
@@ -0,0 +1,49 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="d" projectLocationURI="d.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="2">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin2</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin2</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/d.tpd b/regression_test/compileonly/mfgen-tpd/required_config/53/d.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..aed3744b9123aed66217331a8c1aa2c24402b281
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/d.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>d</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="e" projectLocationURI="e.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>e</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/53/e.tpd b/regression_test/compileonly/mfgen-tpd/required_config/53/e.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..352b8d4d270f6a6d5f1125bb57261ac46c0ad428
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/53/e.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>e</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings> 
+      </ProjectProperties>
+    </Configuration>
+    <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings> 
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/6/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/6/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..eb3c223b06902109f4f7aab826973811961e5d00
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/6/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and every project
+#has the Default configuration. Nobody requires anything from anyone.
+#      a
+#     / \
+#    /   \
+#   /     \
+#  b       c
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 6 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./b_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 6 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = binDefault" ./c_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 6 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_binDefault c_binDefault
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/6/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/6/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..2a425dd93ab8b0dde5e2df387bb154afd98177cc
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/6/a.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/6/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/6/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..0220dd9d3c1632467d1fbbf76d2d6ff524b1affe
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/6/b.tpd
@@ -0,0 +1,29 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/6/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/6/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..9771890c5145c39bc544343a006ca2129f6c6ade
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/6/c.tpd
@@ -0,0 +1,28 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/7/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/7/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..81bc55f38a78c2a34bcc301fb2865ead39e914af
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/7/Makefile
@@ -0,0 +1,55 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and 'a' requires
+#'b''s '1' configuration and 'c''s '1' configuration.
+#      a
+#     / \
+# b:1/   \c:1
+#   /     \
+#  b       c
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 7 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 7 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 7 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/7/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/7/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..1ece244d40ea158e59b80cd2757016b61e1f857f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/7/a.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/7/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/7/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..a83de5f7ee1e523b749aebabf6a43ec3a24a26cb
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/7/b.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/7/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/7/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..00ce28721869b56a32f4f22b15f69072cc2eeaed
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/7/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/8/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/8/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..ebc63a5843b84718d296d67c5a3febf5e779a22e
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/8/Makefile
@@ -0,0 +1,56 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and 'a' requires
+#'b''s '1' configuration and 'b''s '1' configuration requires 'c''s '1' config.
+#      a
+#     / \
+# b:1/   \
+#   /     \
+#  b------>c
+#   b:1=>c:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 8 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 8 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 8 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/8/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/8/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..82101ee12254bb20448b571367fdf135d2a91d19
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/8/a.tpd
@@ -0,0 +1,35 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/8/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/8/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..de23eb7e8e296459783063656d2064493e9cf5d0
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/8/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+      </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/8/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/8/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..00ce28721869b56a32f4f22b15f69072cc2eeaed
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/8/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/9/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/9/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a07abf6dfe050f75517831add3636e3e45296286
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/9/Makefile
@@ -0,0 +1,58 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos
+#
+##############################################################################
+TOPDIR := ../../../..
+include $(TOPDIR)/Makefile.regression
+
+ifdef LCOV
+COVERAGE_FLAG := -C
+endif
+
+# ${MAKEPROG} has the same content as the built-in ${MAKE},
+# except the special handling of ${MAKE} does not apply.
+# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
+# then fail on every subsequent invocation until a 'make clean' is done. 
+
+#This tests that 'a' references 'b' and 'b' references 'c' and 'a' requires
+#'b''s '1' configuration and 'c''s '1' configuration.
+#Additionally and 'b''s '1' configuration requires 'c''s '1' config.
+#This tests that two same required configuration does not conflict.
+#      a
+#     / \
+# b:1/   \c:1
+#   /     \
+#  b------>c
+#   b:1=>c:1
+
+MAKEPROG := ${MAKE}
+
+all: CheckTpd 
+
+BuildTpd:
+	$(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
+	-t a.tpd -r -c -W -g
+
+CheckTpd: BuildTpd
+	if [ `grep -c "EXECUTABLE = binDefault" ./a_binDefault/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 9 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./b_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 9 failed: Overall verdict: fail" && exit 1; fi
+	if [ `grep -c "EXECUTABLE = bin1" ./c_bin1/Makefile` -ne 1 ]; \
+	then echo "Makefilegen required config test 9 failed: Overall verdict: fail" && exit 1; fi
+
+clean:
+	-rm -rf a_binDefault b_bin1 c_bin1
+
+distclean: clean
+	-rm -f *.out
+
+.PHONY: all clean distclean BuildTpd CheckTpd
+
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/9/a.tpd b/regression_test/compileonly/mfgen-tpd/required_config/9/a.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..1ece244d40ea158e59b80cd2757016b61e1f857f
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/9/a.tpd
@@ -0,0 +1,39 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>a</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="b" projectLocationURI="b.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>b</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+        </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/9/b.tpd b/regression_test/compileonly/mfgen-tpd/required_config/9/b.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..de23eb7e8e296459783063656d2064493e9cf5d0
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/9/b.tpd
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>b</ProjectName>
+  <ReferencedProjects>
+    <ReferencedProject name="c" projectLocationURI="c.tpd"/>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+        <ConfigurationRequirements>
+          <configurationRequirement>
+            <projectName>c</projectName>
+            <rerquiredConfiguration>1</rerquiredConfiguration>
+          </configurationRequirement>
+      </ConfigurationRequirements>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/9/c.tpd b/regression_test/compileonly/mfgen-tpd/required_config/9/c.tpd
new file mode 100644
index 0000000000000000000000000000000000000000..00ce28721869b56a32f4f22b15f69072cc2eeaed
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/9/c.tpd
@@ -0,0 +1,38 @@
+<!--
+ Copyright (c) 2000-2016 Ericsson Telecom AB
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+  Szabo, Bence Janos – initial implementation
+-->
+<TITAN_Project_File_Information version="1.0">
+  <ProjectName>c</ProjectName>
+  <ReferencedProjects>
+  </ReferencedProjects>
+  <ActiveConfiguration>Default</ActiveConfiguration>
+  <Configurations>
+    <Configuration name="Default">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>binDefault</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>binDefault</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  <Configuration name="1">
+      <ProjectProperties>
+        <MakefileSettings>
+          <targetExecutable>bin1</targetExecutable>
+        </MakefileSettings>
+        <LocalBuildSettings>
+          <workingDirectory>bin1</workingDirectory>
+        </LocalBuildSettings>
+      </ProjectProperties>
+    </Configuration>
+  </Configurations>
+</TITAN_Project_File_Information>
diff --git a/regression_test/compileonly/mfgen-tpd/required_config/Makefile b/regression_test/compileonly/mfgen-tpd/required_config/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..07fa8e7e08848f26f65fc6da01d211c062c36681
--- /dev/null
+++ b/regression_test/compileonly/mfgen-tpd/required_config/Makefile
@@ -0,0 +1,30 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#   Szabo, Bence Janos – initial implementation
+#
+##############################################################################
+TOPDIR := ../../..
+include $(TOPDIR)/Makefile.regression
+
+CODIRS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 \
+	  26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 \
+	  48 49 50 51 52 53
+
+
+#The configurations of the TPD files only differ in the name of the working
+#directory and the target executable field. This two field is enough to
+#determine that the correct configuration is used.
+#If a makefilegen command finishes without error, then we check the 
+#makefiles in the project's working directory if it has the correct EXECUTABLE
+#value.
+#If a makefilegen command finishes with error, then we check it's output for
+#the error message and we match it with an expected error message.
+
+all dep clean distclean:
+	for dir in $(CODIRS); do $(MAKE) -C $$dir $@ || exit; done