Support Makefile generation with src/configure.py
#487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for automatically generating Makefiles for the analysis tools (
gamer_compare_data,gamer_extract_profile,gamer_extract_uniform) alongside the main GAMER Makefile. It introduces a new command-line argument--toolsforsrc/configure.pyto enable this feature and refactors the tool Makefiles to use template variables, allowing them to be filled in with the correct build options during configuration.Rationale
These changes make it easier to keep the analysis tools' build configurations in sync with the main codebase and simplify the process of configuring and building the tools for different environments. And this also helps the regression test module.
Changes
Tool Makefile generation
--toolsargument to the configuration script (src/configure.py) to optionally generate Makefiles for analysis tools.src/configure.pyto process a list of analysis tool paths, read their Makefile templates, replace template variables with actual configuration values, and write the finalized Makefiles.Makefile template refactoring
MakefiletoMakefile_basefor each analysis tool and replaced hardcoded build options and paths with template variables (e.g.,@@@SIMU_OPTION@@@,@@@CXX@@@,@@@CXXFLAG@@@,@@@HDF5_PATH@@@,@@@MPI_PATH@@@). This allows these values to be set dynamically during configuration.Usage
Run
cd src && python3 configure.py --tools=true [other options]to use this feature.Backward compatibility
--toolsis default tofalseandconfigure.pyworks the exactly the same as before when--toolsis not given.Tests
gamer_compare_datagamer_extract_profilegamer_extract_uniformDiscussion
--tools=truecan be simplified as given--toolsalong. Or we make it be able to choice the tools to configure and maybe configure the tool only without alternating the Makefile of the main GAMER code. But is this necessary for now?falsefor--toolsnow. And we can make the default value configurable with feature from Add Default Machine Setting #383. This feature can be combined with the first point above to allow more flexible choice for users to their working scenario.