1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-25 21:29:25 +00:00

Add the -i option

This commit is contained in:
Karol Stasiak 2019-06-14 11:28:26 +02:00
parent 50415714fa
commit ecb366eafb
2 changed files with 9 additions and 2 deletions

View File

@ -37,6 +37,9 @@ When searching for platform definitions, the current working directory is also s
If not given, the compiler will try to detect the default include directory. If not given, the compiler will try to detect the default include directory.
If given, then the compiler will NOT try to detect the default include directory and you will have to add it to the list yourself. If given, then the compiler will NOT try to detect the default include directory and you will have to add it to the list yourself.
* `-i <dir>` Add a directory to the include directories.
Unlike `-I`, this does not replace the default include directory and allows using directories with semicolons in their names.
* `-t <platform>` Target platform. It is loaded from an `.ini` file found in any of the include directories. See also [this document](target-platforms.md). * `-t <platform>` Target platform. It is loaded from an `.ini` file found in any of the include directories. See also [this document](target-platforms.md).
* `-r <program>` Run given program after successful compilation. Useful for automatically launching emulators without any external scripting. * `-r <program>` Run given program after successful compilation. Useful for automatically launching emulators without any external scripting.

View File

@ -189,10 +189,10 @@ object Main {
log.debug(s"Failed to find the default include path: $err") log.debug(s"Failed to find the default include path: $err")
case Right(path) => case Right(path) =>
log.debug(s"Automatically detected include path: $path") log.debug(s"Automatically detected include path: $path")
return c.copy(includePath = List(path)) return c.copy(includePath = List(path) ++ c.extraIncludePath)
} }
} }
c c.copy(includePath = c.includePath ++ c.extraIncludePath)
} }
private def assembleForMos(c: Context, platform: Platform, options: CompilationOptions): AssemblerOutput = { private def assembleForMos(c: Context, platform: Platform, options: CompilationOptions): AssemblerOutput = {
@ -348,6 +348,10 @@ object Main {
c.copy(includePath = c.includePath ++ n) c.copy(includePath = c.includePath ++ n)
}.description("Include paths for modules. If not given, the default path is used: " + getDefaultIncludePath.fold(identity, identity)) }.description("Include paths for modules. If not given, the default path is used: " + getDefaultIncludePath.fold(identity, identity))
parameter("-i", "--add-include-dir").repeatable().placeholder("<dir>").action { (path, c) =>
c.copy(extraIncludePath = c.extraIncludePath :+ path)
}.description("Add a directory to include paths.")
parameter("-r", "--run").placeholder("<program>").action { (p, c) => parameter("-r", "--run").placeholder("<program>").action { (p, c) =>
assertNone(c.runFileName, "Run program already defined") assertNone(c.runFileName, "Run program already defined")
c.copy(runFileName = Some(p)) c.copy(runFileName = Some(p))