build: fix install dependencies in Makefile templatemaster
commit36f5b55b2aabe16e8c17b8e95a5b69327d3266f4
authorFederico Pellegrin <fede@evolware.org>
Wed, 28 Aug 2024 04:23:35 +0000 (28 06:23 +0200)
committerTobias Klauser <tobias.klauser@gmail.com>
Wed, 28 Aug 2024 13:48:55 +0000 (28 15:48 +0200)
tree9e653990dbb4821911d65cce9cec2cc668a873bc
parent519aae7b91454e45b0528809e94c5008cdf0c060
build: fix install dependencies in Makefile template

post_install should execute after do_install otherwise when building
in parallel (-j) this leads to sporadic failures of trafgen stddef
header, since it is installed in do_install but then post_install
does a mv supposing it is already there, for example:

```
  INST netsniff-ng/netsniff-ng
  INST trafgen/trafgen
mv: cannot stat '/tmp/a/pref/etc/netsniff-ng/trafgen_stddef.h': No such file or directory
make: *** [trafgen/Makefile:57: trafgen_post_install] Error 1
make: *** Waiting for unfinished jobs....
  INST netsniff-ng/netsniff-ng.8.gz
  INST trafgen/trafgen.8.gz
  INST ether.conf
  INST tcp.conf
  INST trafgen_stddef.h
```

(it is visible above that the stddef.h is installed later than the post
is trying to move it away)

Forcing the order of post after do will guarantee that it will be there
when it needs to be moved and it will be safe to do a parallel install.
Just relying on the ordering of the $(1)_install definition is wrong and
dependant on make version (and luck!).
Template