public static String makeFileName(String filepath, Keyword type, boolean relativeP) {
    { String extension = Keyword.selectFileExtension(type);
      String rootpath = "";
      String splitterpath = "";
      String subdirectory = "";

      if (relativeP) {
        rootpath = Keyword.selectRootDirectory(type);
        splitterpath = Keyword.selectSplitterPath(type);
        if (!(type == Stella.KWD_OTHER)) {
          filepath = Stella.fileNameWithoutExtension(filepath);
        }
        if ((type == Stella.KWD_JAVA) ||
            (((type == Stella.KWD_OTHER) ||
            (type == Stella.KWD_NONE)) &&
             (((Keyword)(Stella.$TRANSLATOROUTPUTLANGUAGE$.get())) == Stella.KWD_JAVA))) {
          subdirectory = Module.javaPackagePrefix(((Module)(Stella.$MODULE$.get())), Stella.directorySeparatorString());
        }
        else {
          if (!Stella.stringEqlP(((String)(Stella.$CURRENTSYSTEMDEFINITIONSUBDIRECTORY$.get())), "")) {
            subdirectory = ((String)(Stella.$CURRENTSYSTEMDEFINITIONSUBDIRECTORY$.get())) + Stella.directorySeparatorString();
          }
        }
      }
      else {
        { String rootprefix = Stella.rootDirectoryPrefix(filepath);

          if (!(type == Stella.KWD_OTHER)) {
            filepath = Stella.fileNameWithoutExtension(filepath);
          }
          if (!Stella.getQuotedTree("((:STELLA :KB) \"/STELLA\")", "/STELLA").memberP(type)) {
            { String relativepath = Stella.relativizeFileName(filepath, rootprefix);

              if (!Stella.stringEqlP(filepath, relativepath)) {
                rootpath = Keyword.selectRootDirectory(type);
                splitterpath = Keyword.selectSplitterPath(type);
                filepath = relativepath;
              }
            }
          }
        }
      }
      return (rootpath + splitterpath + subdirectory + filepath + extension);
    }
  }