From 77546152edef2851b6ff3a32db94256e6621de88 Mon Sep 17 00:00:00 2001
From: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
Date: Wed, 12 Oct 2016 09:46:58 +0200
Subject: [PATCH] makefilegen: asn1 file name check now only checks the file
 name

Change-Id: I6c13cf055795e009babe8f3d8c69d08419aa3a48
Signed-off-by: BenceJanosSzabo <bence.janos.szabo@ericsson.com>
---
 compiler2/makefile.c                          |  4 +-
 .../compileonly/asn1_hyphen/Makefile          | 37 +++++++++++++++++++
 .../folder-with-hyphen/ASN1Module1.asn        | 25 +++++++++++++
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 regression_test/compileonly/asn1_hyphen/Makefile
 create mode 100644 regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn

diff --git a/compiler2/makefile.c b/compiler2/makefile.c
index 2e33c9298..0b06642e9 100644
--- a/compiler2/makefile.c
+++ b/compiler2/makefile.c
@@ -1250,7 +1250,8 @@ static void add_file_to_makefile(struct makefile_struct *makefile, char *argumen
             add_ttcn3_module(makefile, file_name, module_name);
           }
      } else if (is_asn1_module(file_name, fp, &module_name)) {
-         if (is_valid_asn1_filename(file_name)) {
+         expstring_t only_file_name = get_file_from_path(file_name);
+         if (is_valid_asn1_filename(only_file_name)) {
            add_asn1_module(makefile, file_name, module_name);
          } else {
              ERROR("The file name `%s' (without suffix) shall be identical to the module name `%s'.\n"
@@ -1258,6 +1259,7 @@ static void add_file_to_makefile(struct makefile_struct *makefile, char *argumen
                    "file name shall contain an underscore character instead.", file_name, module_name);
              Free(module_name);
          }
+         Free(only_file_name);
      } else if (is_xsd_module(file_name, &module_name)) {
        add_xsd_module(makefile, file_name, module_name);
      } else {
diff --git a/regression_test/compileonly/asn1_hyphen/Makefile b/regression_test/compileonly/asn1_hyphen/Makefile
new file mode 100644
index 000000000..61da58947
--- /dev/null
+++ b/regression_test/compileonly/asn1_hyphen/Makefile
@@ -0,0 +1,37 @@
+##############################################################################
+# Copyright (c) 2000-2016 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse 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
+
+MFGEN := $(TTCN3_DIR)/bin/ttcn3_makefilegen
+MFGEN_FLAGS := -sf $(RT2_FLAG) $(SPLIT_FLAG)
+
+FOLDER := folder-with-hyphen
+FILES := $(FOLDER)/ASN1Module1.asn
+
+
+# ${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. 
+MAKEPROG := ${MAKE}
+
+all:
+	$(MFGEN) $(MFGEN_FLAGS) -o GenMakefile $(FILES) && rm GenMakefile
+
+
+.PHONY: all clean distclean run
+
diff --git a/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn b/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn
new file mode 100644
index 000000000..dac6b4c59
--- /dev/null
+++ b/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn
@@ -0,0 +1,25 @@
+--/////////////////////////////////////////////////////////////////////////////
+-- Copyright (c) 2000-2016 Ericsson Telecom AB
+-- All rights reserved. This program and the accompanying materials
+-- are made available under the terms of the Eclipse Public License v1.0
+-- which accompanies this distribution, and is available at
+-- http://www.eclipse.org/legal/epl-v10.html
+--
+-- Contributors:
+--   Szabo, Bence Janos
+--
+--/////////////////////////////////////////////////////////////////////////////
+ASN1Module1
+DEFINITIONS
+
+AUTOMATIC TAGS
+
+::=
+
+BEGIN
+
+IMPORTS ; -- nothing
+
+asn1module1 INTEGER ::= 1
+
+END
\ No newline at end of file
-- 
GitLab