Re: Make



s pastiman wrote:
I am trying to make a makefile that would prompt a user for input and
then use it in a sub make. i.e.

user_dir:
echo "Enter id: \c"
read UserId
echo "UserId: ${UserId}"
cd sage_ini ; make install UserName=$(UserId); )


I am trying to get it so that the Makefile will read input (UserId)
and be able to pass it along to the next make. This method currently
does not work. Any one know how to do this?

surinder@khyber:~/ws/make> more user.sh
#!/bin/sh

FILE=Makefile.usr
touch $FILE

echo "userdirs:" > $FILE
while [ 1 -eq 1 ]
do
echo "enter username (type end to exit)"
read username
if [ "$username" = "end" ] ; then
break;
fi
echo -e "\tmake -C $username" >> $FILE
done

if [ "$username" = "end" ] ; then
break;
fi
echo -e "\tmake -C $username" >> $FILE
done
---------
surinder@khyber:~/ws/make> ./user.sh
enter username (type end to exit)
go
enter username (type end to exit)
green
enter username (type end to exit)
miles
enter username (type end to exit)
end
surinder@khyber:~/ws/make> more Makefile.usr
userdirs:
make -C go
make -C green
make -C miles

surinder@khyber:~/ws/make> make -C go
make: Entering directory `/home/surinder/ws/make/go'
echo "in user makefile"
in user makefile
make: Leaving directory `/home/surinder/ws/make/go'

In
Makefile
---
.... other stuff
build-userdirs:
make -f Makefile.usr

---------

- Surinder

--
Posted via a free Usenet account from http://www.teranews.com

.



Relevant Pages

  • Re: simple question
    ... while read first rest; do ... # This contains the username who invoked the script ... echo "The given file $FILE does not exists" ...
    (comp.unix.programmer)
  • Re: Make
    ... echo "UserId: $" ... echo "enter username (type end to exit)" ...
    (comp.unix.questions)
  • Re: simple problem
    ... I have written the script like this: ... echo "The given file $FILE does not exists" ... while read USERNAME REST ...
    (comp.unix.questions)
  • Re: User creation script
    ... This script create users with temporary ... be able to do newuser {username}. ... HELP_ME=2 # exit status if person used the help switch ... echo "Too many parameters!" ...
    (Fedora)
  • Session ID problem
    ... echo 'error passing UserID'; ... UserID is empty and I've the error message on the form. ...
    (comp.lang.php)