diff --git a/compiler2/makefile.c b/compiler2/makefile.c
index 2e33c9298db9fc980329c3cdf692ee8104e7ee63..0b06642e98669dc25e3e2116fbd678fe975b8053 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 0000000000000000000000000000000000000000..61da58947b3429fff03caf827a23c2f5e78e22a1
--- /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 0000000000000000000000000000000000000000..dac6b4c59846892d38fa37db378987851b4fe202
--- /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