I'm using MacBook M1 and Following is the make file for the Fortran code:
# This is the Make file for the 1D McCormack Code.
# To find paths to libraries:
# sudo update-alternatives --list liblapack.so3
# sudo update-alternatives --list libblas.so3
# or
# whereis blas
# whereis lapack
vpath %.f90 src
FC = gfortran
FFLAGS = -g -fcheck=all -Wall -fbacktrace
#FFLAGS = O2
BIN = /Desktop/Research/bin
MOD = include
OBJ = obj
SRC = src
SOURCES = $(wildcard $(SRC)/*.f90
OBJECTS = vars.o idata.o grids.o mac1d_sch.o fieldinit.o coder.o postpr.o mac1d.o
MODULES = vars.mod idata.mod grids.mod mac1d_sch.mod fieldinit.mod coder.mod postpr.mod
.PHONY: clean, cleano
# Add path to all files in OBJECTS. Note: no space after opening parenthesis!
OBJS = $(patsubst %.o, $(OBJ)/%.o, $(OBJECTS) )
print-% : ; @echo $* = $($*)
$(BIN)/MAC1D: $(MODULES) $(OBJECTS)
$(FC) $(FFLAGS) $(OBJS) -o $(BIN)/MAC1D
#-L/usr/lib/lapack:/usr/lib/libblas -llapack -lblas
#WAVE: $(MODULES) $(OBJECTS)
# gfortran -O2 $(OBJECTS) -o WAVE
%.o: %.f90
$(FC) -I$(MOD) -c $(FFLAGS) $<
mv *.o obj
%.mod: %.f90
$(FC) -J$(MOD) -c $(FFLAGS) $<
clean:
rm -f $(OBJ)/*.o $(MOD)/*.mod $(BIN)/MAC1D
cleano:
rm -f $(OBJ)/*.o
I'm getting the error:
ld: can't open output file for writing: /Desktop/Research/bin/MAC1D, errno=2 for architecture arm64
collect2: error: ld returned 1 exit status
I can also share the Directories if needed.