Skip to content

xsd2ttcn is hardcoded in makefile generator

Summary

The xsd2ttcn utility supports "-N" option (generate separate modules for each XSD with no target namespace). This behavior is expected by ETSI TTCN-3 tests. However, currently "xsd2ttcn" is hardcoded when generating Makefile.

It would be nice to have capability to specify some option to "makefilegen" utility and TPD to generate Makefile using "xsd2ttcn" with "-N" option.

Possible fixes

This is not a real fix. The patch just shows which places should be modified. Real fix should put "-N" option accordingly to "makefilegen" switch and some TPD option.

diff --git a/compiler2/makefile.c b/compiler2/makefile.c
index d41cb52d2..817c25323 100644
--- a/compiler2/makefile.c
+++ b/compiler2/makefile.c
@@ -4238,7 +4238,7 @@ static void print_makefile(struct makefile_struct *makefile)
 // XSD conversion:
     if (makefile->nXSDModules) {
       fputs("$(XSD2TTCN_GENERATED_MODULES): $(XSD_MODULES)\n"
-            "\t$(TTCN3_DIR)/bin/xsd2ttcn", fp);
+            "\t$(TTCN3_DIR)/bin/xsd2ttcn -N", fp);
       if (!has_xsd_module && has_base_xsd_module) {
         fputs(" -m", fp);
       }else {
diff --git a/compiler2/xpather.cc b/compiler2/xpather.cc
index e772d1a54..66b4b6249 100644
--- a/compiler2/xpather.cc
+++ b/compiler2/xpather.cc
@@ -654,7 +654,7 @@ int is_xsd_module(const char *file_name, char **module_name) {
   char line[1024];
   char *command = NULL;
   char *ttcn3_dir = getenv("TTCN3_DIR");
-  command = mputprintf(command, "%s%sxsd2ttcn -q -n %s",
+  command = mputprintf(command, "%s%sxsd2ttcn -N -q -n %s",
     ttcn3_dir != NULL ? ttcn3_dir : "",
     ttcn3_dir != NULL ? "/bin/" : "",
     file_name);