automagic

I found out a thing today that I think a lot of GNOME packages do wrong: Do not put (generated) headers into foo_SOURCES. Changes to these files will not cause a rebuild of files that include them. Put the headers into noinst_HEADERS instead.

Case study: This Makefile.am will not rebuild anything when swfdec_test_function_list.h changes, this one will.

5 comments ↓

#1 S.F. on 01.08.08 at 12:57

and what if you need to install such headers ? (like many do with dbus-glib headers)

#2 Rob Staudinger on 01.08.08 at 18:07

Not sure you are interpreting the effects you are seeing correctly. Are you aware that thereĀ“s a mutual dependency between the generated header and the sources that (probably) include it?

#3 otte on 01.08.08 at 18:55

S.F.: If you need to install them, you put them in foo_HEADERS.

Rob: No, there’s no mutual dependency. The generated headers depend on the source files. The generated object files depend on the source files and the generated header files. So you want to regenerate the object files whenever you regenerate the headers. And that’s what putting the headers in foo_SOURCES does not do.

#4 Rob on 01.09.08 at 08:49

Sorry, my statement was misleading. Anyways, it seems to be gone.
Look at this line:
swfdec_test_function_list.h: $(swfdec_test_sources)
Your generated header doesn’t depend on the stuff it is generated from, but rather on the files that include it. That may very well be the problem, because the header is not regenerated when the sources change, so there is no reason to rebuild the files that include it.

#5 nazgul on 01.09.08 at 23:45

Benjamin, please consider making this a GnomeGoal if it affects modules across GNOME!