Closed ibara closed 5 years ago
Thanks, never thought of this.
Is there a specific reason to use basename rather than a simple srrchr? Although I do break this in the linker module, I try to avoid any dependencies outside C89, so I rewrote this slightly before pushing. Having some trouble making github recognize this as merged now though, so might end up just closing.
strrchr is perfectly fine too. Thanks!
Currently, lacc takes the entire path of a file and changes just its suffix to create the output file name. However, gcc and clang also strip the path from the input file name. This means that gcc and clang put the resulting file in the current working directory (unless overridden by the
-o
flag) whereas lacc puts the resulting file in the directory the original source file lives in.lacc's behavior breaks
make(1)
assumptions about where resulting files belong.This PR strips path information using
basename(3)
. That function isn't inC89
but it is inPOSIX.1
.With this PR,
make obj && make
works correctly with *BSD make. Without this PR, lacc will complain that it cannot find object files when trying to link binaries.