encounter / objdiff

A local diffing tool for decompilation projects
Apache License 2.0
77 stars 13 forks source link

Add custom make args #59

Closed AetiasHax closed 1 month ago

AetiasHax commented 1 month ago

A custom_make option such as make MY_VALUE=1 is interpreted as an entire command with no arguments. So, to allow for custom arguments, I've added a custom_args option.

I hope the README example makes sense, I haven't used Ninja before 🙃

encounter commented 1 month ago

Thanks for this! This feature is long overdue.

For more flexibility, I was considering making this a part of custom_make. My idea is that it would accept something like:

custom_make: ninja -C build %o

It could parse the command line (honoring shell parsing rules, like quotes, there’s something in std or a crate to do this) and perform any replacements (%o for “object” or “output”).

Of course, the “replacements” idea could also be done with the custom_args array, so the difference is mainly aesthetic.

Do you have any thoughts on this?

encounter commented 1 month ago

Actually, after thinking about it, I think it makes most sense the way you implemented it with custom_args. Thanks for the contribution!

AetiasHax commented 1 month ago

Do you have any thoughts on this?

I agree, it's possible that some build systems require arguments after the file being built.

The %o solution could work, but maybe it's too flexible? If all we need is to support custom arguments before and after the target file, then a custom_args_post (or better name) would suffice.

On the other hand, if replacement patterns other than %o are desirable, then custom_args_post would not suffice and the %o solution is the better alternative, imo.