# 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@

.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 "-DEDIVSTATIC" -P "-static" \
        ../../pkg/Browse/src/ncurses.c)

manual: doc/manual.six

doc/manual.six: doc/main.xml doc/browse.bib doc/appl.xml doc/browse.xml \
                doc/curses.xml doc/intro.xml doc/util.xml
	($(GAP) < makedocrel.g)
	echo "LaTeX warnings:"
	grep "\(^LaTeX Warning\|^Overfull \\hbox\)" doc/main.log

clean:
	rm -rf bin/@GAPARCH@ Makefile *~ \
        doc/*.{aux,bbl,blg,brf,dvi,html,idx,ilg,ind,lab,log,pdf,pnr,ps,six,tex,toc,txt}

test:
	(cd tst; gap -b -q -r < test.g)

