Prerequisites and .DEFAULT -- what am I doing wrong?
Ivan Shapovalov <[email protected]> Tue, 07 Nov 2023 22:02:51 +0400
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <[email protected]> |
Consider a following Makefile (grossly simplified): -- 8< -- .PHONY: dist deploy redist symstore-tarball .DEFAULT dist deploy redist symstore-tarball: @echo STARTED: $@ @sleep 10 @echo FINISHED: $@ .PHONY: default default: all .DEFAULT_GOAL := default -- 8< -- The stubbed-out recipe in reality invokes another Makefile inside of a container. This Makefile would be invoked as `make` or `make redist`, in which case the inner Makefile is invoked asĀ `podman run ... make all` or `podman run ... make redist`. Easy enough. Now, let's say I patch this Makefile to build the container image prior to executing that recipe: -- 8< -- .PHONY: build-base-image build-base-image: @echo STARTED: build-base-image @sleep 10 @echo FINISHED: build-base-image .PHONY: dist deploy redist symstore-tarball .DEFAULT dist deploy redist symstore-tarball: build-base-image @echo STARTED: $@ @sleep 10 @echo FINISHED: $@ .PHONY: default default: all .DEFAULT_GOAL := default -- 8< -- However, when I run `make` on this Makefile, the recipe for `build-base-image` is not run, despite that it is specified as a prerequisite for the `.DEFAULT` target: -- 8< -- $ make STARTED: all FINISHED: all -- 8< -- If I specify any explicitly named target (e. g. `make redist`), the recipe for `build-base-image` is correctly executed prior to the main recipe. Why is that so? (Please Cc: me in replies. I am not subscribed to the list. Thanks.) -- Ivan Shapovalov / intelfx /
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE5N8nvImcx2nJlFGce94XyOTjDp0FAmVKe8sACgkQe94XyOTj Dp2Ezw//Yi5h6ZTtp8hTyDRrktR9COnG9qbwg9mqdv9GrJrtvakFjol1f9tSuP5F B9MEaeoua8r5EhcVVUR/Mf72Oh3JrFNM5epKzQ8bEekpOnrNfxfBhI6PwJkWkasi 9po8/DKUtTLY6S1mPB9QfCX6xS6ECyP/YdW4Y+PE8Urcs27KUiNgFz4q1lE0f0we oQWHfmChfGcLW5urALbOS0i2AKZBmqN0sRAhBVkbSXOCz0q6sC5heEuoI2fCfH3o Yqjd5wP+Wn0TIXF2lvOcMeuq4e92UAmufDOv/l3Ik9mxlufvRAJ7Ho3FnXuoii2+ fkAk2ABa8um6E+/Mw4IG89EWmKqhX1ipIWqZGx9c7aNI2ZYtIEu2MpY9i7Ri7tdl /py4BhdwuSi0r6TeSqgIQKt4a2X2yA010AY03CKFZ15R/tIfF1EWC7EHvomg32p3 hcOkDxfjfCuU1swT7qeuaqS3+5+fTo7QfaWj75X1te6ShZ8ZHqMVNhY9H5cnh4lo HfZAQMBWcwSWUa4xLmRcishtMPux/gcaBNfBpY0pie72GnPgprWHiHCjw0IJO3rZ zGfDcPZ68WQKHnBGQCfhWuCmuDR612+O4NIbBH7hkAf+uh0eL9CD6wwkfAiwr8EC HyYHoAnKiDCU699fdbuhr1a37KlpbDRV0MuqZZrIc87eRFMSYjA= =/wmj -----END PGP SIGNATURE-----