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

Re: debian/rules not running ./configure



On Sat, Oct 25, 2003 at 04:38:42PM +1000, Zenaan Harkness wrote:
> I'm trying to create my first package, and don't know what to do to get
> debian/rules to run ./configure. Eg:

Assuming you used dh_make, debian/rules contains a configure and
configure-stamp target.

You want to stick ./configure into the configure-stamp target, then
touch configure-stamp.

I think you need to bone up on the general workings of Makefiles though.
[See below..]

> We see that the fastdep package's config/config.me file is not being
> created. When I manually run ./configure, this file is created. But then
> dpkg-buildpackage doesn't seem to run make. Is the line
> 
> 	$(MAKE)
> 
> in the example rules file supposed to run the 'make' command?

Absolutely. $(MAKE) is a variable set by make that is usually just the
argv[0] of what you typed on the command line. Hence, because
debian/rules uses /usr/bin/make -f, it will be GNU make in this case.

> I am not that familiar with make. Perhaps a little ironic since I'm
> packaging fastdep, but I am also teaching myself some C++, and since I
> come from years of Java background, I miss having a simple
> hierarchical-directory build process that readily scales to large
> projects.

OK, maybe you already know this, but I'm feeling verbose tonight...

The general idea of Makefiles is that they are, at their simplest, a
set of small shell scripts or general rules that tell how to generate a
certain file. Make determines whether this file has to be regenerated
based on the target's dependencies. Take for example:

foo: foo.o bar.o
	gcc foo.o bar.o -o foo

%.o: %.c
	gcc -o $@ -c $<
	
foo.o: foo.c foo.h
bar.o: bar.c foo.h

This tells make a number of things. Firstly, that the command for the
'foo' target will be run if foo.o OR bar.o change, because they are
dependencies. foo.o will be reuilt if foo.c or foo.h changes. And a
general rule for generating .o files from .c files is defined by running
gcc on them, where $@ is the output target name and $< is the input
name.

This small concept is useful, for example, when you change - or simply
update the timestamp of - foo.h. This means that even if foo.o and bar.o
exist, because foo.h is NEWER in date than foo.o, foo.o must be rebuilt
using the new foo.h, and then foo.o will be more recent than the .h
file. But if you say "make foo.o" after that, make will say it's up to
date because it's newer than all its dependencies and will save time for
you.

In Debian, this all works out. We usually run debian/rules build, which
is a target that depends on build-stamp, where that depends on source
configuration and making, after which it will touch build-stamp to say
"Hey, I'm all done, no more extra work is needed here."

And the commands inside each target are simply lines of text that are
run by the shell line by line.

I hope maybe this can help you with your debian/rules wrangling with
regards to running configure.

Also watch out for the warnings that dpkg-source is giving you. Those
look rather ominous.

-- 
Joshua Kwan

Attachment: pgpXs5MJcR7No.pgp
Description: PGP signature


Reply to: