Unix Programming - Automake: dist-hook uninstall

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2007 > Automake: dist-hook uninstall





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Automake: dist-hook uninstall
Andrew Smith

2007-12-07, 1:38 am

Hello

I have this in my Makefile.am:

dist-hook:
if test -d pixmaps; then \
mkdir $(distdir)/pixmaps; \
for pixmap in pixmaps/*; do \
if test -f $$pixmap; then \
cp -p $$pixmap $(distdir)/pixmaps; \
fi \
done \
fi

And it works fine, except when I do 'make uninstall' the icon doesn't
get deleted. Everything else gets deleted properly.

I don't have much experience with the autotools, so I am probably not
doing something really straightforward. Please help.

Andrew
diksa2005@fastermail.com

2007-12-07, 1:38 am

On Dec 7, 5:14 am, Andrew Smith <n...@whe.re> wrote:
> Hello
>
> I have this in my Makefile.am:
>
> dist-hook:
> if test -d pixmaps; then \
> mkdir $(distdir)/pixmaps; \
> for pixmap in pixmaps/*; do \
> if test -f $$pixmap; then \
> cp -p $$pixmap $(distdir)/pixmaps; \
> fi \
> done \
> fi
>
> And it works fine, except when I do 'make uninstall' the icon doesn't
> get deleted. Everything else gets deleted properly.
>
> I don't have much experience with the autotools, so I am probably not
> doing something really straightforward. Please help.
>
> Andrew



Hi
I love the way you are trying in your programming work and i really
want you to use this opportunity to introduce yourself to an online
company where you can get instant assistance in all ways with this
extend you have gone. There you meet alots of programmers in all
fields of knowlegde applying for jobs by signing up free of charge,i
expected you to join them because i saw so many you are far better
than collecting contract project on daily basis. Here's the site,
http://www.getafreelancer.com/affil...essage-sms.html

William Pursell

2007-12-09, 1:25 pm

On 7 Dec, 05:14, Andrew Smith <n...@whe.re> wrote:
> Hello
>
> I have this in my Makefile.am:
>
> dist-hook:
> if test -d pixmaps; then \
> mkdir $(distdir)/pixmaps; \
> for pixmap in pixmaps/*; do \
> if test -f $$pixmap; then \
> cp -p $$pixmap $(distdir)/pixmaps; \
> fi \
> done \
> fi
>
> And it works fine, except when I do 'make uninstall' the icon doesn't
> get deleted. Everything else gets deleted properly.
>
> I don't have much experience with the autotools, so I am probably not
> doing something really straightforward. Please help.



You can avoid using a dist-hook and get that file
to be installed by putting the following in Makefile.am:

pixdir = $(datadir)/pixmaps
pix_DATA = pixmaps/icon

($datadir, by default is, $prefix/share)

This is slightly less flexible in that you can't
specify "pixaps/*", but you can do something like:

pix_DATA = $(shell ls ${srcdir}/pixmaps | sed 's@^@${srcdir}/pixmaps/
@')

I would highly recommend against doing that. Let
me emphasize highly. I'm not sure why I even
mention it here, it is so heinous.
A much better solution would be to generate the
list at configure time with the following in
configure.ac:

PIXMAP_LIST=${srcdir}/pixmaps/*
AC_SUBST([PIXMAP_LIST])


and then in Makefile.am:
pix_DATA = @PIXMAP_LIST@


William Pursell

2007-12-09, 7:21 pm

On 7 Dec, 05:14, Andrew Smith <n...@whe.re> wrote:

> dist-hook:
> if test -d pixmaps; then \
> mkdir $(distdir)/pixmaps; \
> for pixmap in pixmaps/*; do \
> if test -f $$pixmap; then \
> cp -p $$pixmap $(distdir)/pixmaps; \
> fi \
> done \
> fi
>
> And it works fine, except when I do 'make uninstall' the icon doesn't
> get deleted. Everything else gets deleted properly.
>

It just occurred to me that I missed a significant
point in my previous post. I read your 'make uninstall'
and thought you'd written 'install-hook' instead
of 'dist-hook'. What exactly do you think
the make uninstall should do here? 'make dist'
will create a distribution tarball, and your
dist-hook would seem to be better served by
EXTRA_DIST = @file_list@
where file_list is an AC_SUBST'ed list of files
in the pixmaps directory. In other words, dist-hook
will effect the created tar ball, while
make uninstall works on the /usr/local ($prefix)
file system.

(Also, I omitted the EXTRA_DIST in my previous post.
You will need that to get the pixmaps files into
the distribution tarball.)

Make sure you use 'make distcheck' to ensure that
everything is okay.
Andrew Smith

2007-12-17, 1:42 am

William Pursell a écrit :
> On 7 Dec, 05:14, Andrew Smith <n...@whe.re> wrote:
>
>
> You can avoid using a dist-hook and get that file
> to be installed by putting the following in Makefile.am:
>
> pixdir = $(datadir)/pixmaps
> pix_DATA = pixmaps/icon
>
> ($datadir, by default is, $prefix/share)
>
> This is slightly less flexible in that you can't
> specify "pixaps/*", but you can do something like:
>
> pix_DATA = $(shell ls ${srcdir}/pixmaps | sed 's@^@${srcdir}/pixmaps/
> @')
>
> I would highly recommend against doing that. Let
> me emphasize highly. I'm not sure why I even
> mention it here, it is so heinous.
> A much better solution would be to generate the
> list at configure time with the following in
> configure.ac:
>
> PIXMAP_LIST=${srcdir}/pixmaps/*
> AC_SUBST([PIXMAP_LIST])
>
>
> and then in Makefile.am:
> pix_DATA = @PIXMAP_LIST@
>
>


Thanks William, that worked!

I don't know why dist-hook was being used. I didn't write the autotools
files for this project.

So I removed the dist-hook and instead added:

pixdir = $(datadir)/pixmaps
pix_DATA = pixmaps/asunder.png

EXTRA_DIST = asunder.desktop pixmaps/asunder.png

I don't know why, but it works. I kind of gave up on understanding the
autotools

Thnaks again.

Cheers,

Andrew
William Pursell

2007-12-17, 7:22 pm

On Dec 17, 3:42 am, Andrew Smith <n...@whe.re> wrote:

> pixdir = $(datadir)/pixmaps
> pix_DATA = pixmaps/asunder.png
>
> EXTRA_DIST = asunder.desktop pixmaps/asunder.png
>
> I don't know why, but it works. I kind of gave up on understanding the
> autotools


It takes awhile to grok, but once you get a feel for it,
it's really not so bad.

The EXTRA_DIST line just tells automake to construct
the Makefile so that the listed files are included
in the distribution tarball. The pix_DATA line
tells it that the listed files are to be installed
in pixdir. Without the EXTRA_DIST, make will
attempt to create the pix_DATA files, and
probably fail because there will be no rule
to use.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com