Makefile: Stop building on ggo errors.
authorAndre Noll <maan@systemlinux.org>
Mon, 28 Feb 2011 10:32:16 +0000 (11:32 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 28 Feb 2011 10:32:16 +0000 (11:32 +0100)
The dependency files *.d are implicitly made by -include command
during make's first pass. The "-" prefix instructs make to ignore any
non-existing files *and* all errors resulting from executing the rules
for the *.d targets . This prefix is necessary to avoid the warning
messages about non-existing dependency files, for example after a
"make clean2".

This implies that make proceeds even if a dependency file could not
be created due to a syntax error in a .ggo file. We'd like to stop
if this happens, but unfortunately gnu make does not have an option
for specifying this behaviour in an include command.

This patch works around this shortcoming by letting the "all"
target depend on the new phony target "dep" which depends on all .d
files. This way all *.d targets are considered twice: Once during the
first pass (where errors are ignored) and again due to the all->dep
dependency.

If no errors occur, "make dep" is a no-op, so this change should not
slow down the build noticeably. A slight drawback of this solution
is that, in case of an error in a ggo file, the error will be printed
twice. But this it is still better than silently ignoring the error.

Makefile.in

index 3fbbce21ab5f3fe91d674750a4d3f7804c346188..c64b5ae7250ce5cceb178f39089319ae38894a11 100644 (file)
@@ -99,9 +99,10 @@ else
        Q = @
 endif
 
        Q = @
 endif
 
-.PHONY: all clean distclean maintainer-clean install man tarball\
+.PHONY: dep all clean distclean maintainer-clean install man tarball\
        .FORCE-GIT-VERSION-FILE
        .FORCE-GIT-VERSION-FILE
-all: @executables@ $(man_pages)
+all: dep @executables@ $(man_pages)
+dep: $(deps)
 man: $(man_pages)
 tarball: $(tarball)
 
 man: $(man_pages)
 tarball: $(tarball)
 
@@ -224,8 +225,10 @@ all_objs := $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
        $(audiod_objs) $(audioc_objs) $(fade_objs) $(server_objs) \
        $(write_objs) $(afh_objs)
 
        $(audiod_objs) $(audioc_objs) $(fade_objs) $(server_objs) \
        $(write_objs) $(afh_objs)
 
+deps := $(all_objs:.o=.d)
+
 ifeq ($(findstring clean, $(MAKECMDGOALS)),)
 ifeq ($(findstring clean, $(MAKECMDGOALS)),)
--include $(all_objs:.o=.d)
+-include $(deps)
 endif
 
 para_recv: $(recv_objs)
 endif
 
 para_recv: $(recv_objs)