[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New feature: Post-requisites

From: Alejandro Colomar
Subject: New feature: Post-requisites
Date: Fri, 22 Jul 2022 14:05:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.0.2


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
        $(info 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?



Alejandro Colomar

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]