Search code examples
makefileg77

The Make and Shell Command Option in g77


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)

Solution

  • 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.