Makefiles: do not re-generate magic.py every time

I always wondered why re-running make on a criu checkout always prints
out

  GEN      magic.py

even if no file has changed. It seems the Makefile was looking for the
file in the wrong location. Providing the full path to the file will now
only rebuild magic.py if something actually changed that requires a
rebuild.

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2020-08-05 13:17:00 +00:00 committed by Andrei Vagin
parent 5106b232e7
commit 65a930d923

View file

@ -1,4 +1,4 @@
all-y += images magic.py pb.py
all-y += images $(obj)/magic.py pb.py
proto := $(filter-out images/rpc.proto, $(sort $(wildcard images/*.proto)))
proto-py-modules := $(foreach m,$(proto),$(subst -,_,$(notdir $(m:.proto=_pb2))))
@ -10,9 +10,9 @@ images:
$(Q) protoc -I=images/ -I=/usr/include/ --python_out=$(obj) $(proto)
.PHONY: images
magic.py: scripts/magic-gen.py criu/include/magic.h
$(obj)/magic.py: scripts/magic-gen.py criu/include/magic.h
$(call msg-gen, $@)
$(Q) $(PYTHON) $^ $(obj)/$@
$(Q) $(PYTHON) $^ $@
pb.py: images
$(Q) echo "# Autogenerated. Do not edit!" > $(obj)/$@