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



_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make

Reply via email to