Skip to content

Commit

Permalink
buildsystem: sane warning if not using gmake
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Sep 14, 2023
1 parent 6712254 commit 8abd3de
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/Makefile
/GNUmakefile
/aclocal.m4
/autom4te.cache/
/bin/
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# This Makefile serves two purposes:
#
# 1) If the user types "make" without having run "configure", we suggest
# running configure.
#
# 2) Our build system is written for GNU make, and makes liberal use of its
# features. We therefore put it into "GNUmakefile", which is picked up by
# GNU make, but ignored by other make versions, such as BSD make. Thus, if
# the user has BSD make, it will run this Makefile instead -- and we inform
# them that they need to use GNU make to compile Semigroups.
#
# To learn more about the GAP build system, see README.buildsys.md
#
.DEFAULT:
@if test -f GNUmakefile ; then \
printf "Please use GNU make to build Semigroups (try 'gmake' or 'gnumake')\n" ; \
else \
printf "You need to run "; \
if ! test -f configure ; then \
printf "./autogen.sh then "; \
fi; \
printf "./configure before make (please refer to README.md or Chapter 2 of the Semigroups package documentation for details)\n" ; \
fi
@exit 1
all: .DEFAULT
30 changes: 15 additions & 15 deletions Makefile.gappkg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The build rules in this file are intended for use by GAP packages that
# want to build a simple GAP kernel extensions. They are based on the
# GAP build system, and require GNU make. To use this in your GAP
# package, `include` this file from your primary Makefile. You must also
# package, `include` this file from your primary GNUmakefile. You must also
# set several variables beforehand:
#
# - GAPPATH must be set to the location of the GAP installation against
Expand Down Expand Up @@ -65,7 +65,7 @@ GAP_OBJEXT ?= lo
# override KEXT_RECONF if your package needs a different invocation
# for reconfiguring (e.g. `./config.status --recheck` for autoconf)
ifdef KEXT_USE_AUTOCONF
KEXT_RECONF ?= ./config.status Makefile
KEXT_RECONF ?= ./config.status GNUmakefile
else
KEXT_RECONF ?= ./configure "$(GAPPATH)"
endif
Expand Down Expand Up @@ -118,20 +118,20 @@ KEXT_DEPFILES = $(patsubst %.$(GAP_OBJEXT),%.d,$(KEXT_OBJS))
KEXT_DEPFLAGS = -MQ "$@" -MMD -MP -MF $(@D)/$(*F).d

# build rule for C code
# The dependency on Makefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.c Makefile
# The dependency on GNUmakefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.c GNUmakefile
@mkdir -p $(@D)
$(QUIET_GAC)$(GAC) -d -p "$(KEXT_DEPFLAGS)" -p "$(KEXT_CFLAGS)" -c $< -o $@

# build rule for C++ code
# The dependency on Makefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.cpp Makefile
# The dependency on GNUmakefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.cpp GNUmakefile
@mkdir -p $(@D)
$(QUIET_GAC)$(GAC) -d -p "$(KEXT_DEPFLAGS)" -p "$(KEXT_CXXFLAGS)" -c $< -o $@

# build rule for assembler code
# The dependency on Makefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.s Makefile
# The dependency on GNUmakefile ensures that re-running configure recompiles everything
gen/%.$(GAP_OBJEXT): %.s GNUmakefile
@mkdir -p $(@D)
$(QUIET_GAC)$(GAC) -d -p "$(KEXT_DEPFLAGS)" -p "$(KEXT_CFLAGS)" -c $< -o $@

Expand All @@ -148,7 +148,7 @@ clean-kext:
# hook into `make distclean`
distclean: distclean-kext
distclean-kext:
rm -rf bin gen Makefile
rm -rf bin gen GNUmakefile
rm -rf doc/_*.xml
rm -rf doc/*.aux doc/*.bbl doc/*.blg doc/*.brf doc/*.idx doc/*.idx
rm -rf doc/*.ilg doc/*.ind doc/*.log doc/*.out doc/*.pnr doc/*.toc
Expand All @@ -163,8 +163,8 @@ check: check-kext
check-kext:
$(GAP) tst/testall.g

# re-run configure if configure, Makefile.in or GAP itself changed
Makefile: configure Makefile.in $(GAPPATH)/sysinfo.gap
# re-run configure if configure, GNUmakefile.in or GAP itself changed
GNUmakefile: configure GNUmakefile.in $(GAPPATH)/sysinfo.gap
$(KEXT_RECONF)

ifdef KEXT_USE_AUTOCONF
Expand All @@ -182,12 +182,12 @@ configure: $(configure_deps)
fi
endif # MAINTAINER_MODE

# re-run configure if configure, Makefile.in or GAP itself changed
# re-run configure if configure, GNUmakefile.in or GAP itself changed
config.status: configure $(GAPPATH)/sysinfo.gap
./config.status --recheck

# update Makefile if config.status changed
Makefile: config.status
# update GNUmakefile if config.status changed
GNUmakefile: config.status

gen/pkgconfig.h: gen/pkgconfig.h.stamp
@if test ! -f $@; then rm -f $<; else :; fi
Expand Down Expand Up @@ -218,7 +218,7 @@ endif # KEXT_USE_AUTOCONF
.PHONY: check-kext clean-kext distclean-kext doc-kext

########################################################################
# Makefile debugging trick:
# GNUmakefile debugging trick:
# call print-VARIABLE to see the runtime value of any variable
########################################################################
print-%:
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
AX_PREFIX_CONFIG_H([src/semigroups-config.hpp],[semigroups],[gen/pkgconfig.h])

dnl ## abs_top_builddir seems to hold the top build dir for the subpackage
dnl ## libsemigroups which is why this contains ../
dnl ## libsemigroups which is why this contains ../
AC_PREFIX_DEFAULT('${abs_top_builddir}/../bin/')

dnl ##
Expand Down Expand Up @@ -67,5 +67,5 @@ AX_CHECK_HPCOMBI
dnl ##
dnl ## Output everything
dnl ##
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([GNUmakefile])
AC_OUTPUT

0 comments on commit 8abd3de

Please sign in to comment.