Hallo all,
I need to compile and link a Fortran program. The source code is in folder SRC, the object files will be put in folder OBJ, and I have files common.h and common_array.f containing the declarations of the common variables. I put them in folder INC. The makefile I'm using is as follows:
***************************************************************
export libraryX = -L/usr/X11R6/lib64 -lX11 -lm
compilerF = ifort
export compilerF
MAKE = /usr/bin/make
# Intel MKL Library Options
export LMKLDIR = /Library/Frameworks/Intel_MKL.framework/Versions/10.0.3.020/lib/em64t
export LMKL = -L$(LMKLDIR) -lmkl_lapack -lmkl_intel_lp64 -lmkl_solver_lp64 -lmkl_core -lguide -lmkl_intel_thread
#automatically defined
export pfad = $(shell pwd)
export pfadSrc = $(pfad)/SRC
export pfadObj = $(pfad)/OBJ
export pfadInc = $(pfad)/INC
#targets
all:
@./tarclean.scr
@echo '============= compiling ============='
@cd $(pfadSrc); $(MAKE) -f Makefile all
@echo '============= compiling done =============='
clean:
@./tarclean.scr
@echo '========= removing object files ========='
@cd $(pfadSrc); $(MAKE) -f Makefile clean
@echo '================== done ================='
***************************************************************
Then, in the folder SRC I have the following makefile:
***************************************************************
#specify directories
dirSrcF = Main \
Folder_1 Folder_2 Folder_3
srcF = $(foreach dir,$(dirSrcF),$(wildcard $(dir)/*.f))
objF := $(addprefix $(pfadObj)/, $(srcF:.f=.o))
#rules suffixes
.SUFFIXES: .f
$(pfadObj)/%.o: %.f
@echo '*** compiling object-code with dependency $<'
@$(compilerF) $(OPTF) -I$(pfadInc) -c $< -o $@
# @chmod 640 $@
#targets
all: $(objF)
@echo '----> linking'
#order of commands is important
@$(compilerF) $(OPTL) $(objF) -o prog $(LMKL)
@chmod 700 prog
@mv -f prof ..
clean:
rm -f ${pfadObj}/*/*.o
rm -f ${pfadObj}/*/*/*.o
***************************************************************
When I compile, I get the following error:
fortcom: Error: Main/Main_mp.f, line 17: Error in opening the compiled module file. Check INCLUDE paths. [COMMON_ARRAY]
and compilation aborts.
Could anyone suggest me what's wrong?
Thanks a lot in advance!
I need to compile and link a Fortran program. The source code is in folder SRC, the object files will be put in folder OBJ, and I have files common.h and common_array.f containing the declarations of the common variables. I put them in folder INC. The makefile I'm using is as follows:
***************************************************************
export libraryX = -L/usr/X11R6/lib64 -lX11 -lm
compilerF = ifort
export compilerF
MAKE = /usr/bin/make
# Intel MKL Library Options
export LMKLDIR = /Library/Frameworks/Intel_MKL.framework/Versions/10.0.3.020/lib/em64t
export LMKL = -L$(LMKLDIR) -lmkl_lapack -lmkl_intel_lp64 -lmkl_solver_lp64 -lmkl_core -lguide -lmkl_intel_thread
#automatically defined
export pfad = $(shell pwd)
export pfadSrc = $(pfad)/SRC
export pfadObj = $(pfad)/OBJ
export pfadInc = $(pfad)/INC
#targets
all:
@./tarclean.scr
@echo '============= compiling ============='
@cd $(pfadSrc); $(MAKE) -f Makefile all
@echo '============= compiling done =============='
clean:
@./tarclean.scr
@echo '========= removing object files ========='
@cd $(pfadSrc); $(MAKE) -f Makefile clean
@echo '================== done ================='
***************************************************************
Then, in the folder SRC I have the following makefile:
***************************************************************
#specify directories
dirSrcF = Main \
Folder_1 Folder_2 Folder_3
srcF = $(foreach dir,$(dirSrcF),$(wildcard $(dir)/*.f))
objF := $(addprefix $(pfadObj)/, $(srcF:.f=.o))
#rules suffixes
.SUFFIXES: .f
$(pfadObj)/%.o: %.f
@echo '*** compiling object-code with dependency $<'
@$(compilerF) $(OPTF) -I$(pfadInc) -c $< -o $@
# @chmod 640 $@
#targets
all: $(objF)
@echo '----> linking'
#order of commands is important
@$(compilerF) $(OPTL) $(objF) -o prog $(LMKL)
@chmod 700 prog
@mv -f prof ..
clean:
rm -f ${pfadObj}/*/*.o
rm -f ${pfadObj}/*/*/*.o
***************************************************************
When I compile, I get the following error:
fortcom: Error: Main/Main_mp.f, line 17: Error in opening the compiled module file. Check INCLUDE paths. [COMMON_ARRAY]
and compilation aborts.
Could anyone suggest me what's wrong?
Thanks a lot in advance!