On 2012-01-20 05:12 +0900, Miles Bader wrote: > Stefano Lattarini <stefano.lattar...@gmail.com> writes: > > Still, things are not as easy as it would appear from your sample project. > > For example, with this rule: > > > > $(CC) -c $(CFLAGS) -DIM_STUUPD=1 $< > > > > you are losing some important features offered by automake -- most > > notably, the automatic dependency tracking and the configurable verbosity > > specification (silent-rules). Which might be OK in some circumstances, > > but unacceptable in others. > > Actually, although I provided my own compilation rule, the default rule > works too, if the user considers that acceptable (compiler flags the > same etc). You need at least one "automake-controlled" source-file of > the same type (.c etc) for automake to generate it, but that's probably > a safe bet for most projects. :) > > Since the default rule generates the dependency information into > $(DEPDIR)/*.Po as Makefile fragments, one need only figure out some > appropriate way to include fragments into the Makefile for the "extra" > source files. > > What automake does for source files it knows about is just "include > $(DEPDIR)/srcfile.Po" (apparently "include" is considered portable > make?).
It's not considered portable make. Automake's dependency tracking requires a mechanism to include makefile fragments to work, but this is not required to build the package. The lines generated by Automake look something like this: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/foo.Po@am__quote@ Note all the configure-substituted variables there. In particular, if configure cannot figure out how to make dependency tracking work, then it will disable it. In that case, @AMDEP_TRUE@ will be substituted with a # and the line will be ignored by make. > The include directive apparently understands wildcards, but is > a little tricky to use in the same way, because it fails for > non-existant files (automake arranges to make sure the .Po files always > exist by just sticking in code to explicitly create them all over the > place, which is probably too annoying for this sort of user case). Interestingly, if you actually stick a line exactly like the above into your Makefile.am, Automake will actually do "The Right Thing™" and creates the .Po stub as if you had actually specified the source file normally. Presumably you'd be relying on totally unsupported internal behaviour of Automake in this case, though. :) Cheers, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)