tags:

views:

57

answers:

1

What do the make and shell option mean in g77? For example, if I have the following script in my Makefile:

FC = g77
FFLAGS = -O2 -mno-cygwin
LDFLAGS =
CD = cd
LN = ln
LNFLAGS = -s
MAKE = /bin/make
RM = rm
RMFLAGS = -f
SHELL = /bin/sh

Does this mean that make operation needs to make use of /bin/make.exe?

On a side note: when I run the compilation, using the above command line, I got an error:

/bin/sh: line 4: Making: command not found

Not sure whether the two are related.

Edit: This is my Makfile:

arpacklib:
    @( \
    for f in $(DIRS); \
    do \
        $(CD) $$f; \
        $(ECHO) Making lib in $$f; \
        $(MAKE) $(PRECISIONS); \
        $(CD) ..; \
    done );
    $(RANLIB) $(ARPACKLIB)
+1  A: 

These are just variables holding the location of programs on your computer. There will probably be rules like $(SHELL) a_shell_script.sh using these variables. The FC, CD, LN and RM are similar, they just don't have the path explicitly listed. Having programs as variables makes it simple to change them, for example if you want to use a different version.

Your error looks like the shell is trying to run the command Making. A possible cause is there is an undefined variable in front of this, eg a rule

all:
    $(ECHO) Making something

which would expand to Making something when run instead of echo Making something. Without seeing the relevant line that's the best I can think of.

Scott Wales
Question updated. In the light of your answer I can *guess* why I was getting the error. But any idea on how to fix the above `$(ECHO)` line?
Ngu Soon Hui
Simply define `ECHO = echo` with the other variables.
Scott Wales
What do you mean?
Ngu Soon Hui
Add that line to the list of variables from your first example in your makefile, eg after `SHELL = /bin/sh`.
Scott Wales
Amazing; thank you for your answer!
Ngu Soon Hui