[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Dependent Shell Commands
From: |
Steve |
Subject: |
Dependent Shell Commands |
Date: |
Sat, 28 Sep 2002 00:37:53 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 |
Hello
If this is a silly question then please forgive me, but I'm new to GNU Make.
My linux program needs to compile some hand-rolled fortune archives,
which seems simple enough, but I can't assume that the strfile command
for compiling fortune '.dat' files is going to be in the users $PATH.
For example, SuSE puts strfile in /usr/sbin, which isn't automatically
in $PATH.
At the moment I use this script in my Makefile, which is inelegant to
say the least!
DODATS=/usr/sbin/strfile
dotdat:
echo "Creating fortune '.dat' archive files..." ; \
for i in $(SRCS) ; do \
if ls `pwd` | grep "$$i.dat" > /dev/null 2>&1 ; then \
echo "$$i.dat exists!" ; \
else \
if ! `$(DODATS) -rs $$i 2>/dev/null` ; then \
if ! `strfile -rs $$i 2>/dev/null` ; then \
echo "" ; \
echo "Can't find 'strfile' command to
make fortune" ; \
echo "dat files. Do \"make
DODATS=/path/to/strfile\"" ;
echo "" ; \
exit 1 ; \
fi ; \
fi ; \
echo "Creating $$i.dat" ; \
fi ; \
done
Testing the command within a for loop sucks, but I can't seem to define
the command on the fly and then us it within the loop without getting an
error. So, my question is really this: how do I test for a shell command
and define it on the fly?
I am reading ther manual as I write this but can't seem to find any
relevant examples, though I'm sure they're there, somewhere...
Can someone please point me in the right direction. Thank you.
Steve
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Dependent Shell Commands,
Steve <=