help-make
[Top][All Lists]
Advanced

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

how to get pipes working


From: PATTON, BILLY \(SBCSI\)
Subject: how to get pipes working
Date: Wed, 17 May 2006 14:19:09 -0500

Here is a sample of code I have working in a shell script and it works
find.
#!/usr/bin/ksh

x=x.o
y=y.o
nm $x | grep "main.*extern|entry.*CODE" > /dev/null
if [ $? -eq 0 ] ; then
  echo "found main in $x" ;
else
  echo "$x does not have a main" ;
fi
nm $y | grep "main.*extern|entry.*CODE" > /dev/null
if [ $? -ne 0 ] ; then
  echo "$y does not have a main" ;
else
  echo "found main in $y" ;
fi

x.o does contain the main and y.o does not.  It give the correct
responses

Now when I put it into my makefile

##
## add a file to a archive
##
AR_ADD = $(NM) $$< | grep "main.*extern|entry.*CODE" > /dev/null ; \
        if [ $$? -ne 0 ] ; then $(AR) $(AR_OPT) $$(LIB) $$@ > /dev/null
; fi

I get :
... ; /usr/bin/nm $< | grep "main.*extern|entry.*CODE" > /dev/nu\
ll ; if [ $? -ne 0 ] ; then ar rv $(LIB) $@ > /dev/null ; fi
/bin/sh: Syntax error at line 1 : `|' is not expected.

I know it wasn't in the ... It worked fine until I put the $(AR_ADD)
with the other commands




reply via email to

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