Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 21 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,35 @@ WRITE_C := $(sort $(shell find . -name write.C))
READ_C := $(sort $(shell find . -name read.C))

# run each Makefile in subdirectories to create dictionaries
.PHONY: dict
dict:: check $(DICT_MAKEFILE_DIR)
$(DICT_MAKEFILE_DIR):: $(DICT_DIR)
.PHONY: dict $(DICT_MAKEFILE_DIR) $(DICT_DIR)
dict: check $(DICT_MAKEFILE_DIR)
$(DICT_MAKEFILE_DIR): $(DICT_DIR)
@$(MAKE) -C $@
$(DICT_DIR)::
@echo "\nStarting dict target - Storing dictionaries in: '$@'" && mkdir -p $@
$(DICT_DIR):
$(info ###### Starting dict target - Storing dictionaries in: '$@' ######)
@mkdir -p $@

# run each write.C file in subdirectories to create .root files
.PHONY: write
write:: check $(WRITE_C)
$(WRITE_C):: $(WRITE_DIR)
.PHONY: write $(WRITE_C) $(WRITE_DIR)
write: check $(WRITE_C)
$(WRITE_C): $(WRITE_DIR)
@LD_LIBRARY_PATH="$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(DICT_DIR)" $(ROOT_EXE) -q -l '$@("$(WRITE_DIR)$(subst /,.,$(shell dirname $@)).root")'
$(WRITE_DIR)::
@echo "\nStarting write target - Storing root files in: '$@'" && mkdir -p $@
$(WRITE_DIR):
$(info ###### Starting write target - Storing root files in: '$@' ######)
@mkdir -p $@

# run each read.C file in subdirectories to create .json files
.PHONY: read
read:: check $(READ_C)
$(READ_C):: $(READ_DIR)
.PHONY: read $(READ_C) $(READ_DIR)
read: check $(READ_C)
$(READ_C): $(READ_DIR)
@LD_LIBRARY_PATH="$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}$(DICT_DIR)" $(ROOT_EXE) -q -l \
'$@("$(WRITE_DIR)$(subst /,.,$(shell dirname $@)).root", "$(READ_DIR)$(subst /,.,$(shell dirname $@)).json")'
$(READ_DIR)::
@echo "\nStarting read target - Storing json files in: '$@'" && mkdir -p $@
$(READ_DIR):
$(info ###### Starting read target - Storing json files in: '$@' ######)
@mkdir -p $@

.PHONY: check
check::
check:
@test -x "$(ROOT_EXE)" || { echo "Could not find root.exe"; exit 1; }

.PHONY: validate
Expand All @@ -57,29 +60,25 @@ validate:
fi

# run make dict to create dictionaries
@echo "-- Creating dictionaries --"
@for s_path in $(source_scripts); do \
(bash -c "source $$s_path && ROOT_VERSION=\$$(root-config --version) && $(MAKE) dict dict_dir=\$$ROOT_VERSION") || exit $$?; \
done

# run make write to create binaries
@echo "-- Creating binaries --"
@for s_path in $(source_scripts); do \
(bash -c "source $$s_path && ROOT_VERSION=\$$(root-config --version) && $(MAKE) write dict_dir=\$$ROOT_VERSION write_dir=\$$ROOT_VERSION") || exit $$?; \
done

# run make read to create json files
@echo "-- Creating .json files --"
# run make read to do cross-validation
@for s_path in $(source_scripts); do \
for w_dir in write/*; do \
(bash -c "source $$s_path && ROOT_VERSION=\$$(root-config --version) && $(MAKE) read dict_dir=\$$ROOT_VERSION write_dir=$$(basename $$w_dir) read_dir=\$$ROOT_VERSION") || exit $$?; \
done; \
done
@echo Finished

.PHONY: download
download:
@echo "Downloading and unpacking assets from GitHub.."
$(info Downloading and unpacking assets from GitHub..)
@wget -q -N -P ./assets https://github.com/root-project/rntuple-validation/releases/download/v$(ASSET_VERSION)/$(ROOT_ASSET)
@mkdir -p write && unzip -n -q -d write/$(basename $(ROOT_ASSET)) assets/$(ROOT_ASSET)
@wget -q -N -P ./assets https://github.com/root-project/rntuple-validation/releases/download/v$(ASSET_VERSION)/$(JSON_ASSET)
Expand Down