简体   繁体   中英

MakeFile error “/usr/bin/f77: Illegal option: -autodouble”

I have written a make file as following:

COMPFLAGS     = -O3 -autodouble  

CFLAGS        = $(COMPFLAGS)
PFLAGS        = $(COMPFLAGS)
FFLAGS        = $(COMPFLAGS)
CCFLAGS       = $(COMPFLAGS)
CXXFLAGS      = $(COMPFLAGS)

LD  =   ifort

LDFLAGS       = $(COMPFLAGS)

MAKEFILE      = Makefile

OBJS          = f1.o \
        f2.o \
        f3.o \

PROGRAM       = f1

all:        $(PROGRAM)

%.o:    %.f90
     @$(LD) $(COMPFLAGS) -c $<

$(PROGRAM):     $(OBJS)  $(MAKEFILE)

        @$(LD) $(LDFLAGS) $(OBJS)  -o $(PROGRAM)
        @echo "done"

clean:
        @rm -f $(OBJS) core

when I execute make I get the following error:

f77 -O3 -autodouble    -c -o f1.o f1.f
/usr/bin/f77: Illegal option: -autodouble
make: *** [f1.o] Error 255

I should note that there is no *.f file, all files are *.f90 .

Could you please advise me where I have made mistake?

Thanks a lot.

This looks unusual:

LD  =   ifort
...

%.o:    %.f90
     @$(LD) $(COMPFLAGS) -c $<

LD is the linker, not the compiler. Perhaps something like:

CC = ifort
...

%.o: %.f90
     @$(CC) -std=f90 $(COMPFLAGS) -c $<

You might also need the -x option to tell the machinery is Fortran 90 and not something to be preprocessed:

%.o: %.f90
     @$(CC) -x f90 -std=f90 $(COMPFLAGS) -c $<

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM