Package Build Check fail due to Fortran Makevars dependencies

I am trying to compile some Fortran code with a C wrapper inside an R package, using this approach:

https://www.avrahamadler.com/2018/12/09/the-need-for-speed-part-1-building-an-r-package-with-fortran/

I am having trouble with the module dependencies. Here is my Makevars.

PKG_FCFLAGS += -x f95-cpp-input -fdefault-real-8 

C_OBJS = topnetc.o
FT_OBJS = nrtype.o empdis.o model_time.o simul_info.o basinparams.o basin_flux.o soilxs_bas.o topnetf.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 
topnetf.o: soilxs_bas.o 
topnetmodule.mod: topnetf.o
topnetc.o: topnetmodule.mod

clean:
      rm -rf *.mod *.o

The RStudio Check is compiling nrtype and basin_flux successfully but then trying to compile basinparams, which needs empdis.

* installing *source* package 'TOPNET' ...
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  nrtype.f90 -o nrtype.o
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  basin_flux.f90 -o basin_flux.o
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  basinparam.f90 -o basinparam.o
basinparam.f90:3.5:

USE empdis                                         ! empirical probability distribution structure (PRBDIS)
     1
Fatal Error: Can't open module file 'empdis.mod' for reading at (1): No such file or directory
make: *** [C:/Users/WOODWA~1/DOCUME~1/R/R-36~1.3/etc/i386/Makeconf:236: basinparam.o] Error 1
ERROR: compilation failed for package 'TOPNET'
* removing 'C:/Users/WOODWA~1/ONEDRI~1/TOPNET~1/TOPNET~1/TOPNET~1.RCH/TOPNET'

Do you know how I fix this?

Cheers

Edit: It only seems to fail in Check, the package actually does Build. I think this is a bug in RStudio/R package checker.