# To set specific directory for each version ifeq ($(strip $(Startup)),) # use the month VERSION_DIR := $(shell date +%B) else # use no version VERSION_DIR := . endif # To set ezs parameters EZSFLAGS := -v --param VERSION_DIR="$(VERSION_DIR)" # To set the location and the extension of sources files (queries) INPUT_DIR := 01-query INPUT_EXT := txt # To set the location and the extension of results files OUTPUT_DIR := 04-export/$(VERSION_DIR) OUTPUT_EXT := jsonl # To set custom aliases wos-2018-france: $(OUTPUT_DIR)/wos-2018-france.jsonl wos-2019-france: $(OUTPUT_DIR)/wos-2019-france.jsonl wos-2020-france: $(OUTPUT_DIR)/wos-2020-france.jsonl wos-2021-france: $(OUTPUT_DIR)/wos-2021-france.jsonl wos-2022-france: $(OUTPUT_DIR)/wos-2022-france.jsonl # To generate all files from source directory to target directory SOURCE_FILES := $(wildcard $(INPUT_DIR)/*.$(INPUT_EXT)) TARGET_FILES := $(patsubst $(INPUT_DIR)/%.$(INPUT_EXT), $(OUTPUT_DIR)/%.$(OUTPUT_EXT), $(SOURCE_FILES)) all: $(TARGET_FILES) # Step 2: to download all result 02-download/$(VERSION_DIR)/%.jsonl: $(INPUT_DIR)/%.txt @[ -d 02-download/$(VERSION_DIR)/ ] || mkdir -p 02-download/$(VERSION_DIR)/ ezs $(EZSFLAGS) 02-download.ini < $< > $@ # Step 3: to refine and select only chosen fields 03-refine/$(VERSION_DIR)/%.jsonl: 02-download/$(VERSION_DIR)/%.jsonl @[ -d 03-refine/$(VERSION_DIR)/ ] || mkdir -p 03-refine/$(VERSION_DIR)/ ezs $(EZSFLAGS) 03-refine.ini < $< > $@ # Step 4 : to create a export file 04-export/$(VERSION_DIR)/%.jsonl: 03-refine/$(VERSION_DIR)/%.jsonl @[ -d 04-export/$(VERSION_DIR)/ ] || mkdir -p 04-export/$(VERSION_DIR)/ ezs $(EZSFLAGS) 04-export.ini < $< > $@ # To delete all generated files clean: @rm -f $(TARGET_FILES) @echo "Files deleted!" # To prevent deleting intermediate files .PRECIOUS: 02-download/$(VERSION_DIR)/%.jsonl # To ignore non-file targets .PHONY: clean