automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUILT_SOURCES doesn't seem to work


From: Stepan Kasal
Subject: Re: BUILT_SOURCES doesn't seem to work
Date: Mon, 5 May 2008 14:58:59 +0200
User-agent: Mutt/1.5.17 (2007-11-01)

Hello Bobby,
  a few comments:

On Sat, May 03, 2008 at 11:38:08PM -0700, Bobby Dill wrote:
> When I try to compile my app, I get a message stating that sigcreatedlg.h
> does not exist, so the files in BUILT_SOURCES are not generated before the
> rest of my app is compiled. What's the right way to do this?

BUILT_SOURCES is just a list of targets which get built at the
beginning of target "all" (and a few other targets).

This means that it has no influence if you call "make pkgmaker".
You have to call "make all".

See also this for deatils about built sources:
http://www.gnu.org/software/automake/manual/html_node/Built-sources-example.html

> pkgmaker/Makefile.am:12: `%'-style pattern rules are a GNU make extension
> How do I modernize these rules?

Well, it's actually the opposite of "modernization".

Automake does produce portable makefiles, which work with many
implementations of make, not only with GNU make.
That's why it does not use %-rules.  The rules get copied to the
resulting Makefile, but Automake does not understand them.

So, to make your Makefile.am more portable, using the fact that
Automake can support new extensions (.ui) once you define how to
build an object file from them (in this case, indirectly, through
.cpp), you can do this:

.ui.h:
        $(UIC) -o $@ $<
.ui.cpp:
        $(UIC) -o $@ -impl $*.h $<
bin_PROGRAMS = pkgmaker
pkgmaker_SOURCES = pkgmaker.cpp sigcreatedlg.ui
# Create this before "make all"
BUILT_SOURCES = sigcreatedlg.h
# we cannot rely that UIC is available on the customer's machine:
EXTRA_DIST = sigcreatedlg.h sigcreatedlg.cpp

> pkgmaker_SOURCES = pkgmaker.cpp $(pkgmaker_UI)
> BUILT_SOURCES = $(pkgmaker_UI)
...
> CLEANFILES = $(BUILT_SOURCES)

These two are contradictory:
If files $(pkgmaker_UI) are in pkgmaker_SOURCES, then they are
distributed, so they will be included in the tarball.
But then they should not be in CLEANFILES nor in DISTCLEANFILES,
since "make clean" or "make distclean" shouldn't usually clean files
originating from the tarball.

The question is: can you suppose that $(UIC) is available on each
machine where you want to unpack and build the tarball?
If not, then you need the EXTRA_DIST as in my examle above.
If yes, then that EXTRA_DIST should probably be changed to
CLEANFILES.

> INCLUDES= $(all_includes)

This can be modernized:
s/INCLUDES/AM_CPPFLAGS/

Hope these notes are helpful,
        Stepan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]