I am writing a package based on some Fortran code using the instructions at
https://www.avrahamadler.com/2018/12/09/the-need-for-speed-part-1-building-an-r-package-with-fortran/
My package builds with the following Makevars
file and I can call it successfully from R.
Now I am trying to debug it using the GNU debugger gdb
. I wrote a f90
wrapper to replace the C
wrapper hotnetc.c
, but I need to create a suitable Makefile
based on this Makevars
(I will use mingw32-make
. What do I need to change/add to the below file?
I am working in VSCODE
following the instructions at
https://www.youtube.com/watch?v=XuNjA230e3k
I was able to get make and debug working in Windows following his example,
Thanks!
# https://gcc.gnu.org/onlinedocs/gcc-4.3.6/gfortran/Preprocessing-and-conditional-compilation.html
PKG_FCFLAGS += -x f95-cpp-input
C_OBJS = hotnetc.o
FT_OBJS = nrtype.o ioinfo.o exit_hotnet.o empdis.o model_time.o
FT_OBJS += simul_info.o basinparam.o basin_flux.o soilxs_bas.o hotnetf.o
all: $(SHLIB) clean
$(SHLIB): $(FT_OBJS) $(C_OBJS)
empdis.o: nrtype.o
basin_flux.o model_time.o simul_info.o: nrtype.o
basinparams.o: empdis.o
soilxs_bas.o: model_time.o basinparams.o basin_flux.o simul_info.o
hotnetf.o: soilxs_bas.o
hotnetmodule.mod: hotnetf.o
hotnetc.o: hotnetmodule.mod
clean:
rm -rf *.mod *.o
Update:
The Makefile here seems to work work:
https://stackoverflow.com/questions/5871780/creating-a-fortran-makefile