From 6a37114af1edc03f1fb7b2da5204fa28130a9cd1 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Tue, 5 May 2020 18:13:19 +0200 Subject: [PATCH] Makefile.am: Use BUILT_SOURCES for GENERATED headers (#4068) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous fix when using _DEPENDENCIES was wrong because that dependency is only created for the final executable. However, the build fails when building the object file. The manual explicitly mentions that using _DEPENDENCIES is wrong for source files: > In rare cases you may need to add other kinds of files such as linker > scripts, but listing a source file in _DEPENDENCIES is wrong. If some > source file needs to be built before all the components of a program > are built, consider using the BUILT_SOURCES variable instead (see > Sources). https://www.gnu.org/software/automake/manual/automake.html#Linking Instead, using BUILT_SOURCES works, as mentioned in the manual. https://www.gnu.org/software/automake/manual/automake.html#Sources I have also removed the dependencies from i3_SOURCES since AFAIK dependencies to header files don't do anything. I have verified that modifying the header correctly re-triggers the build for i3 & i3-config-wizard. > Header files listed in a _SOURCES definition will be included in the > distribution but otherwise ignored. In case it isn’t obvious, you > should not include the header file generated by configure in a > _SOURCES variable; this file should not be distributed. Lex (.l) and > Yacc (.y) files can also be listed; see Yacc and Lex. https://www.gnu.org/software/automake/manual/automake.html#Program-Sources An alternative instead of BUILT_SOURCES that should also work in our case is found in this section: https://www.gnu.org/software/automake/manual/automake.html#Built-Sources-Example see "Recording Dependencies manually". The syntax would be: foo.$(OBJEXT): $(config_parser_SOURCES) $(command_parser_SOURCES) The benefit of this over BUILT_SOURCES is that it will work for targets other than 'all', 'check' and 'install'. However, since we don't really have such targets we don't need to do this right now. Tested extensively using this script: #!/bin/bash set -x autoreconf -fi while mkdir build && cd build && ../configure && make -j; do cd .. rm -rf build done Fixes #3670 --- Makefile.am | 5 ++--- RELEASE-NOTES-next | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index f4d2631a..1a28c7fc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -442,7 +442,6 @@ i3_config_wizard_i3_config_wizard_SOURCES = \ i3-config-wizard/xcb.h i3_config_wizard_i3_config_wizard_DEPENDENCIES = \ - $(config_parser_SOURCES) \ $(top_builddir)/libi3.a test_inject_randr15_CPPFLAGS = \ @@ -496,9 +495,9 @@ config_parser_SOURCES = \ parser/GENERATED_config_tokens.h \ parser/GENERATED_config_call.h +BUILT_SOURCES = $(command_parser_SOURCES) $(config_parser_SOURCES) + i3_SOURCES = \ - $(command_parser_SOURCES) \ - $(config_parser_SOURCES) \ include/all.h \ include/assignments.h \ include/atoms_NET_SUPPORTED.xmacro \ diff --git a/RELEASE-NOTES-next b/RELEASE-NOTES-next index e8a5dd86..c52a49ad 100644 --- a/RELEASE-NOTES-next +++ b/RELEASE-NOTES-next @@ -32,3 +32,4 @@ strongly encouraged to upgrade. • do not focus floating windows changing workspace with ConfigureNotify • i3-dmenu-desktop: Support symlinks in search path • build: correctly provide auxiliary functions when needed + • build: fix issues with parallel build