[Top][All Lists]

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

Re: errno --> errno name ?

From: Bruno Haible
Subject: Re: errno --> errno name ?
Date: Sun, 14 Aug 2011 12:35:50 +0200
User-agent: KMail/1.13.6 (Linux/; KDE/4.6.0; x86_64; ; )

Hi Bruce,

> This time the tarball includes a module file of sorts.

Good, this is what gnulib needs.

> Makefile.am:
> GEN_ERRNO_FILES         = err-names.c err-names.h
> nodist_include_HEADERS += err-names.h

Does the .h file need to be generated? It is much more convenient to
rely on a .h file that is platform independent.
  1) The user can look at the .h file to see whether it fits his needs,
     and can start to program before doing "gnulib-tool --add-import ...;
     ./configure; make".
  2) The user doesn't need to wonder whether the .h file contains different
     function declarations on different platforms.

> err-names.c : err-names.h
>       @test -f $@ || CC="$(CC)" $(SHELL) mk-err-names.sh

You need the C compiler for preprocessing, right? Then you shouldn't
forget about $(CPPFLAGS) and $(AM_CPPFLAGS). So change

Also, the rule is not very robust and lacks dependencies: If one some
platform, the generation of the file fails, then you change mk-err-names.sh,
then retry "make", nothing will happen, because
  1. err-names.c does not depend on mk-err-names.sh,
  2. The "test -f $@ || ..." idiom will not rerun mk-err-names.sh.
I would recommend to use the well-tested idiom for generated files, like in
modules/unistd and many other places.

Also, the rule does not work in VPATH builds where $(srcdir) != ".".

> err-names.h : mk-err-names.sh $(EXE).c
>       CC="$(CC)" $(SHELL) mk-err-names.sh

$(EXE) is undefined.

In memoriam Maximilian Kolbe <http://en.wikipedia.org/wiki/Maximilian_Kolbe>

reply via email to

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