# makefile prototype for the Browse package                    Frank Lübeck
#  $Id:$

GAP = $(GAPPATH)/bin/@GAPARCH@/gap -b -l $(GAPPATH)

GAPINCL=-I$(GAPPATH)/src -I$(GAPPATH)/bin/@GAPARCH@

PKGROOT=`pwd`

.PHONY: bindir

default: bindir bin/@GAPARCH@/ncurses.so

# this target creates a bin-directory
bindir:
	if test ! -d bin;  then mkdir bin;  fi
	if test ! -d bin/@GAPARCH@;  then mkdir bin/@GAPARCH@;  fi

bin/@GAPARCH@/ncurses.so: src/ncurses.c
	$(GAPPATH)/bin/@GAPARCH@/gac -d -o bin/@GAPARCH@/ncurses.so \
        src/ncurses.c -P -lpanel -P -lncurses

# make a statically linked GAP including the ncurses module
static:
	(cd $(GAPPATH)/bin/@GAPARCH@; \
        ./gac -o gap-static -p "-DNCURSESSTATIC" -P "-static" \
        $(PKGROOT)/src/ncurses.c)

# 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) < makedocrel.g)
	echo "LaTeX warnings:"
	grep "\(^LaTeX Warning\|^Overfull \\hbox\)" doc/main.log; exit 0

clean:
	rm -rf bin/@GAPARCH@ Makefile *~

WIDECHARS:
	$(GAPPATH)/bin/@GAPARCH@/gac -d -o bin/@GAPARCH@/ncurses.so \
        src/ncurses.c -p -DWIDECHARS -P -lpanelw -P -lncursesw

