简体   繁体   中英

makefile .mod compilation rule

I'm modifying makefile of a code. After compiling, I see that some *.mod files are generated. looking online, I figured out they are module files, but I don't see a compilation rule for them. I'm trying to change the directory in which these files are generated. I can change the rule for object files, but I can't find the rule that generates *.mod files.

Looking at the makefile, can someone advise me if a line in this file generates them or how to change their directory. Here is the makefile:

   # GNU Makefile

   # Paths
   SDIR=./solver
   ODIR=./obj
   _CASE=./WorkCases/problem
   CASE=$(SDIR)/$(_CASE)
   TOP = .  

   FC      =       ifort

   FFLAGS          =       -fpp -O1 -DPTR_INTEGER8 -warn nousage

   # Define rule to make .f90
   $(ODIR)/%.o : $(SDIR)/%.f90 
    $(FC) -c $(FFLAGS) $< -o $@


   # set executable name
   EXEC = $(dir ${CASE})/$(basename $(notdir ${CASE})).out


   # shared global variables
   _SHARED_OBJ =    shared_modules.o main_vars.o debug_vars.o
   SHARED_OBJ = $(patsubst %,$(ODIR)/%,$(_SHARED_OBJ))

   OBJ     =  ${_SHARED_OBJ} $(_CASE).PARAMS.o 
   OBJ = $(patsubst %,$(SDIR)/%,$(_OBJ))

   MAIN_OBJ = $(ODIR)/main.o


   main : ${SHARED_OBJ} $(OBJ) $(MAIN_OBJ) 
    $(FC) ${FFLAGS} $(OBJ) $(MAIN_OBJ) -o $(EXEC) -lstdc++ -shared-intel

You can specify the destination directory for the .mod files by using the -module compiler option.

-module <directory> 

See the ifort documentation here :

You can use the module path compiler option to specify the directory in which to create the module files. If you do not use this option, module files are created in the current directory.

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