GAPPATH=/build/gap/src/gap-4.11.1
CONFIGNAME=default32
GAP_LIBS=-lgmp -lz -lreadline -lm -ldl -lutil
# makefile prototype for the Browse package                    Frank Lübeck

CONFIGNAME=default32

GAP = $(GAPPATH)/bin/armv6l-unknown-linux-gnueabihf-default32-kv7/gap -b -r -l $(GAPPATH)

GAPINCL=-I$(GAPPATH)/src -I$(GAPPATH)/bin/armv6l-unknown-linux-gnueabihf-default32-kv7

PKGROOT=$(shell pwd)

LOPTS=$(LDFLAGS) $(GAP_LIBS) -lpanel -lncurses

.PHONY: clean doc test

default:  bin/armv6l-unknown-linux-gnueabihf-default32-kv7/ncurses.so

bin/armv6l-unknown-linux-gnueabihf-default32-kv7/ncurses.so: src/ncurses.c Makefile-$(CONFIGNAME)
	mkdir -p bin/armv6l-unknown-linux-gnueabihf-default32-kv7
	$(GAPPATH)/bin/armv6l-unknown-linux-gnueabihf-default32-kv7/gac -p "$(CFLAGS)" -d -o \
	     bin/armv6l-unknown-linux-gnueabihf-default32-kv7/ncurses.so src/ncurses.c -L "${LOPTS}"

# just make it again when called with 'manual'
##  manual: doc/manual.six
##  doc/manual.six: doc/main.xml doc/browsebib.xml doc/appl.xml doc/browse.xml \
##                  doc/curses.xml doc/intro.xml doc/util.xml
manual:
	($(GAP) -l "../../;" < makedocrel.g)
	echo "LaTeX warnings:"
	grep "\(^LaTeX Warning\|^Overfull \\hbox\)" doc/main.log; exit 0

clean:
	rm -rf bin/armv6l-unknown-linux-gnueabihf-default32-kv7 Makefile Makefile-${CONFIGNAME} *~
distclean:
	rm -rf bin/* Makefile Makefile-*

doc:
	($(GAP)  < makedocrel.g)

docclean:
	(cd  doc; ./clean)

# experimental so far
WIDECHARS:
	$(GAPPATH)/bin/armv6l-unknown-linux-gnueabihf-default32-kv7/gac -d -o bin/armv6l-unknown-linux-gnueabihf-default32-kv7/ncurses.so \
        src/ncurses.c -p -DWIDECHARS -L "-lpanelw  -lncursesw"

