Skip to content

Support building with --disable-maintainer-mode and source != build dir#3518

Merged
itchyny merged 1 commit intojqlang:masterfrom
Saur2000:master
Apr 8, 2026
Merged

Support building with --disable-maintainer-mode and source != build dir#3518
itchyny merged 1 commit intojqlang:masterfrom
Saur2000:master

Conversation

@Saur2000
Copy link
Copy Markdown
Contributor

@Saur2000 Saur2000 commented Apr 7, 2026

If --disable-maintainer-mode is enabled, then the rules for generating parser.[ch] and lexer.[ch] did nothing. This worked fine if the source and build directories are the same as the pre-generated parser.c and lexer.c files would suffice. However, if the build directory is not the same as the source directory, then the rest of the Make rules expect parser.[ch] and lexer.[ch] to have been created in the build directory if their source files (parser.y and lexer.l) are newer than the target files, which can happen in case the source is fetched using Git.

Avoid the problem by copying the files to the build directory if needed.

If --disable-maintainer-mode is enabled, then the rules for generating
parser.[ch] and lexer.[ch] did nothing. This worked fine if the source
and build directories are the same as the pre-generated parser.c and
lexer.c files would suffice. However, if the build directory is not the
same as the source directory, then the rest of the Make rules expect
parser.[ch] and lexer.[ch] to have been created in the build directory
if their source files (parser.y and lexer.l) are newer than the target
files, which can happen in case the source is fetched using Git.

Avoid the problem by copying the files to the build directory if needed.
@itchyny
Copy link
Copy Markdown
Contributor

itchyny commented Apr 7, 2026

This PR introduces GNU make extensions in our Makefile.am for the first time.

@Saur2000
Copy link
Copy Markdown
Contributor Author

Saur2000 commented Apr 8, 2026

This PR introduces GNU make extensions in our Makefile.am for the first time.

According to https://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html, the use of variables such as $(<D) and $(@F) are supported by POSIX Make. And even automake itself adds one (from the generated Makefile):

$(am__depfiles_remade):
        @$(MKDIR_P) $(@D)
        @: >>$@

So unless you are referring to something other than those automatic variables, I believe this should be ok.

@itchyny
Copy link
Copy Markdown
Contributor

itchyny commented Apr 8, 2026

Ah, sorry. I was wrong.

@itchyny
Copy link
Copy Markdown
Contributor

itchyny commented Apr 8, 2026

This fixes #3371, right?

@Saur2000
Copy link
Copy Markdown
Contributor Author

Saur2000 commented Apr 8, 2026

This fixes #3371, right?

Yes, it appears that it does. :)

@itchyny itchyny linked an issue Apr 8, 2026 that may be closed by this pull request
@itchyny
Copy link
Copy Markdown
Contributor

itchyny commented Apr 8, 2026

Thank you.

@itchyny itchyny merged commit 27f417f into jqlang:master Apr 8, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make failed when building out-of-source

2 participants