bug-cppi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-cppi] more non-recursive make fallout


From: Jim Meyering
Subject: [bug-cppi] more non-recursive make fallout
Date: Sat, 14 Apr 2012 18:48:23 +0200

It started when I noticed "make distcheck" failing like this
(this was while using automake tools from automake's ng/master branch)

  configure: creating ./config.status
  config.status: creating Makefile
  config.status: creating po/Makefile.in
  config.status: creating lib/config.h
  config.status: linking ../GNUmakefile to GNUmakefile
  config.status: executing po-directories commands
  config.status: creating po/POTFILES
  config.status: creating po/Makefile
  make[1]: Entering directory `/h/j/w/co/cppi/cppi-1.16.10-db9d-dirty/_build'
    GEN      lib/configmake.h
    GEN      lib/c++defs.h
    GEN      lib/warn-on-use.h
    GEN      lib/arg-nonnull.h
  mv -f lib/configmake.h-t lib/configmake.h
    GEN      src/localedir.h
    GEN      src/cpp.h
  /bin/sh: src/localedir.h-t: No such file or directory
  make[1]: *** [src/localedir.h] Error 1
  make[1]: *** Waiting for unfinished jobs....
  /bin/sh: line 15: src/cpp.h-tmp: No such file or directory
  make[1]: *** [src/cpp.h] Error 1
  make[1]: Leaving directory `/h/j/w/co/cppi/cppi-1.16.10-db9d-dirty/_build'
  make: *** [distcheck] Error 1

In a non-srcdir build, there was no src/ directory.
Now, each of the three rules that create a "built source" file
must ensure that the containing directory exists.

This change (part of the recursive-to-non-recursive make switch)
seems like it should be handled by ./configure or maybe via bootstrap...
Some time before "make" is run.  Otherwise, the fix is not scalable:
it's too easy to forget to insert the "mkdir -p src" command in a new
rule, and thus not to discover the problem until too late, via some
hard-to-reproduce parallel build failure.

For now, I've pushed this, but the above should be
enough of a prod to make me fix it properly, later...

>From 7b88e3eddab191a54f8a56a7bcea0c97aac0c161 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 14 Apr 2012 16:54:05 +0200
Subject: [PATCH 1/5] build: mkdir -p src/ as needed

Now that configure does not guarantee creation of src/
in a non-srcdir build, we must do it manually.
* src/local.mk (src/localedir, src/cppi.c, src/cpp.h): Create src/
before trying to create files within that directory.
---
 src/local.mk |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/local.mk b/src/local.mk
index bda9be5..e3701a9 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -37,6 +37,7 @@ BUILT_SOURCES += src/localedir.h
 DISTCLEANFILES += src/localedir.h
 src/localedir.h: src/local.mk
        $(AM_V_GEN)rm -f address@hidden
+       $(AM_V_at)mkdir -p src
        $(AM_V_at)echo '#define LOCALEDIR "$(localedir)"' >address@hidden
        $(AM_V_at)chmod a-w address@hidden
        $(AM_V_at)cmp address@hidden $@ > /dev/null 2>&1 && rm -f 
address@hidden \
@@ -57,12 +58,14 @@ AM_LFLAGS = $(flex_debug) $(flex_optimize) $(flex_8_bit)
 # I prefer to make generated .c files unwritable.
 src/cppi.c: src/cppi.l
        $(AM_V_GEN)rm -f $@
+       $(AM_V_at)mkdir -p src
        $(AM_V_at)$(LEXCOMPILE) $(top_srcdir)/src/cppi.l
        $(AM_V_at)chmod a-w $(LEX_OUTPUT_ROOT).c
        $(AM_V_at)mv $(LEX_OUTPUT_ROOT).c $@

 src/cpp.h: src/cpp.gp src/local.mk
        $(AM_V_GEN)rm -f address@hidden $@
+       $(AM_V_at)mkdir -p src
        $(AM_V_at)(                                                     \
         echo '/* This file is generated automatically from cpp.gp.  */'; \
         echo;                                                          \
--
1.7.10.130.g36e6c


>From 0cb5f14997305adc2afb30f1a477448e6c0bf42a Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 14 Apr 2012 16:55:36 +0200
Subject: [PATCH 2/5] build: remove lex.backup, not src/lex.backup

* src/local.mk (CLEANFILES): Remove lex.backup here, not
via DISTCLEANFILES.  Also, now it's lex.backup, not src/lex.backup,
since now we run flex from the top level directory, and not from src/.
---
 src/local.mk |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/local.mk b/src/local.mk
index e3701a9..19e71ba 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -13,7 +13,8 @@ EXTRA_DIST +=         \
   src/cpp-cond.c

 MAINTAINERCLEANFILES += src/cpp-cond.c
-DISTCLEANFILES += src/cpp.h src/lex.backup
+CLEANFILES += lex.backup
+DISTCLEANFILES += src/cpp.h

 GPERF = gperf

--
1.7.10.130.g36e6c


>From 3bd63a1308144b44c0b256de6e5e182b8ba0c341 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 14 Apr 2012 17:05:09 +0200
Subject: [PATCH 3/5] build: remove now-obsolete dist-hook dependency

Before the conversion to non-recursive make, we had to require
that dist-hook build src/cppi in order to generate man pages.
Now, with full dependencies, that kludge is not needed.
* src/local.mk (dist-hook): Remove now-unnecessary dependency.
---
 src/local.mk |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/local.mk b/src/local.mk
index 19e71ba..e9fe933 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -86,10 +86,4 @@ src/cpp.h: src/cpp.gp src/local.mk
        $(AM_V_at)chmod -w address@hidden
        $(AM_V_at)mv address@hidden $@

-# This is required because we have broken inter-directory dependencies:
-# in order to generate all man pages, require that cppi be built at
-# distribution time.
-dist-hook: src/cppi
-.PHONY: dist-hook
-
 BUILT_SOURCES += src/cpp-cond.c src/cpp.h
--
1.7.10.130.g36e6c


>From 84f71268fe9ee1e22db4e54c7d148977aec6ce98 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 14 Apr 2012 17:32:42 +0200
Subject: [PATCH 4/5] tests: correct test-disabling built_programs setting

* dist-check.mk (built_programs): Don't presume that there is a
Makefile in src/.  Now the one we want is in the top-level directory.
I.e., drop the "-C src", and filter out the new "src/" prefix.
---
 dist-check.mk |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dist-check.mk b/dist-check.mk
index 79cc23f..8c63705 100644
--- a/dist-check.mk
+++ b/dist-check.mk
@@ -11,8 +11,8 @@ pfx=$(t)/i

 built_programs =                                               \
   $$(echo 'spy:;@echo $$(PROGRAMS)'                            \
-    | MAKEFLAGS= $(MAKE) -s -C src -f Makefile -f - spy                \
-    | fmt -1 | sed 's,$(EXEEXT)$$,,' | sort -u)
+    | MAKEFLAGS= $(MAKE) -s -f Makefile -f - spy               \
+    | fmt -1 | sed 's,src/,,;s,$(EXEEXT)$$,,' | sort -u)

 # More than once, tainted build and source directory names would
 # have caused at least one "make check" test to apply "chmod 700"
--
1.7.10.130.g36e6c


>From a58c786befbf99d9633a1b53add2b684d51b7082 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 14 Apr 2012 18:43:12 +0200
Subject: [PATCH 5/5] build: use "-t" (not "-tmp") as temporary file suffix

* src/local.mk: Use -t consistently, not -tmp.
---
 src/local.mk |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/local.mk b/src/local.mk
index e9fe933..05527da 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -26,12 +26,12 @@ GPERF_OPTIONS = \
   -C -N cpp_cond_lookup -n -t -s 6 -k '*' --language=ANSI-C

 src/cpp-cond.c: src/cpp.gp
-       $(AM_V_GEN)rm -f $@ address@hidden
+       $(AM_V_GEN)rm -f $@ address@hidden
        $(AM_V_at)$(GPERF) $(GPERF_OPTIONS) $< \
          | perl -ne '/__GNUC_STDC_INLINE__/ and print "static\n"; print' \
-         > address@hidden
-       $(AM_V_at)chmod a-w address@hidden
-       $(AM_V_at)mv address@hidden $@
+         > address@hidden
+       $(AM_V_at)chmod a-w address@hidden
+       $(AM_V_at)mv address@hidden $@

 localedir = $(datadir)/locale
 BUILT_SOURCES += src/localedir.h
@@ -65,7 +65,7 @@ src/cppi.c: src/cppi.l
        $(AM_V_at)mv $(LEX_OUTPUT_ROOT).c $@

 src/cpp.h: src/cpp.gp src/local.mk
-       $(AM_V_GEN)rm -f address@hidden $@
+       $(AM_V_GEN)rm -f address@hidden $@
        $(AM_V_at)mkdir -p src
        $(AM_V_at)(                                                     \
         echo '/* This file is generated automatically from cpp.gp.  */'; \
@@ -82,8 +82,8 @@ src/cpp.h: src/cpp.gp src/local.mk
         echo '  ""';                                                   \
         echo '};';                                                     \
        )                                                               \
-         > address@hidden
-       $(AM_V_at)chmod -w address@hidden
-       $(AM_V_at)mv address@hidden $@
+         > address@hidden
+       $(AM_V_at)chmod -w address@hidden
+       $(AM_V_at)mv address@hidden $@

 BUILT_SOURCES += src/cpp-cond.c src/cpp.h
--
1.7.10.130.g36e6c



reply via email to

[Prev in Thread] Current Thread [Next in Thread]