Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions rdmd.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ int main(string[] args)
getopt(args,
std.getopt.config.caseSensitive,
std.getopt.config.passThrough,
std.getopt.config.stopOnFirstNonOption,
"build-only", &buildOnly,
"chatty", &chatty,
"compiler", &compiler,
Expand Down Expand Up @@ -148,6 +147,10 @@ int main(string[] args)
args = args[0 .. programPos];
auto compilerFlags = args[1 .. programPos - 1];

// --build-only implies the user would like a binary in the current directory
if (buildOnly && !exe)
exe = "." ~ std.path.sep;

// Compute the object directory and ensure it exists
immutable objDir = getObjPath(root, compilerFlags);
// Fetch dependencies
Expand Down Expand Up @@ -180,23 +183,21 @@ int main(string[] args)
if (std.algorithm.endsWith(exe, std.path.sep[]))
{
// user specified a directory, complete it to a file
exe = std.path.join(exe, exeBasename);
exe = std.path.join(exe, exeBasename) ~ binExt;
}
}
else
{
//exe = exeBasename ~ '.' ~ hash(root, compilerFlags);
version (Posix)
exe = std.path.join(myOwnTmpDir, rel2abs(root)[1 .. $])
~ '.' ~ hash(root, compilerFlags);
~ '.' ~ hash(root, compilerFlags) ~ binExt;
else version (Windows)
exe = std.path.join(myOwnTmpDir, replace(root, ".", "-"))
~ '-' ~ hash(root, compilerFlags);
~ '-' ~ hash(root, compilerFlags) ~ binExt;
else
static assert(0);
}
// Add an ".exe" for Windows
exe ~= binExt;

// Have at it
if (isNewer(root, exe) ||
Expand Down Expand Up @@ -234,7 +235,7 @@ size_t indexOfProgram(string[] args)
{
if (i > 0 &&
!arg.startsWith('-', '@') &&
!arg.endsWith(".obj", ".o", ".lib", ".a", ".def"))
!arg.endsWith(".obj", ".o", ".lib", ".a", ".def", ".map"))
{
return i;
}
Expand All @@ -260,7 +261,8 @@ private string myOwnTmpDir()
{
version (Posix)
{
enum tmpRoot = "/tmp/.rdmd";
import core.sys.posix.unistd;
auto tmpRoot = format("/tmp/.rdmd-%d", getuid());
}
else version (Windows)
{
Expand Down