bug-automake
[Top][All Lists]
Advanced

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

bug#9578: make uninstall fails after make install-data in empty prefix.


From: Nick Bowler
Subject: bug#9578: make uninstall fails after make install-data in empty prefix.
Date: Thu, 22 Sep 2011 14:42:59 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hello,

I noticed a problem testing the uninstall target of my
automake-generated Makefiles.  If the install prefix does not exist
before installation, automake will create the necessary directories.
But if you run a plain "make install-data" (without make install-exec),
the directories for executables are (unsurprisingly) not created.  The
problem is that "make uninstall" fails in this case:

  % ./configure --prefix=/tmp/does_not_exist
  % make install-data
  % make uninstall
   ( cd '/tmp/does_not_exist/bin' && rm -f foo )
  /bin/sh: line 6: cd: /tmp/does_not_exist/bin: No such file or directory
  make: *** [uninstall-binPROGRAMS] Error 1

and the installed data files are not deleted.  For reference, here's the
generated uninstall-binPROGRAMS target:

  uninstall-binPROGRAMS:
        @$(NORMAL_UNINSTALL)
        @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
        files=`for p in $$list; do echo "$$p"; done | \
          sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
              -e 's/$$/$(EXEEXT)/' `; \
        test -n "$$list" || exit 0; \
        echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
        cd "$(DESTDIR)$(bindir)" && rm -f $$files

Manually adding a - before the second command corrects the issue and the
data is successfully uninstalled.

A similar problem occurs with "make install-exec" followed by "make
uninstall", although this is somewhat less severe because GNU make will
successfully uninstall the executables before failing when it gets to
the data.  I'm using autoconf-2.68 and automake-1.11.1; the problem also
occurs with latest git automake at the time of writing.  The above was
reproduced with the following:

% cat >Makefile.am <<'EOF'
bin_PROGRAMS = foo
data_DATA = bar
EOF

% cat >configure.ac <<'EOF'
AC_INIT([test], [1.0])

AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
EOF

% cat >foo.c <<'EOF'
int main(void) { return 0; }
EOF

% cat >bar <<'EOF'
baz
EOF

Cheers,
-- 
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)





reply via email to

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