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

Patch rule in debian/rules.



Hi all,

here is a mail explaining that many of our debian/rules files are
suboptimal. I will update our group policy and apply changes where
necessary. But do not hesitate to do it before I start ;)

Have a nice day,

-- Charles

----- Forwarded message from Russ Allbery <rra@debian.org> -----

Date: Sun, 14 Sep 2008 18:12:50 -0700
From: Russ Allbery <rra@debian.org>
To: debian-mentors@lists.debian.org
Subject: Re: Quilt and patches directory
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Michael Biebl <biebl@debian.org> writes:

> Could you give a real-world example when that can happen. I've always
> used the patch target (instead of $(QUILT_STAMPFN)) in my debian/rules
> files and so far haven't encountered any issues.
>
> Given that patch depends on $(QUILT_STAMPFN) I can't imagine a scenario
> where I would run into problems using the patch target.

windlord:~> cat rules
QUILT_STAMPFN = quilt-stamp

$(QUILT_STAMPFN):
        touch $@

patch: $(QUILT_STAMPFN)

build: build-stamp
build-stamp: patch
        @echo 'Running build'
        touch $@
windlord:~> make -f rules build
touch quilt-stamp
Running build
touch build-stamp
windlord:~> make -f rules build
Running build
touch build-stamp

Notice that the build was repeated even though nothing changed and the
stamp file already exists.  This is because patch is phony and will always
force any rule that depends on it to be rebuilt.  If you change this rules
file to depend on QUILT_STAMPFN instead:

windlord:~> cat rules 
QUILT_STAMPFN = quilt-stamp

$(QUILT_STAMPFN):
        touch $@

patch: $(QUILT_STAMPFN)

build: build-stamp
build-stamp: $(QUILT_STAMPFN)
        @echo 'Running build'
        touch $@
windlord:~> make -f rules build
touch quilt-stamp
Running build
touch build-stamp
windlord:~> make -f rules build
make: Nothing to be done for `build'.

dependency management works properly.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


-- 
To UNSUBSCRIBE, email to debian-mentors-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

----- End forwarded message -----

-- 
Charles Plessy
Debian Med packaging team,
Tsurumi, Kanagawa, Japan


Reply to: