# General makefile for GAP4 cohomolo package -
# all executables are put into the bin directory.
BIN = bin/armv7l-unknown-linux-gnueabihf-default32-kv7

CC ?= gcc
CFLAGS ?= -O2 -g

# many cohomolo symbols (e.g. 'exp') clash with C builtins,
# so we disable them to avoid spurious warnings and errors
EXTRA_CFLAGS += -fno-builtin

# evil HACK: disable some warnings, to prevent an overflowing build
# log on Travis.
# FIXME: these warnings really should be fixed instead, but that's
# very hard and unrewarding word on this old code base. It's more
# tempting to reimplement this all in scratch in a modern C or C++,
# or a radically different language (Ruse, Go, Julia, ...)
EXTRA_CFLAGS += -Wno-implicit-function-declaration
EXTRA_CFLAGS += -Wno-return-type
EXTRA_CFLAGS += -Wno-dangling-else
EXTRA_CFLAGS += -Wno-unused-result

all:
	mkdir -p bin/armv7l-unknown-linux-gnueabihf-default32-kv7;
	cd standalone/progs.d;\
	$(MAKE) CC="$(CC)" BIN="..//..//$(BIN)" CFLAGS="$(CFLAGS) $(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)"

clean:
	cd standalone/progs.d; $(MAKE) clean

distclean:
	cd standalone/progs.d; $(MAKE) clean
	rm -rf bin htm

doc:
	cd doc && ./make_doc

Makefile: configure Makefile.in
	./configure "/build/gap/src/gap-4.11.1"

.PHONY: all clean distclean doc
