Problem with make

Conor P. Cahill cpcahil at virtech.UUCP
Sat Sep 30 21:53:08 AEST 1989


In article <1989Sep29.164831.26616 at wash08.uucp>, rae98 at 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     |
+-----------------------------------------------------------------------+



More information about the Comp.unix.questions mailing list