| 1 |
# The PostgreSQL make files exploit features of GNU make that other |
| 2 |
# makes do not have. Because it is a common mistake for users to try |
| 3 |
# to build Postgres with a different make, we have this make file |
| 4 |
# that, as a service, will look for a GNU make and invoke it, or show |
| 5 |
# an error message if none could be found. |
| 6 |
|
| 7 |
# If the user were using GNU make now, this file would not get used |
| 8 |
# because GNU make uses a make file named "GNUmakefile" in preference |
| 9 |
# to "Makefile" if it exists. PostgreSQL is shipped with a |
| 10 |
# "GNUmakefile". If the user hasn't run the configure script yet, the |
| 11 |
# GNUmakefile won't exist yet, so we catch that case as well. |
| 12 |
|
| 13 |
|
| 14 |
# AIX make defaults to building *every* target of the first rule. Start with |
| 15 |
# a single-target, empty rule to make the other targets non-default. |
| 16 |
# (We don't support AIX anymore, but if someone tries to build on AIX anyway, |
| 17 |
# at least they'll get the instructions to run 'configure' first.) |
| 18 |
all: |
| 19 |
|
| 20 |
all check install installdirs installcheck installcheck-parallel uninstall clean distclean maintainer-clean dist distcheck world check-world install-world installcheck-world: |
| 21 |
@if [ ! -f GNUmakefile ] ; then \ |
| 22 |
echo "You need to run the 'configure' program first. Please see"; \ |
| 23 |
echo "<https://www.postgresql.org/docs/18/installation.html>" ; \ |
| 24 |
false ; \ |
| 25 |
fi |
| 26 |
@IFS=':' ; \ |
| 27 |
for dir in $$PATH; do \ |
| 28 |
for prog in gmake gnumake make; do \ |
| 29 |
if [ -f $$dir/$$prog ] && ( $$dir/$$prog -f /dev/null --version 2>/dev/null | grep GNU >/dev/null 2>&1 ) ; then \ |
| 30 |
GMAKE=$$dir/$$prog; \ |
| 31 |
break 2; \ |
| 32 |
fi; \ |
| 33 |
done; \ |
| 34 |
done; \ |
| 35 |
\ |
| 36 |
if [ x"$${GMAKE+set}" = xset ]; then \ |
| 37 |
echo "Using GNU make found at $${GMAKE}"; \ |
| 38 |
unset MAKELEVEL; \ |
| 39 |
$${GMAKE} $@ ; \ |
| 40 |
else \ |
| 41 |
echo "You must use GNU make to build PostgreSQL." ; \ |
| 42 |
false; \ |
| 43 |
fi |