bug-gnulib
[Top][All Lists]
Advanced

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

maint.mk vs. PRAGMA_SYSTEM_HEADER


From: Eric Blake
Subject: maint.mk vs. PRAGMA_SYSTEM_HEADER
Date: Thu, 7 Jan 2010 18:35:51 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

The master branch of m4.git currently inlines the makefile snippet for 
getopt.h, under the argument that getopt.h is only needed by the main 
executable and not by the various modules (I'm hoping to someday switch to 
using two separate gnulib-tool directories, one for modules and one for the 
main program, rather than using gnulib-tool only for the modules and continuing 
to manually extract the snippets for the main program, but that's an issue for 
another day).  And I'm in the process of migrating that branch to use gnulib's 
maintainer-makefile.

Unfortunately, Makefile.am is currently failing 'make syntax-check':

../Makefile.am:129:           -
e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
maint.mk: use $(...), not @...@
make: *** [sc_makefile_check] Error 1

This syntax is necessary, though.  PRAGMA_SYSTEM_HEADER is currently either 
empty, or equal to '#pragma GCC system_header', so if it is used as a Makefile 
macro, the leading # is treated as a comment and using $(PRAGMA_SYSTEM_HEADER) 
would mistakenly result in an empty substitution rather than the desired 
preprocessor directive.  Use of the @...@ syntax directly inside of a target 
rule is the only way to pass the # through.

One idea to fix this would be changing the include_next module to define 
PRAGMA_SYSTEM_HEADER as 'pragma GCC system_header' or 'define 
_GL_SYSTEM_HEADER_DUMMY', and changing all *.in.h that currently 
use '@PRAGMA_SYSTEM_HEADER@' to instead use 'address@hidden@', so that 
the '#' is no longer passed through the Makefile.  This would allow us to 
update the Makefile.am snippets to no longer fall foul of the @...@ rule.

The other idea is to note that sc_makefile_check already has one exception hard-
coded in, for coreutils' use of 'cu_install_program = @INSTALL_PROGRAM@'.  
Maybe maint.mk should just offer a hook, $(makefile_exceptions), that defaults 
to empty, but which coreutils' cfg.mk can set to "&& !/^cu_install_program =/" 
and which m4's cfg.mk can set to "&& !/PRAGMA_SYSTEM_HEADER/", such that 
sc_makefile_check starts out with:
        @perl -ne '/address@hidden@/$(makefile_exceptions)'     \


Preferences?

-- 
Eric Blake






reply via email to

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