GAPPATH=../..
#
# makefile for the orb package                             Max Neunhoeffer
#
##  Copyright (C) 2009  Max Neunhoeffer
##  This file is free software, see license information at the end.
#
CC=cc

COMPILEOPTIONS="-O3 -fomit-frame-pointer"
#COMPILEOPTIONS="-O3 -g -fomit-frame-pointer"
#COMPILEOPTIONS="-O0 -g -Wall"
# Some experiments:
#COMPILEOPTIONS="-march=i686 -mcpu=pentium4 -O3 -fomit-frame-pointer"
#COMPILEOPTIONS="-march=i686 -mcpu=pentium4 -O3 -fomit-frame-pointer -falign-loops=5 -finline-limit=6000"

GAPINCL=-I$(GAPPATH)/src -I$(GAPPATH)/bin/x86_64-unknown-linux-gnu-gcc

.PHONY: bindir clean doc test

default: bindir bin/x86_64-unknown-linux-gnu-gcc/orb.so

# this target creates a bin-directory
bindir:
	if test ! -d bin;  then mkdir bin;  fi
	if test ! -d bin/x86_64-unknown-linux-gnu-gcc;  then mkdir bin/x86_64-unknown-linux-gnu-gcc;  fi

bin/x86_64-unknown-linux-gnu-gcc/orb.so: src/orb.c
	cp $(GAPPATH)/bin/x86_64-unknown-linux-gnu-gcc/config.h bin/x86_64-unknown-linux-gnu-gcc
	$(GAPPATH)/bin/x86_64-unknown-linux-gnu-gcc/gac -p ${COMPILEOPTIONS} -d -o bin/x86_64-unknown-linux-gnu-gcc/orb.so src/orb.c

# make a statically linked GAP including the orb module
static:
	(cd $(GAPPATH)/bin/x86_64-unknown-linux-gnu-gcc; \
	./gac -o gap-static -p "-DORBSTATIC" -p ${COMPILEOPTIONS} -P "-static" \
	../../pkg/orb/src/orb.c)

doc: doc/manual.six

doc/manual.six: doc/basic.xml doc/hash.xml doc/orb.xml doc/search.xml \
		doc/bysuborbit.xml doc/install.xml doc/quotfinder.xml \
		doc/examples.xml doc/intro.xml doc/random.xml VERSION
	($(GAPPATH)/bin/gap.sh makedoc.g)

clean:
	(cd doc ; ./clean)
	rm -rf bin/x86_64-unknown-linux-gnu-gcc Makefile

archive: doc
	(cd .. ; tar czvf orb-`cat orb/VERSION`.tar.gz --exclude ".svn" --exclude bin --exclude test orb)

WEBPOS=/scratch/neunhoef/mywebpage.pub/Computer/Software/Gap/orb

towww: archive
	echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >${WEBPOS}.version
	echo '<mixer>' >>${WEBPOS}.version
	cat VERSION >>${WEBPOS}.version
	echo '</mixer>' >>${WEBPOS}.version
	cp PackageInfo.g ${WEBPOS}
	cp README ${WEBPOS}/README.orb
	cp doc/manual.pdf ${WEBPOS}/orb.pdf
	cp ../orb-`cat VERSION`.tar.gz ${WEBPOS}
	@echo
	@echo Now please adjust the archive link in 
	@echo "    " ${WEBPOS}.mixer !

##
##  This program is free software; you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation; version 2 of the License.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program; if not, write to the Free Software
##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##

