@@ -817,6 +817,13 @@ def get_file_suffix(filename):
817
817
return ''
818
818
819
819
820
+ def get_secondary_target (target , ext ):
821
+ base = unsuffixed (target )
822
+ if get_file_suffix (target ) == ext :
823
+ base += '_'
824
+ return base + ext
825
+
826
+
820
827
def in_temp (name ):
821
828
temp_dir = shared .get_emscripten_temp_dir ()
822
829
return os .path .join (temp_dir , os .path .basename (name ))
@@ -829,8 +836,6 @@ def in_temp(name):
829
836
# Main run() function
830
837
#
831
838
def run (args ):
832
- target = None
833
-
834
839
# Additional compiler flags that we treat as if they were passed to us on the
835
840
# commandline
836
841
EMCC_CFLAGS = os .environ .get ('EMCC_CFLAGS' )
@@ -1227,7 +1232,7 @@ def add_link_flag(i, f):
1227
1232
wasm_target = target
1228
1233
else :
1229
1234
# Otherwise the wasm file is produced alongside the final target.
1230
- wasm_target = unsuffixed (target ) + '.wasm'
1235
+ wasm_target = get_secondary_target (target , '.wasm' )
1231
1236
1232
1237
# Apply user -jsD settings
1233
1238
for s in user_js_defines :
@@ -2438,7 +2443,7 @@ def post_link(options, in_wasm, wasm_target, target):
2438
2443
if options .oformat in (OFormat .JS , OFormat .MJS ):
2439
2444
js_target = target
2440
2445
else :
2441
- js_target = unsuffixed (target ) + '.js'
2446
+ js_target = get_secondary_target (target , '.js' )
2442
2447
2443
2448
# The JS is now final. Move it to its final location
2444
2449
move_file (final_js , js_target )
0 commit comments