From 4ef3b9f0001f8c6d2ccf68d5e9c8876dd0cb7b04 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 4 Sep 2021 08:53:05 +0200 Subject: [PATCH] Add BSDmakefile with a note to run 'gmake' for BSD users. Also, check for GNU make (which can be either 'make' or 'gmake') early in ./Config and print out an error to install prerequisites from https://www.unrealircd.org/docs/Installing_from_source This also replaces 'make' with ${MAKE} (and such) everywhere. --- BSDmakefile | 4 ++++ Config | 33 ++++++++++++++++++++++++++++++--- Makefile.in | 2 +- src/Makefile.in | 2 +- src/buildmod | 3 ++- src/modules/third/Makefile.in | 2 +- 6 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 BSDmakefile diff --git a/BSDmakefile b/BSDmakefile new file mode 100644 index 000000000..f0efc9d34 --- /dev/null +++ b/BSDmakefile @@ -0,0 +1,4 @@ +.DONE: + @echo "Please use GNU Make (gmake) to build UnrealIRCd" +.DEFAULT: + @echo "Please use GNU Make (gmake) to build UnrealIRCd" diff --git a/Config b/Config index 5219867c0..09f85f245 100755 --- a/Config +++ b/Config @@ -158,7 +158,7 @@ if [ "$QUICK" != "1" ] ; then echo "*******************************************************************************" echo "Press ENTER to continue" read cc - make pem + $MAKE pem echo "Certificate created successfully." sleep 1 else @@ -173,7 +173,7 @@ fi # Silently force a 'make clean' as otherwise part (or whole) of the # compiled source could be using different settings than the user # just requested when re-running ./Config. -make clean 1>/dev/null 2>&1 +$MAKE clean 1>/dev/null 2>&1 } RUN_ADVANCED () { @@ -333,6 +333,33 @@ if [ "`id -u`" = "0" ]; then exit fi +# Check for gmake early... +if [ "$MAKE" = "" ]; then + MAKE="make" +fi + +if ! $MAKE --version 2>&1|grep -q "GNU Make"; then + # So $MAKE is not GNU make, but do we have gmake? + if gmake --version 2>&1|grep -q "GNU Make"; then + # Great, use that one! + MAKE="gmake" + else + # Both $MAKE and gmake are not GNU make, do we have a working $MAKE at all? + if $MAKE --version 1>/dev/null 2>&1; then + echo "Your system has 'make' but UnrealIRCd requires GNU Make ('gmake')" + echo "Please install 'gmake' (eg 'pkg install gmake' on BSD)." + exit 1 + else + echo "Your system does not have the required tools installed to build UnrealIRCd." + echo "Please check https://www.unrealircd.org/docs/Installing_from_source" + echo "and install the required tools listed under 'Prerequisites'." + echo "After that, you can run ./Config again" + exit 1 + fi + fi +fi + + clear if [ -f "doc/Config.header" -a -z "$NOINTRO" ] ; then @@ -808,7 +835,7 @@ cat << __EOF__ |_______________________________________________________________________| |_______________________________________________________________________| | | -| Now all you have to do is type 'make' and let it compile. When that's | +| Now all you have to do is type '$MAKE' and let it compile. When that's | | done, you will receive other instructions on what to do next. | | | |_______________________________________________________________________| diff --git a/Makefile.in b/Makefile.in index 85287f7ca..7c3bbbebd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -148,7 +148,7 @@ build: Makefile done @echo '' @echo '* UnrealIRCd compiled successfully' - @echo '* YOU ARE NOT DONE YET! Run "make install" to install UnrealIRCd !' + @echo '* YOU ARE NOT DONE YET! Run "${MAKE} install" to install UnrealIRCd !' @echo '' clean: diff --git a/src/Makefile.in b/src/Makefile.in index 1e82f8f9f..dc1a09ad8 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -88,7 +88,7 @@ version.c: version.c.SH clean: $(RM) -f *.o *.so *~ core ircd version.c; \ - cd modules; make clean + cd modules; ${MAKE} clean cleandir: clean diff --git a/src/buildmod b/src/buildmod index 6fdfe228d..da2171762 100755 --- a/src/buildmod +++ b/src/buildmod @@ -1,4 +1,5 @@ #!/bin/sh +MAKE="$1" echo "" echo "Checking for updates for third party modules..." # We can't use the "unrealircd" script, since possibly the ircd @@ -13,7 +14,7 @@ if [ "$x" != "*.c" ]; then x="`echo $x|sed 's/\.c//'`" if [ ! -f $x.so -o $x.c -nt $x.so ]; then echo "Building 3rd party module $x..." - make custommodule MODULEFILE=$x || (echo "*****"; echo "Building 3rd party module $x failed."; echo "Contact the module author of the $x module (not the UnrealIRCd team), or simply delete the $PWD/$x.c file"; echo "*****"; exit 1) + $MAKE custommodule MODULEFILE=$x || (echo "*****"; echo "Building 3rd party module $x failed."; echo "Contact the module author of the $x module (not the UnrealIRCd team), or simply delete the $PWD/$x.c file"; echo "*****"; exit 1) fi fi done diff --git a/src/modules/third/Makefile.in b/src/modules/third/Makefile.in index 15a1db8bd..13128e88c 100644 --- a/src/modules/third/Makefile.in +++ b/src/modules/third/Makefile.in @@ -40,7 +40,7 @@ RM=@RM@ all: build build: - ../../buildmod + ../../buildmod $(MAKE) custommodule: $(MODULEFILE).c $(CC) $(CFLAGS) $(MODULEFLAGS) -DDYNAMIC_LINKING \