You are not logged in.

#1 2010-02-27 01:20:03

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

[SOLVED] Disabling Error Output in a Makefile

To install an application called Yellowcot, typically I have used a Makefile with these lines,

install -m 755 yellowcot /usr/bin
rm -r /usr/share/yellowcot > /dev/null 2>&1
mkdir /usr/share/yellowcot
cp yellowcot.svg /usr/share/yellowcot/.
cp yellowcot.desktop /usr/share/applications/.

The "rm -r" line removes an old installation of the application, if possible. If it's not possible, it's supposed to suppress the error. However, I just tried installing the application on a new Arch setup and got this error,

[root@nikolai yellowcot-1.1.9]# make install
install -m 755 yellowcot /usr/bin
rm -r /usr/share/yellowcot > /dev/null 2>&1
make: *** [install] Error 1

When I took out the "rm -r" line, I didn't have a problem. So my question is, how can I disable error output in a Makefile? Piping it to /dev/null isn't working. Does anyone have any ideas? Thanks!

Last edited by tony5429 (2010-02-27 18:18:54)

Offline

#2 2010-02-27 01:28:07

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: [SOLVED] Disabling Error Output in a Makefile

try rm -r /usr/share/yellowcot &2>/dev/null

but why are you trying to remove the directory to begin with?


.:[My Blog] || [My GitHub]:.

Offline

#3 2010-02-27 10:20:39

PirateJonno
Forum Fellow
From: New Zealand
Registered: 2009-04-13
Posts: 372

Re: [SOLVED] Disabling Error Output in a Makefile

make is probably checking the return codes of the commands rather than seeing if anything goes to stderr. you could probably just do

if test -d /usr/share/yellowcot; then
rm -r /usr/share/yellowcot &>/dev/null
fi

might not work though, I usually use automake so I don't know what I am doing smile


"You can watch for your administrator to install the latest kernel with watch uname -r" - From the watch man page

Offline

#4 2010-02-27 18:18:29

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: [SOLVED] Disabling Error Output in a Makefile

Thanks! PirateJonno's suggestion worked! Ghost1227, the reason Makefile removes the directory if possible is to remove any previous installation (i.e. an old version of the software) before installing the new version. Thanks again!

Offline

#5 2010-02-28 16:04:19

cmtptr
Member
Registered: 2008-09-01
Posts: 135

Re: [SOLVED] Disabling Error Output in a Makefile

Couldn't you just...

rm -rf /usr/share/yellowcot

?

This doesn't really seem appropriate for "make install" to me, anyway.  Maybe instead you should advise your users to "make uninstall" on the previous version before installing this one?

Last edited by cmtptr (2010-02-28 16:08:48)

Offline

Board footer

Powered by FluxBB