aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-04-28 02:22:12 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-04-28 02:22:12 -0400
commita147f065850af8f9422d19d14aec0476b641cb07 (patch)
tree7a4a2393b18027ddc3cfd972ebe0dda9d0a89b50 /src/link.cpp
parent458afb0ef9634b6a0480bcb6e07a92cd9a330d84 (diff)
downloadzig-a147f065850af8f9422d19d14aec0476b641cb07.tar.gz
zig-a147f065850af8f9422d19d14aec0476b641cb07.zip
zig puts temporary object files in zig-cache folder
See #298
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/link.cpp b/src/link.cpp
index a771b5c6aa..e3179680f9 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -48,6 +48,8 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) {
codegen_set_omit_zigrt(child_gen, true);
child_gen->want_h_file = false;
+ codegen_set_cache_dir(child_gen, parent_gen->cache_dir);
+
codegen_set_is_release(child_gen, parent_gen->is_release_build);
codegen_set_strip(child_gen, parent_gen->strip_debug_symbols);
@@ -64,10 +66,12 @@ static Buf *build_o(CodeGen *parent_gen, const char *oname) {
codegen_build(child_gen);
const char *o_ext = target_o_file_ext(&child_gen->zig_target);
- Buf *o_out = buf_sprintf("%s%s", oname, o_ext);
- codegen_link(child_gen, buf_ptr(o_out));
+ Buf *o_out_name = buf_sprintf("%s%s", oname, o_ext);
+ Buf *output_path = buf_alloc();
+ os_path_join(parent_gen->cache_dir, o_out_name, output_path);
+ codegen_link(child_gen, buf_ptr(output_path));
- return o_out;
+ return output_path;
}
static const char *get_exe_file_extension(CodeGen *g) {