Wireshark-dev: Re: [Wireshark-dev] Undefined reference to proto_tree_model_new

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 12 Jun 2012 19:28:32 -0700
On Jun 12, 2012, at 7:11 PM, Evan Huus wrote:

> On Tue, Jun 12, 2012 at 9:57 PM, Guy Harris <guy@xxxxxxxxxxxx> wrote:
>> 
>> On Jun 12, 2012, at 6:05 PM, Evan Huus wrote:
>> 
>>> I've just started getting a build failure (on linking) in the last
>>> couple of days, even after a make distclean on the whole tree:
>> 
>> When all else fails, "make maintainer-clean"/"./autogen.sh"/"./configure" is your friend.  I haven't seen that problem, but I haven't done an update since before Jakub checked in the new protocol tree model code; perhaps this is a consequence of that.
> 
> That worked, thanks.
> 
> For future reference, what does maintainer-clean do that dist-clean doesn't?

A short and probably not 100% accurate summary, but probably good enough for most purposes:

	"make clean" deletes stuff created by the build process.

	"make distclean" deletes stuff created by the build process *and* the ./configure process, leaving behind only the stuff that would be in the distribution tarball.

	"make maintainer-clean" deletes everything that's not "part of the source", including stuff generated by "make dist".

What the automake manual:

	http://www.gnu.org/software/automake/manual/automake.html

says is:

	As the GNU Standards aren't always explicit as to which files should be removed by which rule, we've adopted a heuristic that we believe was first formulated by François Pinard:

		* If make built it, and it is commonly something that one would want to rebuild (for instance, a .o file), then mostlyclean should delete it.
		* Otherwise, if make built it, then clean should delete it.
		* If configure built it, then distclean should delete it.
		* If the maintainer built it (for instance, a .info file), then maintainer-clean should delete it. However maintainer-clean should not delete anything that needs to exist in order to run ‘./configure && make’.

	We recommend that you follow this same set of heuristics in your Makefile.am.

The GNU standards in the automake manual say:

	‘clean’
		Delete all files in the current directory that are normally created by building the program. Also delete files in other directories if they are created by this makefile. However, don’t delete the files that record the configuration. Also preserve files that could be made by building, but normally aren’t because the distribution comes with them. There is no need to delete parent directories that were created with ‘mkdir -p’, since they could have existed anyway.

		Delete ‘.dvi’ files here if they are not part of the distribution.

	‘distclean’
		Delete all files in the current directory (or created by this makefile) that are created by configuring or building the program. If you have unpacked the source and built the program without creating any other files, ‘make distclean’ should leave only the files that were in the distribution. However, there is no need to delete parent directories that were created with ‘mkdir -p’, since they could have existed anyway.

	‘mostlyclean’
		Like ‘clean’, but may refrain from deleting a few files that people normally don’t want to recompile. For example, the ‘mostlyclean’ target for GCC does not delete ‘libgcc.a’, because recompiling it is rarely necessary and takes a lot of time.

	‘maintainer-clean’
		Delete almost everything that can be reconstructed with this Makefile. This typically includes everything deleted by distclean, plus more: C source files produced by Bison, tags tables, Info files, and so on.

		The reason we say “almost everything” is that running the command ‘make maintainer-clean’ should not delete ‘configure’ even if ‘configure’ can be remade using a rule in the Makefile. More generally, ‘make maintainer-clean’ should not delete anything that needs to exist in order to run ‘configure’ and then begin to build the program. Also, there is no need to delete parent directories that were created with ‘mkdir -p’, since they could have existed anyway. These are the only exceptions; maintainer-clean should delete everything else that can be rebuilt.

		The ‘maintainer-clean’ target is intended to be used by a maintainer of the package, not by ordinary users. You may need special tools to reconstruct some of the files that ‘make maintainer-clean’ deletes. Since these files are normally included in the distribution, we don’t take care to make them easy to reconstruct. If you find you need to unpack the full distribution again, don’t blame us.

		To help make users aware of this, the commands for the special maintainer-clean target should start with these two:

		@echo 'This command is intended for maintainers to use; it'
		@echo 'deletes files that may need special tools to rebuild.'

In this context, I'd say anybody doing builds from SVN or git counts as a "maintainer", as to do a built from a vanilla SVN or git tree needs all the special tools in question.