Hi Bruno, * Bruno Haible wrote on Sat, Apr 02, 2011 at 06:50:57PM CEST: > So, for example, you would propose to change modules/byteswap from
[...] > But in that situation, when configuration decides that the system is > now good enough, the generated byteswap.h will stay on disk. "make" > will work fine, but garbage will stay in the working directory until the > next "make clean" - which may be a long time. Wouldn't it be better to > remove the byteswap.h file, and rely on the empty dummy rule in the *.Po > file? That is, I would propose to do > > > BUILT_SOURCES += $(BYTESWAP_H) > > # We need the following in order to create <byteswap.h> when the system > # doesn't have one. > if GNULIB_GENERATED_BYTESWAP_H > byteswap.h: byteswap.in.h > $(AM_V_GEN)rm -f $@-t $@ && \ > { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ > cat $(srcdir)/byteswap.in.h; \ > } > $@-t && \ > mv -f $@-t $@ > else > byteswap.h: > rm -f $@ > endif > MOSTLYCLEANFILES += byteswap.h byteswap.h-t That looks interesting. I would want to test it and play around with it before recommending it outright, though. Also, since it will be a hassle to change all the code, and change it again when you decide to use stamp files, I'd try to get that working before embarking upon any sweeping changes. But your preferences may be different here. Wrt. stamps, I'm thinking of something along these lines, modelled after how config.h is updated: ## Shouldn't this line have 'byteswap.h' unconditionally now? BUILT_SOURCES += $(BYTESWAP_H) # We need the following in order to create <byteswap.h> when the system # doesn't have one. if GNULIB_GENERATED_BYTESWAP_H byteswap.h: stamp-byteswap.h @if test ! -f $@; then rm -f stamp-byteswap.h; else :; fi ## Put the recursive make in a separate command so that 'make -n' works. @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-byteswap.h; else :; fi stamp-byteswap.h: $(top_builddir)/config.status byteswap.in.h $(AM_V_GEN)rm -f $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ cat $(srcdir)/byteswap.in.h; \ } > byteswap.h-t && \ if diff byteswap.h-t byteswap.h >/dev/null 2>&1; then \ rm -f byteswap.h-t; \ else \ mv -f byteswap.h-t byteswap.h; \ fi @echo timestamp > $@ else byteswap.h: rm -f $@ endif ## MOSTLYCLEAN or not? I'd say headers are more expensive than ## objects. CLEANFILES += stamp-byteswap.h byteswap.h byteswap.h-t But I haven't tested this yet (and won't get to it today). It is helpful to read automake/lib/am/remake-hdr.am. Cheers, Ralf