-
Notifications
You must be signed in to change notification settings - Fork 131
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
Build system improvements #322
Build system improvements #322
Conversation
* cice.make can be used to easily call make with the different targets present in the Makefile (db_files, db_flags, clean), or to pass different flags to make * makdep is listed as a prerequisite of the *.d files, such that we don't need to call make makdep separately in cice.build
The -I flag is used by Fortran compilers to locate files included via the "#include" preprocessor directive or the "include" statement, or modules referenced via the "use" statement. In our codebase we only use modules, and all modules files (*.mod) are put in the ${ICE_OBJDIR} directory, where the compilation takes place. So there is no need for all source directories (contained in the variable $(INCS), prefixed with -I) to be added to the build rules. This shortens the length of the displayed compilation lines.
I think a bunch of these changes are good. I think the biggest question for me is the creation of the cice.make script. I think the main downsides is that it adds another script to the case directory (where I think less is generally better) and it seems to duplicate part of the cice.build script which creates extra maintenance issues. So, this leads to a few questions. Would it be possible for cice.build to be modified so it would support "cice.build target". In other words, could the cice.make features be built right into the cice.build script. Next, if we decide to keep the cice.make around, would it make more sense for the cice.build to call it, thereby reducing redundant code. Finally, if we feel giving users direct access to clean and other make targets is helpful, should we consider taking a bigger step which would be to have cice.build refactored, even getting rid of it all together and ending up with "make clean" or "make cice" as the way to build the model? I think my preference at this point is to see if cice.build can take an optional argument and get things working that way. Is that reasonable and do any of my comments make sense? |
Yes, what you say is reasonable and does make sense, thanks for your comments. I did not want to change things to much and that is why I created a new script. Here are my thoughts:
I think it would be possible, but would complicate a little bit the logic of cice.build:
I think all of these are feasible.
I think that is a good idea if we go that way.
From what I understand about how Make works with VPATH and all that I don't think it would work easily since the Makefile is in ICE_CASEDIR but the model is built in ICE_OBJDIR... and we would still need to call make with the parameters EXEC, VPFILE, MACFILE, as done in cice.build... I think having a wrapper script that is easy to call, as we have now, is a better way. What do you think? I will update this PR depending on what we decide. |
Thanks @phil-blain, several good points. I think my preference would be to try to modify cice.build if we can make that work well and clean. I propose the following interfaces cice.build [--exe binary] [target] Lets leave --exe as a hidden feature. It's really used just for testing at this point. target is optional and the script should do what it does now if left unset. Lets check that --exe and target are not set together. Otherwise, if target is set, what we should do is just set the env as needed then execute the gmake command with the target. There should be no interaction with README.case or other fluff. The targets are dependent what's in the Makefile, and that may not be easy to access. Is it possible to add a target in the makefile that indicates the possible targets? Like cice.build targets would return cice.build support the following targets: cice, db_files, db_flags, clean, targets I think we should do something with the "all" target in the Makefile. Can we add a "cice" target that is the same thing and make that the first target? Is "all" something that we really need/want in the Makefile to conform? I'm not a make expert. Finally, I think if someone does cice.build cice it should build the model fine without going thru the extra fluff. While cice.build goes thru the extra fluff. Does that make sense? Thoughts? |
Yes, I think that this design would work well.
|
@phil-blain , sounds like your plate is full at the moment. Would you be OK if I took a crack at some of these changes if I get a chance? If so, I could branch off your branch and PR back to your branch keeping this PR alive. Does that sound reasonable? If you prefer to take this on yourself, that's OK too. Either way is fine. |
Yes I do have a lot of stuff at the moment. If you have a chance to work on this, go ahead. |
Just FYI. I have been working on this the last couple days and should have a PR soon. I will include the #283 issue in the documentation. |
Improvements to the build system, add cice.make script
Developer(s): Philippe Blain
Please suggest code Pull Request reviewers in the column at right. @apcraig
Are the code changes bit for bit, different at roundoff level, or more substantial?
BFB (only scripts are touched)
Please include the link to test results or paste the summary block from the bottom of the testing output below.
-
Does this PR create or have dependencies on Icepack or any other models?
No. I can issue a similar PR for Icepack if you agree with these changes.
Is the documentation being updated with this PR? (Y/N) Yes
If not, does the documentation need to be updated separately at a later time? (Y/N)
Note: "Documentation" includes information on the wiki and .rst files in doc/source/,
which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/.