-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple the Makefile from the SOILWAT2 file structure #483
Comments
To elaborate on the externed variables issue, we will need to move the declaration of the following variables: From ST_main.c to ST_globals.h:
Technically we only need to move SuperGlobals and Globals, but while we're at it we might as well move the rest of them for the sake of clean code. From sxw.c to sxw.h:
As a side effect of moving SXW to sxw.h the file sxw_vars.h will be rendered completely useless. It should probably be removed. |
Re:
--> The SOILWAT2 makefile accounts for this issue because the output needs are so different for SOILWAT2-standalone, rSOILWAT2, and STEPWAT2: the makefile accepts
so for STEPWAT2, this could then be adjusted to something like
|
@dschlaep Thanks for the help! This should make the implementation very easy for the person that implements it. |
…LWAT2 - address #483 - contribute to DrylandEcology/SOILWAT2#89 --> the subfolder path of SOILWAT2 occurs now consistently on the STEPWAT2 side: 1) makefile variable "path_sw2" 2) in the include header directives (see previous commit) --> if SOILWAT2 changes its file organization, then search/replace of "sw_src" with the new value can now be done Other changes: - since CC is hard-coded to gcc, I defined CXX to g++ so that compilation occurs only within compiler families (and not potentially across, e.g., in case CXX would be defined as clang++) - helper targets to run STEPWAT2 executable in example folder, i.e., `bint_testing_nongridded` and `bint_testing_gridded`, also compiled unit tests, but never run the unit tests --> removed dependency on unit test target --> added a separate make target "run_tests" which compiles and runs the STEPWAT2 unit tests Note: The warning "SW_Main_lib.c:56:6: warning: no previous prototype for function 'usage' [-Wmissing-prototypes]" is fixed with SOILWAT2 commit a44e5688e7799c44b72b017a724ee7ee857531cc (dev-branch enhance_petfunc)
Use SOILWAT2's makefile to compile a SOILWAT2 library Addressing issue #483 and contribute to DrylandEcology/SOILWAT2#89
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
SXW
andSuperGlobals
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
andSW_Output_outarray.c
. These must be added to thesources_lib
variable in the SOILWAT2 makefile.The text was updated successfully, but these errors were encountered: