I need to be able to run several recipe lines within the same shell. I know that I can string all the commands together in a single line - but I have a quite complex recipe for the target, so being to execute the entire recipe in a single shell is quite attractive to me. The .ONESHELL: special target is supposed to do this - but I don't seem to be able to get it to work... am I missing something?

Here are some details:

------------------------------------------------------------------------------------------
$ cat Makefile
.ONESHELL:
doit:
        # see if it works!
        @echo list current directory
        ls -l
        @echo
        @echo change to the home directory and list it
        cd /home/jimw
        ls -l
        @echo
        @echo so where are we?
        pwd


------------------------------------------------------------------------------------------
This is what happens when I run make:

 $ make
# see if it works!
list current directory
ls -l
total 4
-rw-r--r--. 1 jimw jimw 188 Nov 11 17:15 Makefile

change to the home directory and list it
cd /home/jimw
ls -l
total 4
-rw-r--r--. 1 jimw jimw 188 Nov 11 17:15 Makefile

so where are we?
pwd

------------------------------------------------------------------------------------------
Some details about my system:

$ make -v
GNU Make 3.81
This program built for x86_64-unknown-linux-gnu


$ uname -a
Linux tlwst001 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
CentOS Linux release 6.0 (Final)
Kernel \r on an \m

$ echo $SHELL
/bin/bash

Any help will be greatly appreciated.



_______________________________________________
Help-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to