#!/usr/bin/make -f
#-*- makefile -*-
# Made with the aid of dh_make, by Craig Small
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
# Also some stuff taken from debmake scripts, by Christoph Lameter.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This is the debhelper compatibility version to use.
export DH_COMPAT=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

SHELL = /bin/bash

NS_VER := $(VERS)
DESTDIR = `pwd`/debian/tmp
prefix = $(DESTDIR)/usr
ja_dir = usr/lib/netscape/$(NS_VER)/netscape/ja
ja_DESTDIR = $(prefix)/lib/netscape/$(NS_VER)/netscape/ja

SCRIPT := debian/setmozfont.sh

build: build-stamp
build-stamp:
	dh_testdir

	# Add here commands to compile the package.
#	$(MAKE)

	sed -e 's/@NS_VER@/$(NS_VER)/g' \
		debian/postinst.in > debian/postinst
	sed -e 's/@NS_VER@/$(NS_VER)/g' \
		debian/prerm.in > debian/prerm

	chmod +x ${SCRIPT}
	${SCRIPT} 10 -o Netscape.small -f Netscape.ad-ja_euc
	${SCRIPT} 12 -o Netscape.normal -f Netscape.ad-ja_euc
	${SCRIPT} 14 -o Netscape.large -f Netscape.ad-ja_euc
	${SCRIPT} 16 -o Netscape.huge -f Netscape.ad-ja_euc

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -f Netscape.{small,normal,large,huge}

	# Add here commands to clean up after the build process.
#	-$(MAKE) clean

	dh_clean

install: DH_OPTIONS=-P$(DESTDIR)
install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs $(ja_dir)

	# Add here commands to install the package into debian/tmp.

# nethelp
#	(cd `pwd`/debian/tmp/usr/lib/netscape/$(NS_VER)/communicator-ja && \
#	 ln -s ../communicator/nethelp .)
#	(cd `pwd`/debian/tmp/usr/lib/netscape/$(NS_VER)/navigator-ja && \
#	 ln -s ../navigator/nethelp .)
# resource

	cp Netscape.{small,normal,large,huge} $(ja_DESTDIR)/

	ln -s Netscape.normal $(ja_DESTDIR)/Netscape

	cp -av bookmark.htm about splash plugins mail.msg LICENSE \
		$(ja_DESTDIR)/


# base
	(cd $(ja_DESTDIR);\
	 ln -s ../XKeysymDB .;\
	 ln -s ../libnullplugin-dynMotif.so .;\
	 ln -s ../java .;\
	)


# Build architecture-independent files here.
binary-indep: build install
#	dh_testversion
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installemacsen
#	dh_installinit
	dh_installcron
#	dh_installmanpages
#	dh_undocumented
	dh_installchangelogs 
	dh_link
	dh_compress
	dh_fixperms
	# You may want to make some executables suid here
	dh_suidregister
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install
# We have nothing to do by default.

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary
