Make is supposed to only compile dependencies when they change but
`make check` always compiles them, making the test suite run slow.
```
$ make check
cc ... build/mpc.o
$ make check
cc ... build/mpc.o
```
The same occurs for other targets like `build/test-dynamic` and
`build/test-static`.
This happens because these targets have the `$(DIST)` directory as a
dependency, and directories always change whenever members are added,
removed or renamed.
Fix this by changing the `$(DIST)` directory dependency to a
`$(DIST)/.dirstamp` file.
Now `make check` compiles dependencies only once.
After running `make install`, pkg-config only finds mpc with sudo:
```
$ sudo pkg-config --list-all | grep mpc
mpc - Library for creating parser combinators
$ pkg-config --list-all | grep mpc
```
This is because the Makefile runs `install -d -m644`, which doesn't
include permission to access the `/usr/local/lib/pkgconfig` directory.
Fix this by changing the created directories mode to 645.
Otherwise, the 'prefix' variable would be left undefined:
$ pkg-config --cflags mpc
Variable 'prefix' not defined in '/gnu/store/...-profile/lib/pkgconfig/mpc.pc'
$ cat /gnu/store/...-profile/lib/pkgconfig/mpc.pc
libdir=${prefix}/lib
includedir=${prefix}/include
[...]
* Makefile (install): Install the templated pkg-config from the build
directory.
(all): Add the libs and $(DIST)/$(PROJ).pc targets.
- Out-of-Tree builds (defaults to ./build, configurable via DIST)
- Install and uninstall rules (which respect DESTDIR and PREFIX)
- Production of static and dynamic libraries
- Testing of all three methods of inclusion
- direct file inclusion
- static library
- dynamic library (using LD_LIBRARY_PATH)
- Better declaration of PHONY targets
- Expose ability to override CC and CFLAGS