Path: utzoo!attcan!uunet!virtech!cpcahil
From: cpcahil@virtech.UUCP (Conor P. Cahill)
Newsgroups: comp.unix.questions
Subject: Re: Problem with make
Keywords: make for sysV
Message-ID: <1212@virtech.UUCP>
Date: 30 Sep 89 11:53:08 GMT
References: <715@bbking.KSP.Unisys.COM> <11169@smoke.BRL.MIL> <1989Sep29.164831.26616@wash08.uucp>
Organization: Virtual Technologies Inc
Lines: 43

In article <1989Sep29.164831.26616@wash08.uucp>, rae98@wash08.uucp (Robert A. Earl) writes:
> Can you read in a variable for use in the makefile?
> i.e.:
> read a;echo $(a)

sort of.  You can read in a shell variable, but not a makefile variable.  The
mechanism is something like the following:

target:
	echo "enter system name: \c"; \
	read sysname; \
	echo "sysname is $$sysname"

Note that each line ends with a line continuation '\' so that make passes all 
three lines to the same shell.

> Alternatively, can you pass args through make to be used in the makefile?
> What I really want to do is:
> 
> make tar (system_name)
> and have the makefile generate a tar file and send it to system_name.

How about:

	make tar sys=uunet

and in the makefile:

	tar:
		/* stuff to generate file */
		if [ -z "$(sys)" ]; then \
			echo "No sys specified, file not transferred.";\
		else \
			echo "transferring file to $(sys)"; \
			uucp tarfile $(sys)!tarfile; \
		fi


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+