0

I have the makefile below.

Why does the rule for the data/vix.csv target always execute when I run make, though?

In a recent answer on SO, someone showed me how to update last_updated.txt on 24 hour intervals, even if I was running make frequently. As a result, @echo "\n\n##### updating last_updated.txt#####\n\n" rarely prints when I run make.

As far as I can see, that is the only thing that updates last_updated.txt. But is there something else modifying that file? Something else seems to updating it because it's the only dependency of the first rule, and @echo "\n\n######## downloading fresh data and updating vix.csv ##########\n\n" is always printing. This isn't great because this is the portion of the makefile that calls a web api.

TS24 := .timestamp24
DUMMY := $(shell touch -d 'yesterday' "$(TS24)")

# update data if it has been 24 hours
data/vix.csv: last_updated.txt
    @echo "\n\n######## downloading fresh data and updating vix.csv ##########\n\n"
    Rscript update_csv.R

# signal that it's been >24 hours since data download
last_updated.txt: $(TS24)
    @echo "\n\n##### updating last_updated.txt#####\n\n"
    touch "$@"

.PHONY: run
run: 
    @echo "\n\n####### running shiny app ###########\n\n"
    R --quiet -e "shiny::runApp(launch.browser=TRUE)"

## remove all target, output and extraneous files
.PHONY: clean
clean:
    rm -f *~ *.Rout *.RData *.docx *.pdf *.html *-syntax.R *.RData
0

1 Answer 1

1

Run ls -l data/vix.csv to see the actual timestamp of data/vix.csv.

Does it reflect the time you last ran make and saw the downloading fresh data and updating vix.csv message?

Or does it reflect the timestamp of the source material, wherever Rscript update_csv.R gets it from?

Or does it actually get updated at all?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .