dumb question

Mark LaPierre marklapier at aol.com
Thu Jan 5 02:00:20 UTC 2012


On 01/04/2012 02:19 AM, Paul Allen Newell wrote:
> To the list:
>
> I am dealing with a primary Fedora machine and a alternate WinXP under
> cygwin. Cygwin always screw up the permissions when I drag stuff over to
> it and then bring it back to the Fedora box. I've got scripts to handle
> making things right again.
>
> But I did have a question which I didn't find out from Googling (as I
> suspect I didn't know how to phrase it). On a Fedora/Linux box, do
> Makefile/makefile (s) have to be set to +x? Or can they be just
> "rw-r--r--"?
>
> Thanks in advance,
> Paul

Hey Paul,

If you want a file to be executable it must be +x.  If the file is read 
as input to another program it needs not be +x.

Example 1:

You have a +x shell script file named "Hello" that contains the 
following lines.

[user at machine]$ cat Hello
#! /bin/bash
#
echo "Hello World"
[user at machine]$

To execute this file do this:

[user at machine]$ ./Hello
Hello World
[user at machine]$

This works because the first line tells the shell what program to use to 
interpret the contents of the file.  In this case the shell launches 
/bin/bash and passes the rest of the file as input to the /bin/bash 
process.  /bin/bash makes sense of the lines and produces the output.

Example 2:

If your -x file named "Hello" lacked the first line:

[user at machine]$ cat Hello
#
echo "Hello World"
[user at machine]$

To make /bin/bash do its thing you would have to do this:

[user at machine]$ /bin/bash Hello
Hello World
[user at machine]$

The shell would launch /bin/bash and then /bin/bash would read and 
execute the lines inside the file.  The Hello file its self would not be 
executed.  /bin/bash would be executed and the Hello file would be read 
as input to the /bin/bash program.

Now, to be specific to your question, the same principle applies.  Your 
-x Makefile/makefile is not an executable file.  It contains a list of 
instructions the /usr/bin/make executable interprets.  The executable is 
/usr/bin/make.  To make /usr/bin/make do its thing do this:

[user at machine]$ /usr/bin/make
Make output appears here
[user at machine]$

You do not have to supply the name of the makefile, as long its name is 
makefile, because /usr/bin/make defaults to that file name.  If you 
changed the name of makefile to mybuildfile then you would have to do this:

[user at machine]$ /usr/bin/make mybuildfile
Make output appears here
[user at machine]$

The makefile is not being executed but /usr/bin/make is executed and it 
is using the contents of the makefile as input to guide its processing.


-- 
    °v°
   /(_)\
    ^ ^  Mark LaPierre
Registerd Linux user No #267004
www.counter.li.org


More information about the users mailing list