Currently the STEPWAT2 makefile is tightly coupled to the file structure of SOILWAT2. there are 23 points of contact:
sw_src/filefuncs.c
sw_src/generic.c
sw_src/mymemory.c
sw_src/pcg/pcg_basic.c
sw_src/rands.c
sw_src/SW_Carbon.c
sw_src/SW_Control.c
sw_src/SW_Files.c
sw_src/SW_Flow.c
sw_src/SW_Flow_lib.c
sw_src/SW_Markov.c
sw_src/SW_Model.c
sw_src/SW_Output.c
sw_src/SW_Output_get_functions.c
sw_src/SW_Output_outarray.c
sw_src/SW_Output_outtext.c
sw_src/SW_Site.c
sw_src/SW_Sky.c
sw_src/SW_SoilWater.c
sw_src/SW_VegEstab.c
sw_src/SW_VegProd.c
sw_src/SW_Weather.c
sw_src/Times.c
If any one of these files is moved STEPWAT2 will not compile.
Solution
We can reduce the points of contact to 2:
sw_src/makefile
sw_src/libSOILWAT2.a
SOILWAT2's makefile has a rule to create a library file. As long as we know where the makefile and the library file are located the rest of SOILWAT2 can be abstracted away.
However, there are a few caveats. Variables can no longer be externed across the two codebases. This means variables like SXW and SuperGlobals must be declared in header files. This should be fairly easy to do.
Unfortunately, the other change must be done on the SOILWAT2 side. There are 2 source files that are currently not compiled into the SOILWAT2 library: SW_Output_outtext.c and SW_Output_outarray.c. These must be added to the sources_lib variable in the SOILWAT2 makefile.
Currently the STEPWAT2 makefile is tightly coupled to the file structure of SOILWAT2. there are 23 points of contact:
If any one of these files is moved STEPWAT2 will not compile.
Solution
We can reduce the points of contact to 2:
SOILWAT2's makefile has a rule to create a library file. As long as we know where the makefile and the library file are located the rest of SOILWAT2 can be abstracted away.
However, there are a few caveats. Variables can no longer be externed across the two codebases. This means variables like
SXWandSuperGlobalsmust be declared in header files. This should be fairly easy to do.Unfortunately, the other change must be done on the SOILWAT2 side. There are 2 source files that are currently not compiled into the SOILWAT2 library:
SW_Output_outtext.candSW_Output_outarray.c. These must be added to thesources_libvariable in the SOILWAT2 makefile.