PhysiCell icon indicating copy to clipboard operation
PhysiCell copied to clipboard

Improvement: Makefile save command automatically adjusts PROJ := my_project

Open elmbeech opened this issue 11 months ago • 0 comments

In each Makefiel is the following command

PROJ := my_project

save: 
        echo "Saving project as $(PROJ) ... "
        mkdir -p ./user_projects
        mkdir -p ./user_projects/$(PROJ)
        mkdir -p ./user_projects/$(PROJ)/custom_modules
        mkdir -p ./user_projects/$(PROJ)/config 
        cp main.cpp ./user_projects/$(PROJ)
        cp Makefile ./user_projects/$(PROJ)
        cp VERSION.txt ./user_projects/$(PROJ)
        cp ./config/* ./user_projects/$(PROJ)/config
        cp ./custom_modules/* ./user_projects/$(PROJ)/custom_modules

if the following sed line would be added, then the PROJ := my_project would automatically be set to what ever name was choosen for saving.

e.g.:

make save PROJ

would not change the line at all.

e.g.:

make save PROJ=abc

would change the line to PROJ := abc

This is the sed line that would do the magic:

sed -i "0,/PROJ := /{s/PROJ := .*/PROJ := $(PROJ)/}" ./user_projects/$(PROJ)/Makefile

I added this line to the Makefiles of my PhysiCell user_projects, and it makes dealing with the projects much easier.

elmbeech avatar Mar 29 '24 17:03 elmbeech