[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
New feature: Post-requisites
From: |
thutt |
Subject: |
New feature: Post-requisites |
Date: |
Fri, 22 Jul 2022 06:28:22 -0700 |
Alejandro Colomar writes:
> Hi,
>
> I'd like to suggest a new feature: post-requisites.
>
> As the word suggests, as pre-requisites are satisfied before a given
> target, post-requisites would be satisfied _after_ a given target.
>
> Why would someone ever need that in a Makefile:
>
> In an install target for a library, you may want to run ldconfig(8)
> after any install targets have executed.
>
> In an install target for the linux man-pages, you may want to run
> mandb(8) after any pages have been installed in the system.
>
> The proposed syntax would be similar to that of order only
> prerequisites, but using '>' instead of '|':
>
> [
> [...]
>
> $(DESTDIR)$(man3dir)/foo.3: man3/foo.3 | $(DESTDIR)$(man3dir) > update-mandb
> $(info INSTALL $@)
> @$(INSTALL_DATA) -T $< $@
>
> $(DESTDIR)$(man3dir)/bar.3: man3/bar.3 | $(DESTDIR)$(man3dir) > update-mandb
> $(info INSTALL $@)
> @$(INSTALL_DATA) -T $< $@
>
> .PHONY: update-mandb
> update-mandb:
> $(info MANDB)
> @mandb
>
> .PHONY: install
> install: $(DESTDIR)$(man3dir)/foo.3 $(DESTDIR)$(man3dir)/bar.3
> ]
>
> So that `make install` would install foo.3 and bar.3, and after all of
> the pages have been installed, mandb(8) would be run.
> And `make /usr/local/share/man/man3/foo.3` would install foo.3, and
> after it, it would run mandb(8).
>
> Does that make sense to you?
In your example, wouldn't the following accomplish the same thing?
update-mandb: $(DESTDIR)$(man3dir)/foo.3 $(DESTDIR)$(man3dir)/bar.3