Use LTTngUSTLogger logger plugin in logtest regression test
[deliverable/titan.core.git] / compiler2 / makefile.c
index 40f5b6894352ecdd33231408bb2c8cb56d555cc9..629c5ec70c87b90c33b10b34d0bc5427db066408 100644 (file)
@@ -262,6 +262,7 @@ struct makefile_struct {
   boolean outparamboundness;
   boolean omit_in_value_list;
   boolean warnings_for_bad_variants;
+  boolean activate_debugger;
   boolean disable_predef_ext_folder;
   struct string_list* solspeclibraries; /* not owned */
   struct string_list* sol8speclibraries; /* not owned */
@@ -327,6 +328,7 @@ static void init_makefile_struct(struct makefile_struct *makefile)
   makefile->outparamboundness = FALSE;
   makefile->omit_in_value_list = FALSE;
   makefile->warnings_for_bad_variants = FALSE;
+  makefile->activate_debugger = FALSE;
   makefile->solspeclibraries = NULL;
   makefile->sol8speclibraries = NULL;
   makefile->linuxspeclibraries = NULL;
@@ -1673,14 +1675,21 @@ static void print_shared_object_name(FILE *fp, const struct user_struct *user)
 }
 /** Prints the splitted files' names for a given module. */
 static void print_splitted_file_names(FILE *fp,
-  const struct makefile_struct *makefile, const struct module_struct *module)
+  const struct makefile_struct *makefile, const struct module_struct *module, const boolean dir)
 {
+  int n_slices;
   if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
-    print_generated_file_name(fp, module, FALSE, "_seq.cc");
-    print_generated_file_name(fp, module, FALSE, "_set.cc");
-    print_generated_file_name(fp, module, FALSE, "_seqof.cc");
-    print_generated_file_name(fp, module, FALSE, "_setof.cc");
-    print_generated_file_name(fp, module, FALSE, "_union.cc");
+    print_generated_file_name(fp, module, dir, "_seq.cc");
+    print_generated_file_name(fp, module, dir, "_set.cc");
+    print_generated_file_name(fp, module, dir, "_seqof.cc");
+    print_generated_file_name(fp, module, dir, "_setof.cc");
+    print_generated_file_name(fp, module, dir, "_union.cc");
+  } else if(makefile->code_splitting_mode != NULL && (n_slices = atoi(makefile->code_splitting_mode + 2))) {
+    for (int i = 1; i < n_slices; i++) {
+      char buffer[16]; // 6 digits + 4 chars + _part
+      sprintf(buffer, "_part_%i.cc", i);
+      print_generated_file_name(fp, module, dir, buffer);
+    }
   }
 }
 
@@ -1874,10 +1883,19 @@ static void print_makefile(struct makefile_struct *makefile)
       , titan_dir ? titan_dir : "");
     if (titan_dir) Free(titan_dir);
 
+    boolean cxx_free = FALSE;
     if (makefile->cxxcompiler) {
       cxx = makefile->cxxcompiler;
     } else {
+#ifdef __clang__
+      unsigned int
+        compiler_major = __clang_major__,
+        compiler_minor = __clang_minor__;
+      cxx = mprintf("clang++-%u.%u", compiler_major, compiler_minor);
+      cxx_free = TRUE;
+#else
       cxx = "g++";
+#endif
     }
 
     fprintf(fp, "\n# Your platform: (SOLARIS, SOLARIS8, LINUX, FREEBSD or "
@@ -1944,6 +1962,11 @@ static void print_makefile(struct makefile_struct *makefile)
         "CXXDEPFLAGS = -%s\n\n", strstr(cxx, "g++") ? "MM" : "xM1");
     }
 
+    if (cxx_free) {
+      Free((char*)cxx);
+      cxx = NULL;
+    }
+    
     if (makefile->preprocess || makefile->ttcn3_prep_includes ||  makefile->ttcn3_prep_defines) {
       fputs("# Flags for preprocessing TTCN-3 files:\n"
             "CPPFLAGS_TTCN3 =", fp);
@@ -2002,7 +2025,7 @@ static void print_makefile(struct makefile_struct *makefile)
           "AR = ar\n"
           "ARFLAGS = \n\n"
           "# Flags for the TTCN-3 and ASN.1 compiler:\n"
-          "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
+          "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
           "# Execution mode: (either ttcn3 or ttcn3-parallel)\n"
           "TTCN3_LIB = ttcn3%s%s%s\n\n"
 #ifdef LICENSE
@@ -2040,6 +2063,7 @@ static void print_makefile(struct makefile_struct *makefile)
           (makefile->outparamboundness ? " -Y" : ""),
           (makefile->omit_in_value_list ? " -M" : ""),
           (makefile->warnings_for_bad_variants ? " -E" : ""),
+          (makefile->activate_debugger ? " -n" : ""),
           (makefile->tcov_file_name ? makefile->tcov_file_name : ""),
           (makefile->profiled_file_list ? " -z $(PROFILED_FILE_LIST)" : ""),
           /* end of COMPILER FLAGS */
@@ -2250,7 +2274,7 @@ static void print_makefile(struct makefile_struct *makefile)
         for (i = 0; i < makefile->nTTCN3Modules; i++) {
           const struct module_struct *module = makefile->TTCN3Modules + i;
           if (module->dir_name == NULL || !makefile->central_storage)
-            print_splitted_file_names(fp, makefile, module);
+            print_splitted_file_names(fp, makefile, module, FALSE);
         }
       }
       if (makefile->preprocess) {
@@ -2259,7 +2283,7 @@ static void print_makefile(struct makefile_struct *makefile)
           for (i = 0; i < makefile->nTTCN3PPModules; i++) {
             const struct module_struct *module = makefile->TTCN3PPModules + i;
             if (module->dir_name == NULL || !makefile->central_storage)
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, FALSE);
           }
         }
       }
@@ -2269,7 +2293,7 @@ static void print_makefile(struct makefile_struct *makefile)
         if (module->dir_name == NULL || !makefile->central_storage) {
           print_generated_file_name(fp, module, FALSE, ".cc");
           if (makefile->code_splitting_mode)
-            print_splitted_file_names(fp, makefile, module);
+            print_splitted_file_names(fp, makefile, module, FALSE);
         }
       }
       if (makefile->preprocess) {
@@ -2278,7 +2302,7 @@ static void print_makefile(struct makefile_struct *makefile)
           if (module->dir_name == NULL || !makefile->central_storage) {
             print_generated_file_name(fp, module, FALSE, ".cc");
             if (makefile->code_splitting_mode)
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, FALSE);
           }
         }
       }
@@ -2289,7 +2313,7 @@ static void print_makefile(struct makefile_struct *makefile)
         for (i = 0; i < makefile->nASN1Modules; i++) {
           const struct module_struct *module = makefile->ASN1Modules + i;
           if (module->dir_name == NULL || !makefile->central_storage) {
-            print_splitted_file_names(fp, makefile, module);
+            print_splitted_file_names(fp, makefile, module, FALSE);
           }
         }
       }
@@ -2299,7 +2323,7 @@ static void print_makefile(struct makefile_struct *makefile)
         if (module->dir_name == NULL || !makefile->central_storage) {
           print_generated_file_name(fp, module, FALSE, ".cc");
           if (makefile->code_splitting_mode)
-            print_splitted_file_names(fp, makefile, module);
+            print_splitted_file_names(fp, makefile, module, FALSE);
         }
       }
     }
@@ -2339,7 +2363,7 @@ static void print_makefile(struct makefile_struct *makefile)
           for (i = 0; i < makefile->nTTCN3Modules; i++) {
             const struct module_struct *module = makefile->TTCN3Modules + i;
             if (module->dir_name != NULL) {
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, TRUE);
             }
           }
         }
@@ -2349,7 +2373,7 @@ static void print_makefile(struct makefile_struct *makefile)
             for (i = 0; i < makefile->nTTCN3PPModules; i++) {
               const struct module_struct *module = makefile->TTCN3PPModules + i;
               if (module->dir_name != NULL) {
-                print_splitted_file_names(fp, makefile, module);
+                print_splitted_file_names(fp, makefile, module, TRUE);
               }
             }
           }
@@ -2360,7 +2384,7 @@ static void print_makefile(struct makefile_struct *makefile)
           if (module->dir_name != NULL) {
             print_generated_file_name(fp, module, TRUE, ".cc");
             if (makefile->code_splitting_mode)
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, TRUE);
           }
         }
         if (makefile->preprocess) {
@@ -2369,7 +2393,7 @@ static void print_makefile(struct makefile_struct *makefile)
             if (module->dir_name != NULL) {
               print_generated_file_name(fp, module, TRUE, ".cc");
               if (makefile->code_splitting_mode)
-                print_splitted_file_names(fp, makefile, module);
+                print_splitted_file_names(fp, makefile, module, TRUE);
             }
           }
         }
@@ -2380,7 +2404,7 @@ static void print_makefile(struct makefile_struct *makefile)
           for (i = 0; i < makefile->nASN1Modules; i++) {
             const struct module_struct *module = makefile->ASN1Modules + i;
             if (module->dir_name != NULL) {
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, TRUE);
             }
           }
         }
@@ -2390,7 +2414,7 @@ static void print_makefile(struct makefile_struct *makefile)
           if (module->dir_name != NULL) {
             print_generated_file_name(fp, module, TRUE, ".cc");
             if (makefile->code_splitting_mode)
-              print_splitted_file_names(fp, makefile, module);
+              print_splitted_file_names(fp, makefile, module, TRUE);
           }
         }
       }
@@ -2556,14 +2580,22 @@ static void print_makefile(struct makefile_struct *makefile)
           const struct module_struct *module = makefile->TTCN3Modules + i;
           if (module->dir_name == NULL || !makefile->central_storage) {
             print_generated_file_name(fp, module, FALSE, ".so");
-            if (makefile->code_splitting_mode != NULL)
+            if (makefile->code_splitting_mode != NULL) {
+              int n_slices;
               if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
                 print_generated_file_name(fp, module, FALSE, "_seq.so");
                 print_generated_file_name(fp, module, FALSE, "_set.so");
                 print_generated_file_name(fp, module, FALSE, "_seqof.so");
                 print_generated_file_name(fp, module, FALSE, "_setof.so");
                 print_generated_file_name(fp, module, FALSE, "_union.so");
+              } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                for (int i = 1; i < n_slices; i++) {
+                char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.so", i);
+                  print_generated_file_name(fp, module, FALSE, buffer);
+                }
               }
+            }
           }
         }
         if (makefile->preprocess) {
@@ -2571,14 +2603,22 @@ static void print_makefile(struct makefile_struct *makefile)
             const struct module_struct *module = makefile->TTCN3PPModules + i;
             if (module->dir_name == NULL || !makefile->central_storage) {
               print_generated_file_name(fp, module, FALSE, ".so");
-              if (makefile->code_splitting_mode != NULL)
+              if (makefile->code_splitting_mode != NULL) {
+                int n_slices;
                 if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
                   print_generated_file_name(fp, module, FALSE, "_seq.so");
                   print_generated_file_name(fp, module, FALSE, "_set.so");
                   print_generated_file_name(fp, module, FALSE, "_seqof.so");
                   print_generated_file_name(fp, module, FALSE, "_setof.so");
                   print_generated_file_name(fp, module, FALSE, "_union.so");
+                } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                  for (int i = 1; i < n_slices; i++) {
+                char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.so", i);
+                    print_generated_file_name(fp, module, FALSE, buffer);
+                  }
                 }
+              }
             }
           }
         }
@@ -2586,14 +2626,22 @@ static void print_makefile(struct makefile_struct *makefile)
           const struct module_struct *module = makefile->ASN1Modules + i;
           if (module->dir_name == NULL || !makefile->central_storage) {
             print_generated_file_name(fp, module, FALSE, ".so");
-            if (makefile->code_splitting_mode != NULL)
+            if (makefile->code_splitting_mode != NULL) {
+              int n_slices;
               if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
                 print_generated_file_name(fp, module, FALSE, "_seq.so");
                 print_generated_file_name(fp, module, FALSE, "_set.so");
                 print_generated_file_name(fp, module, FALSE, "_seqof.so");
                 print_generated_file_name(fp, module, FALSE, "_setof.so");
                 print_generated_file_name(fp, module, FALSE, "_union.so");
+              } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                for (int i = 1; i < n_slices; i++) {
+                char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.so", i);
+                  print_generated_file_name(fp, module, FALSE, buffer);
+                }
               }
+            }
           }
         }
       }
@@ -2620,14 +2668,22 @@ static void print_makefile(struct makefile_struct *makefile)
         const struct module_struct *module = makefile->TTCN3Modules + i;
         if (module->dir_name == NULL || !makefile->central_storage) {
           print_generated_file_name(fp, module, FALSE, ".o");
-          if (makefile->code_splitting_mode != NULL)
+          if (makefile->code_splitting_mode != NULL) {
+            int n_slices;
             if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
               print_generated_file_name(fp, module, FALSE, "_seq.o");
               print_generated_file_name(fp, module, FALSE, "_set.o");
               print_generated_file_name(fp, module, FALSE, "_seqof.o");
               print_generated_file_name(fp, module, FALSE, "_setof.o");
               print_generated_file_name(fp, module, FALSE, "_union.o");
+            } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+              for (int i = 1; i < n_slices; i++) {
+                char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.o", i);
+                print_generated_file_name(fp, module, FALSE, buffer);
+              }
             }
+          }
         }
       }
       if (makefile->preprocess) {
@@ -2635,14 +2691,22 @@ static void print_makefile(struct makefile_struct *makefile)
           const struct module_struct *module = makefile->TTCN3PPModules + i;
           if (module->dir_name == NULL || !makefile->central_storage) {
             print_generated_file_name(fp, module, FALSE, ".o");
-            if (makefile->code_splitting_mode != NULL)
+            if (makefile->code_splitting_mode != NULL) {
+              int n_slices;
               if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
                 print_generated_file_name(fp, module, FALSE, "_seq.o");
                 print_generated_file_name(fp, module, FALSE, "_set.o");
                 print_generated_file_name(fp, module, FALSE, "_seqof.o");
                 print_generated_file_name(fp, module, FALSE, "_setof.o");
                 print_generated_file_name(fp, module, FALSE, "_union.o");
+              } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                for (int i = 1; i < n_slices; i++) {
+                  char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.o", i);
+                  print_generated_file_name(fp, module, FALSE, buffer);
+                }
               }
+            }
           }
         }
       }
@@ -2650,14 +2714,22 @@ static void print_makefile(struct makefile_struct *makefile)
         const struct module_struct *module = makefile->ASN1Modules + i;
         if (module->dir_name == NULL || !makefile->central_storage) {
           print_generated_file_name(fp, module, FALSE, ".o");
-          if (makefile->code_splitting_mode != NULL)
+          if (makefile->code_splitting_mode != NULL) {
+            int n_slices;
             if (strcmp(makefile->code_splitting_mode, "-U type") == 0) {
               print_generated_file_name(fp, module, FALSE, "_seq.o");
               print_generated_file_name(fp, module, FALSE, "_set.o");
               print_generated_file_name(fp, module, FALSE, "_seqof.o");
               print_generated_file_name(fp, module, FALSE, "_setof.o");
               print_generated_file_name(fp, module, FALSE, "_union.o");
+            } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+              for (int i = 1; i < n_slices; i++) {
+                char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.o", i);
+                print_generated_file_name(fp, module, FALSE, buffer);
+              }
             }
+          }
         }
       }
     }
@@ -2752,14 +2824,36 @@ static void print_makefile(struct makefile_struct *makefile)
         else {
           for (i = 0; i < makefile->nTTCN3Modules; i++) {
             const struct module_struct *module = makefile->TTCN3Modules + i;
-            if (module->dir_name != NULL)
+            if (module->dir_name != NULL) {
               print_generated_file_name(fp, module, TRUE, ".o");
+              if (makefile->code_splitting_mode != NULL) {
+                int n_slices;
+                if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                  for (int i = 1; i < n_slices; i++) {
+                    char buffer[16]; // 6 digits + 4 chars + _part
+                sprintf(buffer, "_part_%i.o", i);
+                    print_generated_file_name(fp, module, TRUE, buffer);
+                  }
+                }
+              }
+            }
           }
           if (makefile->preprocess) {
             for (i = 0; i < makefile->nTTCN3PPModules; i++) {
               const struct module_struct *module = makefile->TTCN3PPModules + i;
-              if (module->dir_name != NULL)
+              if (module->dir_name != NULL) {
                 print_generated_file_name(fp, module, TRUE, ".o");
+                if (makefile->code_splitting_mode != NULL) {
+                  int n_slices;
+                  if((n_slices = atoi(makefile->code_splitting_mode + 2))) {
+                    for (int i = 1; i < n_slices; i++) {
+                      char buffer[16]; // 6 digits + 4 chars + _part
+                      sprintf(buffer, "_part_%i.o", i);
+                      print_generated_file_name(fp, module, TRUE, buffer);
+                    }
+                  }
+                }
+              }
             }
           }
           for (i = 0; i < makefile->nASN1Modules; i++) {
@@ -2928,6 +3022,9 @@ static void print_makefile(struct makefile_struct *makefile)
     fputs("SOLARIS_LIBS = -lsocket -lnsl -lxml2", fp);
 #ifdef USAGE_STATS
     fputs(" -lresolv", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+    fputs(" -lcurses", fp);
 #endif
     if (makefile->solspeclibraries) {
       struct string_list* act_elem = makefile->solspeclibraries;
@@ -2943,6 +3040,9 @@ static void print_makefile(struct makefile_struct *makefile)
     fputs("SOLARIS8_LIBS = -lsocket -lnsl -lxml2", fp);
 #ifdef USAGE_STATS
     fputs(" -lresolv", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+    fputs(" -lcurses", fp);
 #endif
     if (makefile->sol8speclibraries) {
       struct string_list* act_elem = makefile->sol8speclibraries;
@@ -2958,6 +3058,9 @@ static void print_makefile(struct makefile_struct *makefile)
     fputs("LINUX_LIBS = -lxml2", fp);
 #ifdef USAGE_STATS
     fputs(" -lpthread -lrt", fp);
+#endif
+#ifdef ADVANCED_DEBUGGER_UI
+    fputs(" -lncurses", fp);
 #endif
     if (makefile->linuxspeclibraries) {
       struct string_list* act_elem = makefile->linuxspeclibraries;
@@ -2971,6 +3074,9 @@ static void print_makefile(struct makefile_struct *makefile)
     fputs("\n", fp);
 
     fputs("FREEBSD_LIBS = -lxml2", fp);
+#ifdef ADVANCED_DEBUGGER_UI
+    fputs(" -lncurses", fp);
+#endif
     if (makefile->freebsdspeclibraries) {
       struct string_list* act_elem = makefile->freebsdspeclibraries;
       while (act_elem) {
@@ -2983,6 +3089,9 @@ static void print_makefile(struct makefile_struct *makefile)
     fputs("\n", fp);
 
     fputs("WIN32_LIBS = -lxml2", fp);
+#ifdef ADVANCED_DEBUGGER_UI
+    fputs(" -lncurses", fp);
+#endif
     if (makefile->win32speclibraries) {
       struct string_list* act_elem = makefile->win32speclibraries;
       while (act_elem) {
@@ -3648,7 +3757,7 @@ static void print_makefile(struct makefile_struct *makefile)
     if (makefile->linkingStrategy) {
       fputs("\n\n"
         "archive:\n"
-        "\t@perl $(TTCN3_DIR)/bin/ttcn3_archive.pl\n\n", fp);
+        "\t@perl $(TTCN3_DIR)/bin/ttcn3_archive\n\n", fp);
     }
     else {
       fputs("\n\n"
@@ -3802,7 +3911,8 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
   const char* cxxcompiler, const char* optlevel, const char* optflags, boolean disableber, boolean disableraw, boolean disabletext,
   boolean disablexer, boolean disablejson, boolean forcexerinasn, boolean defaultasomit, boolean gccmsgformat,
   boolean linenumbersonlymsg, boolean includesourceinfo, boolean addsourcelineinfo, boolean suppresswarnings,
-  boolean outparamboundness, boolean omit_in_value_list, boolean warnings_for_bad_variants, boolean disable_predef_ext_folder, struct string_list* solspeclibraries,
+  boolean outparamboundness, boolean omit_in_value_list, boolean warnings_for_bad_variants, boolean activate_debugger,
+  boolean disable_predef_ext_folder, struct string_list* solspeclibraries,
   struct string_list* sol8speclibraries, struct string_list* linuxspeclibraries, struct string_list* freebsdspeclibraries,
   struct string_list* win32speclibraries, const char* ttcn3preprocessor, struct string_list* linkerlibraries,
   struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, char* generatorCommandOutput,
@@ -3854,6 +3964,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
   makefile.outparamboundness = outparamboundness;
   makefile.omit_in_value_list = omit_in_value_list;
   makefile.warnings_for_bad_variants = warnings_for_bad_variants;
+  makefile.activate_debugger = activate_debugger;
   makefile.disable_predef_ext_folder = disable_predef_ext_folder;
   makefile.solspeclibraries = solspeclibraries;
   makefile.sol8speclibraries = sol8speclibraries;
@@ -3989,8 +4100,8 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
 static void usage(void)
 {
   fprintf(stderr, "\n"
-    "usage: %s [-abc" C_flag "dDEfFglLmMprRstTVwWXZ] [-K file] [-z file ] [-P dir]"
-    " [-U none|type] [-e ets_name] [-o dir|file]\n"
+    "usage: %s [-abc" C_flag "dDEfFglLmMnprRsStTVwWXZ] [-K file] [-z file ] [-P dir]"
+    " [-U none|type|'number'] [-e ets_name] [-o dir|file]\n"
     "        [-t project_descriptor.tpd [-b buildconfig]]\n"
     "        [-O file] ... module_name ... testport_name ...\n"
     "   or  %s -v\n"
@@ -4012,14 +4123,16 @@ static void usage(void)
     "  -L:             create makefile with library archive as the default target\n"
     "  -m:             always use makedepend for dependencies\n"
     "  -M:             allow 'omit' in template value lists (legacy behavior)\n"
+    "  -n:             activate debugger (generates extra code for debugging)\n"
     "  -o dir|file:    write the Makefile to the given directory or file\n"
     "  -O file:        add the given file to the Makefile as other file\n"
     "  -p:             generate Makefile with TTCN-3 preprocessing\n"
     "  -R:             use function test runtime (TITAN_RUNTIME_2)\n"
     "  -s:             generate Makefile for single mode\n"
-    "  -U none|type:   split generated code\n"
+    "  -S:             suppress makefilegen warnings\n"
+    "  -U none|type|'number':  split generated code\n"
     "  -v:             show version\n"
-    "  -w:             suppress warnings\n"
+    "  -w:             suppress warnings generated by TITAN\n"
     "  -Y:             Enforces legacy behaviour of the \"out\" function parameters (see refguide)\n"
     "  -z file:        enable profiling and code coverage for the TTCN-3 files in the argument\n"
     "Options for processing the Titan Project Descriptor file(s):\n"
@@ -4034,7 +4147,7 @@ static void usage(void)
     "  -X:             generate XML file that describes the TPD hierarchy, use with -r\n"
     "  -W:             prefix working directories with project name\n"
     "  -Z:             recursive Makefile generation from TPD using object files and dynamic libraries too\n"
-    "  -H:             hierachical Makefile generation from TPD use with -Z\n"
+    "  -H:             hierarchical Makefile generation from TPD use with -Z\n"
     , program_name, program_name);
 }
 
@@ -4077,9 +4190,9 @@ int main(int argc, char *argv[])
     dsflag = FALSE, dbflag = FALSE, drflag = FALSE, dtflag = FALSE,
     dxflag = FALSE, fxflag = FALSE, doflag = FALSE,
     gfflag = FALSE, lnflag = FALSE, isflag = FALSE, asflag = FALSE,
-    swflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE,
+    Sflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE,
     djflag = FALSE, Zflag = FALSE, Hflag = FALSE, Mflag = FALSE,
-    diflag = FALSE, zflag = FALSE, Eflag = FALSE;
+    diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE;
   boolean error_flag = FALSE;
   char *output_file = NULL;
   char *ets_name = NULL;
@@ -4136,7 +4249,7 @@ int main(int argc, char *argv[])
   }
 
   for ( ; ; ) {
-    int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:K:o:lLmMpP:rRst:TU:vVwWXYz:ZH");
+    int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:K:o:lLmMnpP:rRsSt:TU:vVwWXYz:ZH");
     if (c == -1) break;
     switch (c) {
     case 'O':
@@ -4211,6 +4324,9 @@ int main(int argc, char *argv[])
     case 'M':
       SET_FLAG(M);
       break;
+    case 'n':
+      SET_FLAG(n);
+      break;
     case 'p':
       SET_FLAG(p);
       break;
@@ -4234,6 +4350,10 @@ int main(int argc, char *argv[])
     case 's':
       SET_FLAG(s);
       break;
+    case 'S':
+      SET_FLAG(S);
+      suppress_warnings = TRUE;
+      break;
     case 't':
       SET_FLAG(t);
       tpd_file_name = optarg;
@@ -4246,11 +4366,26 @@ int main(int argc, char *argv[])
       break;
     case 'U':
       SET_FLAG(U);
+      int n_slices = atoi(optarg);
       code_splitting_mode = optarg;
-      if (strcmp(optarg, "none") != 0 &&
-        strcmp(optarg, "type") != 0)
+      if (!n_slices && 
+        (strcmp(optarg, "none") != 0 &&
+        strcmp(optarg, "type") != 0))
+      {
         ERROR("Unrecognizable argument: '%s'. Valid options for -U switch are: "
-          "'none', 'type'", optarg);
+          "'none', 'type', or a number.", optarg);
+      } else {
+        size_t length = strlen(optarg);
+        for (int i=0;i<length; i++) {
+          if (!isdigit(optarg[i])) {
+            ERROR("The number argument of -U must be a valid number.");
+            break;
+          }
+        }
+        if (n_slices < 1 || n_slices > 999999) {
+          ERROR("The number argument of -U must be between 1 and 999999.");
+        }
+      }
       break;
     case 'v':
       SET_FLAG(v);
@@ -4260,7 +4395,6 @@ int main(int argc, char *argv[])
       break;
     case 'w':
       SET_FLAG(w);
-      suppress_warnings = TRUE;
       break;
     case 'W':
       SET_FLAG(W);
@@ -4287,7 +4421,7 @@ int main(int argc, char *argv[])
     if ( aflag || bflag || cflag || Cflag || dflag || eflag || fflag || Fflag || gflag
       || mflag || oflag || lflag || pflag || Pflag || rflag || Rflag || sflag
       || tflag || Tflag || Vflag || wflag || Xflag || Kflag || Dflag || Wflag || Yflag
-      || Zflag || Hflag || Mflag || zflag || Eflag || n_other_files > 0 || n_search_paths > 0)
+      || Zflag || Hflag || Mflag || zflag || Eflag || nflag || n_other_files > 0 || n_search_paths > 0)
       error_flag = TRUE;
   }
 
@@ -4467,15 +4601,24 @@ int main(int argc, char *argv[])
     required_configs->str2 = NULL;
     required_configs->next = NULL;
 
+    // This temp flag is used to get the value of suppressWarnings from the TPD
+    // while the wflag still holds the value of the command line parameter -w
+    boolean temp_wflag = FALSE;
+
     tpd_processed = process_tpd(tpd_file_name, tpd_build_config, file_list_path,
       &argc, &argv, &optind, &ets_name, &project_name,
       &gflag, &sflag, &cflag, &aflag, &pflag,
       &Rflag, &lflag, &mflag, &Pflag, &Lflag, rflag, Fflag, Tflag, output_file, &abs_work_dir, 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, &csflag, 
       &quflag, &dsflag, &cxxcompiler, &optlevel, &optflags, &dbflag, &drflag, &dtflag, &dxflag, &djflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag,
-      &asflag, &swflag, &Yflag, &Mflag, &Eflag, &diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep,
+      &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep,
       linkerlibraries, additionalObjects, linkerlibsearchpath, Vflag, Dflag, &Zflag, &Hflag,
       &generatorCommandOutput, target_placement_list, Wflag, run_command_list, required_configs, &profiled_file_list, search_paths, n_search_paths);
+    
+    // wflag overrides temp_wflag
+    if (!wflag) {
+      wflag = temp_wflag;
+    }
 
     Free(abs_work_dir);
     if (prj_graph_fp) {
@@ -4512,7 +4655,7 @@ int main(int argc, char *argv[])
       Rflag, lflag, mflag, Cflag, code_splitting_mode, tcov_file_name, profiled_file_list,
       Lflag, Zflag, Hflag, rflag ? sub_project_dirs : NULL, ttcn3_prep_includes,
       ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, csflag, quflag, dsflag, cxxcompiler, optlevel, optflags, dbflag,
-      drflag, dtflag, dxflag, djflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, swflag, Yflag, Mflag, Eflag, diflag, solspeclibraries,
+      drflag, dtflag, dxflag, djflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, diflag, solspeclibraries,
       sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects,
       linkerlibsearchpath, generatorCommandOutput, target_placement_list);
   }
This page took 0.031445 seconds and 5 git commands to generate.