[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stdint generation
From: |
Ralf Wildenhues |
Subject: |
Re: stdint generation |
Date: |
Sat, 27 Oct 2007 21:00:26 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hello Bruno,
* Bruno Haible wrote on Mon, Oct 15, 2007 at 09:19:01PM CEST:
> Sam Steingold wrote:
> > gnulib/gnulib/m4/stdint offers a multi-line sed rule for generating
> > stdint.h from stdint_.h,
> > why do I need to maintain the sed command by hand?
> > why can't this be done by config.status?
[...]
> Regarding gnulib itself: Modules in gnulib are made of source code in lib/,
> autoconf macros in m4/, and Makefile.am rules in modules/$module. We do the
> split between what goes into m4/stdint_h.m4 and what goes into modules/stdint
> by considering what is most natural. Creating files is most conveniently done
> in a Makefile, not in config.status. (Because config.status is not invoked
> when doing "make clean", "make dist" or similar, and because expressing file
> names in config.status is harder, since config.status is usually in a
> different
> directory than the files being built.)
IMVHO it is not harder, but it can make your life simpler: If you would
instead generate files by config.status, you would not have to keep the
list of substitutions in modules/stdint (and others) up to date. So
from
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
stdint.h: stdint.in.h
rm -f address@hidden $@
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \
[...lots of lines...]
-e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \
< $(srcdir)/stdint.in.h; \
} > address@hidden
mv address@hidden $@
MOSTLYCLEANFILES += stdint.h stdint.h-t
you'd go to:
# We need the following in order to create <stdint.h> when the system
# doesn't have one that works with the given compiler.
stdint.h: stdint.in.h
cd $(top_builddir) && ./config.status
'--file=$(subdir)/$@:$(abs_srcdir)/stdint.in.h'
MOSTLYCLEANFILES += stdint.h
and then the first line of stdint.in.h could read
/* @configure_input@ */
which, when substituted, will sound a bit less harsh than your current
warning; if you want to keep the exact warning, then I guess nothing
keeps you from
AC_SUBST([gnulib_configure_input],
[DO NOT EDIT! GENERATED AUTOMATICALLY!])
Note that, this way, the rebuild semantics have not changed at all:
stdint.h is not listed in AC_CONFIG_FILES, it does not get created at
./config.status
time. The only consequence would be less typing in modules/stdint, and
a bit slower build (because config.status would be executed for each
replacement header).
Of course, generation at the end of `configure' could be a further step:
use
AC_CONFIG_FILES([$sourcebase/stdint.h])
and add $(top_builddir)/config.status to the list of dependencies of the
above rule. This would only be telling the truth: the dependency exists
already now, in current gnulib, however it's not spelled out, I assume
trading efficiency in the common case for reliable rebuilds.
If the AC_CONFIG_FILES step is done, the stdint.h rule can be simplified
to
cd $(top_builddir) && ./config.status $(subdir)/$@
If you like any of the two steps, I can prepare a patch for them.
Cheers,
Ralf
- stdint generation, Sam Steingold, 2007/10/15
- Re: stdint generation,
Ralf Wildenhues <=