From 4230cefd85348f297224596fd9db927793fcb39b Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Tue, 1 Oct 2019 18:13:05 +0100 Subject: Infrastructure to keep preparation results A special directory is now defined in `initialize.mk' that can be used in both the preparation and build phases. Also, the contents of prepared results can now be conditionally read during `./project make'. --- reproduce/analysis/make/initialize.mk | 24 ++++++++++++++++++++++++ reproduce/analysis/make/prepare.mk | 28 +++++++++++++++++++--------- reproduce/analysis/make/top-make.mk | 11 +++++------ reproduce/analysis/make/top-prepare.mk | 4 ++-- 4 files changed, 50 insertions(+), 17 deletions(-) (limited to 'reproduce/analysis') diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk index 918ae06..0e359c5 100644 --- a/reproduce/analysis/make/initialize.mk +++ b/reproduce/analysis/make/initialize.mk @@ -33,6 +33,7 @@ texdir = $(BDIR)/tex lockdir = $(BDIR)/locks indir = $(BDIR)/inputs +prepdir = $(BDIR)/prepare mtexdir = $(texdir)/macros bashdir = reproduce/analysis/bash pconfdir = reproduce/analysis/config @@ -45,6 +46,29 @@ gconfdir = reproduce/software/config/gnuastro +# Preparation phase +# ----------------- +# +# This Makefile is loaded both for the `prepare' phase and the `make' +# phase. But the preparation files should be dealt with differently +# (depending on the phase). In the `prepare' phase, the main directory +# should be created, and in the `make' phase, its contents should be +# loaded. +# +# If you don't need any preparation, please simply comment these lines. +ifeq (x$(project-phase),xprepare) +$(prepdir):; mkdir $@ +else +include $(BDIR)/software/preparation-done.mk +ifeq (x$(include-prepare-results),xyes) +include $(prepdir)/*.mk +endif +endif + + + + + # TeX build directory # ------------------ # diff --git a/reproduce/analysis/make/prepare.mk b/reproduce/analysis/make/prepare.mk index 3e41fa9..e194d1a 100644 --- a/reproduce/analysis/make/prepare.mk +++ b/reproduce/analysis/make/prepare.mk @@ -19,17 +19,27 @@ # Final-target # # Without this file, `./project make' won't work. -$(BDIR)/software/preparation-done.txt: +$(BDIR)/software/preparation-done.mk: # If you need to add preparations define targets above to do the - # preparations. Recall that before this file, `top-prepare.mk' - # loads `initialize.mk' and `download.mk', so you can safely assume - # everything that is defined there in this Makefile. + # preparations, then set the value below to `yes'. Recall that just + # like `./project make', before loading this file, `./project + # prepare' loads loads `initialize.mk' and `download.mk', so you + # can safely assume everything that is defined there in the + # preparation phase also. # # TIP: the targets can actually be automatically generated # Makefiles that are used by `./project make'. They can include - # variables, or actual rules. Just make sure that those Makefiles - # aren't written in the source directory! Even though they are - # Makefiles, they are automatically built, so they should be - # somewhere under $(BDIR). - @touch $@ + # variables, or automatically generated rules. Just make sure that + # those Makefiles aren't written in the source directory. Even + # though they are Makefiles, they are automatically built, so they + # don't belong in the source. `$(prepdir)' has been defined for + # this purpose (see `initialize.mk'), we recommend that you put all + # automatically generated Makefiles under this directory. In the + # `make' phase, `initialize.mk' will automatically load all the + # `*.mk' files. If you need to load your generated + # configuration-makefiles before automatically generated Makefiles + # containing rules, you can use some naming convension like + # `conf-*.mk' and `rule-*.mk', or you can put them in + # subdirectories. + @echo "include-prepare-results = no" > $@ diff --git a/reproduce/analysis/make/top-make.mk b/reproduce/analysis/make/top-make.mk index 7d20800..355604a 100644 --- a/reproduce/analysis/make/top-make.mk +++ b/reproduce/analysis/make/top-make.mk @@ -125,12 +125,11 @@ makesrc = initialize \ # 1) All the analysis configuration-Makefiles (Makefiles that only define # variables with no rules or order). # -# 2) From the software configuration-Makefiles, we only include the one -# containing software versions, just incase its necessary to -# use/report outside of the acknowledgments section of the paper. -# -# 3) Finally, we'll import all the analysis workhorse-Makefiles which +# 2) Finally, we'll import all the analysis workhorse-Makefiles which # contain rules to actually do this project's processing. +# +# But before that, we need to identify the phase for the Makefiles that are +# run both in `./project prepare' and `./project make'. +project-phase = make include reproduce/analysis/config/*.mk -include reproduce/software/config/installation/versions.mk include $(foreach s,$(makesrc), reproduce/analysis/make/$(s).mk) diff --git a/reproduce/analysis/make/top-prepare.mk b/reproduce/analysis/make/top-prepare.mk index 3353638..e03e890 100644 --- a/reproduce/analysis/make/top-prepare.mk +++ b/reproduce/analysis/make/top-prepare.mk @@ -36,7 +36,7 @@ include reproduce/software/config/installation/LOCAL.mk # # See `top-make.mk' for complete explanation. ifeq (x$(reproducible_paper_group_name),x$(GROUP-NAME)) -all: $(BDIR)/software/preparation-done.txt +all: $(BDIR)/software/preparation-done.mk @echo ""; echo "----------------" echo "Project preparation has been completed without any errors." @@ -86,6 +86,6 @@ makesrc = initialize \ # ------------------------------ # # See `top-make.mk' for complete explanation. +project-phase = prepare include reproduce/analysis/config/*.mk -include reproduce/software/config/installation/versions.mk include $(foreach s,$(makesrc), reproduce/analysis/make/$(s).mk) -- cgit v1.2.1