Ethereal-dev: Re: [Ethereal-dev] Comments on Makefiles

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 26 Feb 2001 16:01:55 -0800 (PST)
> The current makefiles break badly under solaris:

There aren't any current Makefiles; there are only current Makefile.am
files.

If you do a "make dist" (which requires that you do a "cvs update" to
get the fix I just checked into "epan/dfilter/Makefile.am"), it produces
as part of the tarball, a "Makefile.in" that lacks the

> %.o: %.c
>         @echo '$(COMPILE) -c $<'; \
>         $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
>         @-cp .deps/$(*F).pp .deps/$(*F).P; \
>         tr ' ' '\012' < .deps/$(*F).pp \
>           | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>             >> .deps/$(*F).P; \
>         rm .deps/$(*F).pp
> 
> %.lo: %.c
>         @echo '$(LTCOMPILE) -c $<'; \
>         $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
>         @-sed -e 's/^\([^:]*\)\.o[      ]*:/\1.lo \1.o :/' \
>           < .deps/$(*F).pp > .deps/$(*F).P; \
>         tr ' ' '\012' < .deps/$(*F).pp \
>           | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>             >> .deps/$(*F).P; \
>         rm -f .deps/$(*F).pp

stuff.  That tarball configured and built OK with Sun "make".

If, however, you're working from the CVS tree, automake produces
"Makefile.in" files that require GNU "make" - and also might require
GCC; that's a characteristic of automake, not of Ethereal, and would
have to be fixed by the automake folks.

See

	http://sources.redhat.com/automake/automake.html#Dependencies

which says:

	Automatic dependency tracking

	As a developer it is often painful to continually update the
	Makefile.in whenever the include-file dependencies change in a
	project.  Automake supplies a way to automatically track
	dependency changes, and distribute the dependencies in the
	generated Makefile.in.

	Currently this support requires the use of GNU make and gcc.  It
	might become possible in the future to supply a different
	dependency generating program, if there is enough demand.  In
	the meantime, this mode is enabled by default if any C program
	or library is defined in the current directory, so you may get a
	"Must be a separator" error from non-GNU make.

	When you decide to make a distribution, the dist target will
	re-run automake with --include-deps and other options.  See
	[Invoking Automake], and See [Options].  This will cause the
	previously generated dependencies to be inserted into the
	generated Makefile.in, and thus into the distribution.  This
	step also turns off inclusion of the dependency generation code,
	so that those who download your distribution but don't use GNU
	make and gcc will not get errors.

The CVS tree works fine with Solaris - if you use GNU "make" and GCC,
rather than the native "make" and the Sun C compiler.

The same applies to the main OS I use at home, if you replace "Solaris"
with "FreeBSD" and leave out the references to the C compiler (as
FreeBSD uses GCC as its native C compiler), so I get bit by this one,
too.

It might be possible for you to change your copy of "autogen.sh" to
invoke "automake" in such a fashion as to cause it to generate
distribution-style rather than developer-style "Makefile.in" files; I
would not suggest that we adopt those changes in our "autogen.sh",
however, as that would mean that people who *do* have GNU "make" and GCC
wouldn't get automatic dependency handling (unless their OS and compiler
have other mechanisms for doing that *and* make private changes to
automake to use that capability - "private changes" because those
changes, e.g. ".KEEP_STATE", would at best not help on other platforms
and would at worst break builds on other platforms), and I, at least,
want automatic dependency handling, as failure to recompile if headers
change has been the source of many hard-to-find software failures with
which I've had to deal.

I think I may have seen something that implies that automake will, in a
future release, work better with non-GNU "make"s, but I don't remember
the details.

> For now, to build under Solaris, I'm just manually hacking the makefiles,
> but this probably needs to be fixed before the next release.

Nope.  The next release will have different "Makefile.in" files from the
ones that get generated for developers, so the fact that you need GNU
"make", and may need GCC, when building from the CVS tree doesn't mean
that you'll need them if you build the 0.8.16 or 0.9.0 or whatever
tarball.