From 47692be94e8207dcd9d49eecbfdb8b61c7e530d8 Mon Sep 17 00:00:00 2001 From: Daniel Bergman Date: Fri, 7 Aug 2026 08:27:08 -0400 Subject: [PATCH] Generate header dependencies so header edits trigger a rebuild Every object rule names only its .cpp, so make never rebuilds an object when a header it includes changes. Editing a header and running make relinks the stale objects and reports success. That is merely confusing when the change is behavioural. It is dangerous when the header changes a type's layout: the objects that did get rebuilt disagree with the ones that did not about member offsets and sizeof, the link succeeds because mangled names encode types rather than layouts, and the result is a binary that reads fields at the wrong addresses. The crash looks like a bug in the code under test. -MMD makes the compiler emit a .d file beside each .o listing the headers that object actually included; -MP adds a dummy target for each so that deleting or renaming a header does not break the build. The .d files are read back in at the bottom of each Makefile, which is where they have to be: each one declares rules for its own .o, so including them earlier would replace `all` as the default goal. Applied to all 30 Makefiles, clean removes the generated .d files, and they are gitignored. unit_tests/cell_definition has no clean target, so it gets the flags and the include but nothing to extend. Co-Authored-By: Claude Opus 5 --- .gitignore | 3 +++ Makefile | 12 +++++++++++- sample_projects/Makefile-default | 12 +++++++++++- sample_projects/asymmetric_division/Makefile | 12 +++++++++++- sample_projects/biorobots/Makefile | 12 +++++++++++- sample_projects/cancer_biorobots/Makefile | 12 +++++++++++- sample_projects/cancer_immune/Makefile | 12 +++++++++++- sample_projects/celltypes3/Makefile | 12 +++++++++++- sample_projects/custom_division/Makefile | 12 +++++++++++- sample_projects/episode/Makefile | 12 +++++++++++- sample_projects/heterogeneity/Makefile | 12 +++++++++++- sample_projects/immune_function/Makefile | 12 +++++++++++- sample_projects/interactions/Makefile | 12 +++++++++++- sample_projects/mechano/Makefile | 12 +++++++++++- sample_projects/physimess/Makefile | 12 +++++++++++- sample_projects/pred_prey_farmer/Makefile | 12 +++++++++++- sample_projects/rules_sample/Makefile | 12 +++++++++++- sample_projects/template/Makefile | 12 +++++++++++- sample_projects/virus_macrophage/Makefile | 12 +++++++++++- sample_projects/worm/Makefile | 12 +++++++++++- .../boolean/cancer_invasion/Makefile | 12 +++++++++++- .../boolean/physiboss_cell_lines/Makefile | 12 +++++++++++- .../boolean/template_BM/Makefile | 12 +++++++++++- .../boolean/tutorial/Makefile | 12 +++++++++++- .../fba/cancer_metabolism/Makefile | 12 +++++++++++- .../fba/ecoli_acetic_switch/Makefile | 12 +++++++++++- .../ode/ode_energy/Makefile | 12 +++++++++++- tests/timing/Makefile | 12 +++++++++++- tests/unit/Makefile | 12 +++++++++++- unit_tests/cell_definition/Makefile | 11 ++++++++++- unit_tests/custom_DCs_2substrates/Makefile | 12 +++++++++++- unit_tests/custom_voxel_values/Makefile | 12 +++++++++++- .../Makefile-unit-test-conservation | 12 +++++++++++- 33 files changed, 354 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 320837027..677dab58a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,9 @@ Studio.zip /worm /*.exe +# generated header-dependency files (-MMD) +*.d + # boolean intracellular project executables /invasion_model /PhysiBoSS_Cell_Lines diff --git a/Makefile b/Makefile index 5d256d1c3..57433aa43 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -435,6 +440,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -560,3 +566,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/Makefile-default b/sample_projects/Makefile-default index 5d256d1c3..57433aa43 100644 --- a/sample_projects/Makefile-default +++ b/sample_projects/Makefile-default @@ -35,7 +35,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -435,6 +440,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -560,3 +566,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/asymmetric_division/Makefile b/sample_projects/asymmetric_division/Makefile index 6682b5c46..518a6eb54 100644 --- a/sample_projects/asymmetric_division/Makefile +++ b/sample_projects/asymmetric_division/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/biorobots/Makefile b/sample_projects/biorobots/Makefile index 26314225c..8f4510548 100644 --- a/sample_projects/biorobots/Makefile +++ b/sample_projects/biorobots/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/cancer_biorobots/Makefile b/sample_projects/cancer_biorobots/Makefile index b74f8837a..dad80482f 100644 --- a/sample_projects/cancer_biorobots/Makefile +++ b/sample_projects/cancer_biorobots/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/cancer_immune/Makefile b/sample_projects/cancer_immune/Makefile index 5cbb2ca8f..39c5964ac 100644 --- a/sample_projects/cancer_immune/Makefile +++ b/sample_projects/cancer_immune/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -183,6 +188,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -313,3 +319,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/celltypes3/Makefile b/sample_projects/celltypes3/Makefile index 29732af20..f2e0fe056 100644 --- a/sample_projects/celltypes3/Makefile +++ b/sample_projects/celltypes3/Makefile @@ -41,7 +41,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -184,6 +189,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/custom_division/Makefile b/sample_projects/custom_division/Makefile index e90a9966f..94ee8ae8f 100644 --- a/sample_projects/custom_division/Makefile +++ b/sample_projects/custom_division/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/episode/Makefile b/sample_projects/episode/Makefile index a9b43a58e..8792f4678 100644 --- a/sample_projects/episode/Makefile +++ b/sample_projects/episode/Makefile @@ -51,7 +51,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -198,6 +203,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -323,3 +329,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/heterogeneity/Makefile b/sample_projects/heterogeneity/Makefile index 93d055ea9..f6599f9bd 100644 --- a/sample_projects/heterogeneity/Makefile +++ b/sample_projects/heterogeneity/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/immune_function/Makefile b/sample_projects/immune_function/Makefile index 8cfe66c8c..527734c5b 100644 --- a/sample_projects/immune_function/Makefile +++ b/sample_projects/immune_function/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/interactions/Makefile b/sample_projects/interactions/Makefile index 44db81996..958606b7f 100644 --- a/sample_projects/interactions/Makefile +++ b/sample_projects/interactions/Makefile @@ -49,7 +49,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -196,6 +201,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -321,3 +327,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/mechano/Makefile b/sample_projects/mechano/Makefile index e90a9966f..94ee8ae8f 100644 --- a/sample_projects/mechano/Makefile +++ b/sample_projects/mechano/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/physimess/Makefile b/sample_projects/physimess/Makefile index ed12022cb..f8169ede9 100644 --- a/sample_projects/physimess/Makefile +++ b/sample_projects/physimess/Makefile @@ -49,7 +49,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -212,6 +217,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -337,3 +343,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/pred_prey_farmer/Makefile b/sample_projects/pred_prey_farmer/Makefile index 06ec2705e..699b681f0 100644 --- a/sample_projects/pred_prey_farmer/Makefile +++ b/sample_projects/pred_prey_farmer/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -313,3 +319,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/rules_sample/Makefile b/sample_projects/rules_sample/Makefile index d9493e2df..4788b0088 100644 --- a/sample_projects/rules_sample/Makefile +++ b/sample_projects/rules_sample/Makefile @@ -49,7 +49,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -196,6 +201,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -321,3 +327,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/template/Makefile b/sample_projects/template/Makefile index 7aa7d18d2..572b0d8e5 100644 --- a/sample_projects/template/Makefile +++ b/sample_projects/template/Makefile @@ -49,7 +49,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -196,6 +201,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -321,3 +327,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/virus_macrophage/Makefile b/sample_projects/virus_macrophage/Makefile index d8c8ad4e8..79d68e653 100644 --- a/sample_projects/virus_macrophage/Makefile +++ b/sample_projects/virus_macrophage/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects/worm/Makefile b/sample_projects/worm/Makefile index e953e28ad..a9e901f15 100644 --- a/sample_projects/worm/Makefile +++ b/sample_projects/worm/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -312,3 +318,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/boolean/cancer_invasion/Makefile b/sample_projects_intracellular/boolean/cancer_invasion/Makefile index 8d14bed86..5c6c0d26d 100644 --- a/sample_projects_intracellular/boolean/cancer_invasion/Makefile +++ b/sample_projects_intracellular/boolean/cancer_invasion/Makefile @@ -75,7 +75,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -245,6 +250,7 @@ MaBoSS-clean: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -357,3 +363,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/boolean/physiboss_cell_lines/Makefile b/sample_projects_intracellular/boolean/physiboss_cell_lines/Makefile index b6205918e..ba50d05b5 100644 --- a/sample_projects_intracellular/boolean/physiboss_cell_lines/Makefile +++ b/sample_projects_intracellular/boolean/physiboss_cell_lines/Makefile @@ -73,7 +73,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -242,6 +247,7 @@ MaBoSS-clean: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -353,3 +359,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/boolean/template_BM/Makefile b/sample_projects_intracellular/boolean/template_BM/Makefile index a5d3a9c68..54e3f2bdd 100644 --- a/sample_projects_intracellular/boolean/template_BM/Makefile +++ b/sample_projects_intracellular/boolean/template_BM/Makefile @@ -73,7 +73,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -242,6 +247,7 @@ MaBoSS-clean: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -367,3 +373,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/boolean/tutorial/Makefile b/sample_projects_intracellular/boolean/tutorial/Makefile index ad562dfa2..01927c8ff 100644 --- a/sample_projects_intracellular/boolean/tutorial/Makefile +++ b/sample_projects_intracellular/boolean/tutorial/Makefile @@ -75,7 +75,12 @@ else endif CFLAGS_LINK := $(shell echo $(CFLAGS) | sed -e "s/-fopenmp//g") -COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(EXTRA_FLAGS) $(DEPFLAGS) LINK_COMMAND := $(CC) $(CFLAGS_LINK) $(EXTRA_FLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ @@ -246,6 +251,7 @@ MaBoSS-clean: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -358,3 +364,7 @@ unpack: list-user-projects: @echo "user projects::" @cd ./user_projects && ls -dt1 * | grep . | sed 's!empty.txt!!' + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/fba/cancer_metabolism/Makefile b/sample_projects_intracellular/fba/cancer_metabolism/Makefile index 1ed8367ee..53133ab51 100755 --- a/sample_projects_intracellular/fba/cancer_metabolism/Makefile +++ b/sample_projects_intracellular/fba/cancer_metabolism/Makefile @@ -45,7 +45,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPS_CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPS_CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -216,6 +221,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -246,3 +252,7 @@ unzip: untar: cp ./archives/latest.tar . tar -xzf latest.tar + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/fba/ecoli_acetic_switch/Makefile b/sample_projects_intracellular/fba/ecoli_acetic_switch/Makefile index 0e85b19ef..df6741d80 100644 --- a/sample_projects_intracellular/fba/ecoli_acetic_switch/Makefile +++ b/sample_projects_intracellular/fba/ecoli_acetic_switch/Makefile @@ -97,7 +97,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) $(LIBFBA_CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(LIBFBA_CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -263,6 +268,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -296,3 +302,7 @@ unzip: untar: cp ./archives/latest.tar . tar -xzf latest.tar + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/sample_projects_intracellular/ode/ode_energy/Makefile b/sample_projects_intracellular/ode/ode_energy/Makefile index 42168464c..e2043aa64 100644 --- a/sample_projects_intracellular/ode/ode_energy/Makefile +++ b/sample_projects_intracellular/ode/ode_energy/Makefile @@ -64,7 +64,12 @@ else # endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) $(LIBRR_CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(LIBRR_CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -216,6 +221,7 @@ librr_intracellular.o: ./addons/libRoadrunner/src/librr_intracellular.cpp ./addo clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -273,3 +279,7 @@ unzip: untar: cp ./archives/latest.tar . tar -xzf latest.tar + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/tests/timing/Makefile b/tests/timing/Makefile index d4a068a0e..603b7af6a 100644 --- a/tests/timing/Makefile +++ b/tests/timing/Makefile @@ -16,7 +16,12 @@ ARCH := native # best auto-tuning CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 #CFLAGS := -g -fopenmp -std=c++11 -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) DIR := ../.. BioFVM_OBJECTS := $(DIR)/BioFVM_vector.o $(DIR)/BioFVM_mesh.o $(DIR)/BioFVM_microenvironment.o $(DIR)/BioFVM_solvers.o $(DIR)/BioFVM_matlab.o \ @@ -42,4 +47,9 @@ all: main.cpp $(ALL_OBJECTS) clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/tests/unit/Makefile b/tests/unit/Makefile index d67ef349e..385fa3bb6 100644 --- a/tests/unit/Makefile +++ b/tests/unit/Makefile @@ -15,7 +15,12 @@ ARCH := native # best auto-tuning # CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) DIR := ../.. BioFVM_OBJECTS := $(DIR)/BioFVM_vector.o $(DIR)/BioFVM_mesh.o $(DIR)/BioFVM_microenvironment.o $(DIR)/BioFVM_solvers.o $(DIR)/BioFVM_matlab.o \ @@ -44,4 +49,9 @@ all: main.cpp $(ALL_OBJECTS) clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/unit_tests/cell_definition/Makefile b/unit_tests/cell_definition/Makefile index 3fd5ebf40..b3e662431 100644 --- a/unit_tests/cell_definition/Makefile +++ b/unit_tests/cell_definition/Makefile @@ -11,7 +11,12 @@ ARCH := native # best auto-tuning # CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 -U LIBROADRUNNER -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) ODIR := ../.. @@ -40,3 +45,7 @@ test_cell_def1: $(COMPILE_COMMAND) -o test_cell_def1 $(ALL_OBJECTS) test_cell_def1.cpp test_cell_def2: $(COMPILE_COMMAND) -o test_cell_def2 $(ALL_OBJECTS) test_cell_def2.cpp + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/unit_tests/custom_DCs_2substrates/Makefile b/unit_tests/custom_DCs_2substrates/Makefile index faa887869..69745d3ff 100644 --- a/unit_tests/custom_DCs_2substrates/Makefile +++ b/unit_tests/custom_DCs_2substrates/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -187,6 +192,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -310,3 +316,7 @@ sci_package: @echo "Project saved in $(PROJ)_packaged_$$(date +%b_%d_%Y_%H%M).zip." @echo "It is fully self-contained and can be distributed as a separate GitHub repository." @echo " " + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/unit_tests/custom_voxel_values/Makefile b/unit_tests/custom_voxel_values/Makefile index e27362f79..94d260519 100644 --- a/unit_tests/custom_voxel_values/Makefile +++ b/unit_tests/custom_voxel_values/Makefile @@ -44,7 +44,12 @@ else endif endif -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -184,6 +189,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -307,3 +313,7 @@ sci_package: @echo "Project saved in $(PROJ)_packaged_$$(date +%b_%d_%Y_%H%M).zip." @echo "It is fully self-contained and can be distributed as a separate GitHub repository." @echo " " + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d) diff --git a/unit_tests/substrate_internalization/Makefile-unit-test-conservation b/unit_tests/substrate_internalization/Makefile-unit-test-conservation index d5c82fae8..520a383cb 100644 --- a/unit_tests/substrate_internalization/Makefile-unit-test-conservation +++ b/unit_tests/substrate_internalization/Makefile-unit-test-conservation @@ -32,7 +32,12 @@ ARCH := native # best auto-tuning # CFLAGS := -march=$(ARCH) -Ofast -s -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 CFLAGS := -march=$(ARCH) -O3 -fomit-frame-pointer -mfpmath=both -fopenmp -m64 -std=c++11 -COMPILE_COMMAND := $(CC) $(CFLAGS) +# -MMD emits a .d file beside each .o listing the headers it included; -MP adds +# a dummy target for each so that deleting or renaming a header does not break +# the build. The .d files are read back in at the bottom of this file. +DEPFLAGS := -MMD -MP + +COMPILE_COMMAND := $(CC) $(CFLAGS) $(DEPFLAGS) BioFVM_OBJECTS := BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o \ BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o @@ -151,6 +156,7 @@ reset: clean: rm -f *.o + rm -f *.d rm -f $(PROGRAM_NAME)* data-cleanup: @@ -182,3 +188,7 @@ unzip: untar: cp ./archives/latest.tar . tar -xzf latest.tar + +# Keep this at the end of the file: each .d declares rules for its own .o, so +# including them any earlier would replace `all` as the default goal. +-include $(ALL_OBJECTS:.o=.d)