Re:The Unreasonable Effectiveness of Makefiles
by Izkata on Friday August 12, 2022 @11:21PM
(#32446607)
> I wonder if for command runner unnecessarily re-running dependencies is really a big deal.
I've used in in the past with python/django roughly like so (untested from memory, there may be a "last modified" bug in here that still makes something run unnecessarily):
.PHONY: runserver
environ:
python -m venv $@
environ/lib: requirements | environ
. environ/bin/activate && pip install -r $<
touch $@
runserver: | environ/lib
. environ/bin/activate && python manage.py runserver [foo]
Setting up these prerequisites takes a while and doing every time you start the dev server would be a pain, but not doing it and forgetting when requirements were updated is also a pain. This would handle both.
Re:The Unreasonable Effectiveness of Makefiles
by datashaman on Saturday August 13, 2022 @12:34AM
(#32446926)
What is the | doing in the dependencies?
Re:The Unreasonable Effectiveness of Makefiles
by Izkata on Saturday August 13, 2022 @01:17AM
(#32447144)
Specifies order without a hard more-recent-than dependency on everything after the |. So if the timestamp on "environ" is updated, that won't cause the "environ/lib" recipe to run, but if they both have to run then it ensures "environ" happens before "environ/lib".
It might not be necessary for this example, but I've found being more liberal with this feature and manually using "touch" has been more reliable in stopping unnecessary re-runs when the recipe target and dependency are directories instead of just files.
[1] https://github.com/casey/just