help-make
[Top][All Lists]
Advanced

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

The .ONESHELL: special target does not appear to work


From: Jim Walls
Subject: The .ONESHELL: special target does not appear to work
Date: Fri, 11 Nov 2011 17:31:58 +1300
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:7.0) Gecko/20110922 Thunderbird/7.0

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.





reply via email to

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