@@ -15,14 +15,16 @@ pub const Style = union(enum) {
15
15
cmake : std.Build.LazyPath ,
16
16
/// Start with input file and replace occurrences of names with their values.
17
17
custom : std.Build.LazyPath ,
18
+ /// Start with input file like custom, and output a nasm .asm file.
19
+ custom_nasm : std.Build.LazyPath ,
18
20
/// Instead of starting with an input file, start with nothing.
19
21
blank ,
20
22
/// Start with nothing, like blank, and output a nasm .asm file.
21
23
nasm ,
22
24
23
25
pub fn getPath (style : Style ) ? std.Build.LazyPath {
24
26
switch (style ) {
25
- .autoconf_undef , .autoconf_at , .cmake , .custom = > | s | return s ,
27
+ .autoconf_undef , .autoconf_at , .cmake , .custom , .custom_nasm = > | s | return s ,
26
28
.blank , .nasm = > return null ,
27
29
}
28
30
}
@@ -240,7 +242,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
240
242
try render_nasm (bw , config_header .values );
241
243
},
242
244
.custom = > | file_source | {
243
- try bw .writeAll (asm_generated_line );
245
+ try bw .writeAll (c_generated_line );
244
246
const src_path = file_source .getPath2 (b , step );
245
247
const contents = std .fs .cwd ().readFileAlloc (src_path , arena , .limited (config_header .max_bytes )) catch | err | {
246
248
return step .fail ("unable to read custom input file '{s}': {s}" , .{
@@ -249,6 +251,16 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
249
251
};
250
252
try render_custom (step , contents , bw , config_header .values );
251
253
},
254
+ .custom_nasm = > | file_source | {
255
+ try bw .writeAll (asm_generated_line );
256
+ const src_path = file_source .getPath2 (b , step );
257
+ const contents = std .fs .cwd ().readFileAlloc (src_path , arena , .limited (config_header .max_bytes )) catch | err | {
258
+ return step .fail ("unable to read custom NASM input file '{s}': {s}" , .{
259
+ src_path , @errorName (err ),
260
+ });
261
+ };
262
+ try render_custom (step , contents , bw , config_header .values );
263
+ },
252
264
}
253
265
254
266
const output = aw .written ();
0 commit comments