.PHONY: test

all:
	CC=@cc@ CXX=@cxx@ CXXFLAGS="@arch_cxxflag@" LIBPATH=@libpath@ DISK=@disk@ ADMB_CONFIGURE=1 make --directory=src --file=@makefile@
	rm -rf `find build/@target@/@target@ -type d -name .svn`
	@printf "\nBuild completed for @target@\n"
	@printf "To install ADMB to '@prefix@/bin' and '@prefix@/admb', type 'make install'\n"

debug:
	DEBUG=1 CC=@cc@ CXX=@cxx@ CXXFLAGS="@arch_cxxflag@" LIBPATH=@libpath@ DISK=@disk@ ADMB_CONFIGURE=1 make --directory=src --file=@makefile@
	rm -rf `find build/@target@/@target@ -type d -name .svn`
	@printf "\nBuild completed for @target@\n"
	@printf "To install ADMB to '@prefix@/bin' and '@prefix@/admb', type 'make install'\n"

dist:
	mkdir -p build/dist
	rm -rf build/dist/admb-@version@
	svn export . build/dist/admb-@version@
	rm -rf build/dist/admb-@version@/test
	cp configure build/dist/admb-@version@
	cd build/dist && zip -r admb-@version@.zip admb-@version@

verify:
	DISK=@disk@ ADMB_CXXFLAGS=@arch_cxxflag@ ADMB_LDFLAGS=@arch_cxxflag@ make --directory=src --file=@makefile@ verify

install:
	install -d -m 755 @prefix@/admb/bin @prefix@/admb/include @prefix@/admb/lib @prefix@/admb/docs @prefix@/admb/examples
	install -m 755 build/@target@/@target@/bin/* @prefix@/admb/bin
	install -m 644 build/@target@/@target@/include/* @prefix@/admb/include
	install -m 644 build/@target@/@target@/lib/* @prefix@/admb/lib
	install -m 644 LICENSE @prefix@/admb
	install -m 644 README.txt @prefix@/admb
	install -m 644 Makefile @prefix@/admb
	#install -m 644 scripts/admb/admb-bin @prefix@/admb/bin
	cp -Rf build/@target@/@target@/docs/* @prefix@/admb/docs
	cp -Rf build/@target@/@target@/examples/* @prefix@/admb/examples

zip:
	cd build/@target@; zip -r @target@.zip @target@

dmg:
	@dmgtask@

test:
	export ADMB_HOME=${PWD}/build/@target@/@target@; export PATH=${PWD}/build/@target@/@target@/bin:$(PATH); make --directory=test

clean:
	rm -rvf build/@target@
	make --directory=src --file=@makefile@ clean
	make --directory=test clean
	make --directory=scripts/configure clean
