#
# Copyright (C) 1994,1995 Lars Fenneberg
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.

include ./MCONFIG

all: ipacct ipacctd ipquota man

ipacct:	ipacct.o
ipacct.c: pathnames.h

ipacctd: ipacctd.o
ipacctd.c: pathnames.h

ipquota:
	$(MAKE) -C ipquota
.PHONY: ipquota

man:	ipacct.8 ipacctd.8 ipacct_weight.5
	$(MAKE) -C ipquota man	

patches:
	$(MAKE) -C patches all
.PHONY:	patches

install: ipacct ipacctd ipquota
	install -m 0755 -o bin -g bin ipacct $(SBINDIR)
	install -m 0750 -o bin -g bin ipacctd $(USR_SBINDIR)
	$(MAKE) -C ipquota install

install.man: ipacct.8 ipacctd.8 ipacct_weight.5
	install -m $(MAN_MODE) -o $(MAN_USER) -g $(MAN_GROUP) ipacct.8 $(MAN_DIR_SYSTEM)
	install -m $(MAN_MODE) -o $(MAN_USER) -g $(MAN_GROUP) ipacctd.8 $(MAN_DIR_SYSTEM)
	install -m $(MAN_MODE) -o $(MAN_USER) -g $(MAN_GROUP) ipacct_weight.5 $(MAN_DIR_FORMAT)
	$(MAKE) -C ipquota install.man

clean:
	rm -f *.o *~ core
	$(MAKE) -C ipquota clean
	$(MAKE) -C patches clean

clobber: clean
	rm -f ipacct ipacctd *.8 *.5 pathnames.h ipacct-$(VERSION).tar.gz ipacct-$(VERSION).tar.gz.uue
	$(MAKE) -C ipquota clobber
	$(MAKE) -C patches clobber

dist: clobber
	-rm -rf ./ipacct-$(VERSION)
	mkdir ./ipacct-$(VERSION)
	cp -P `find . -not -name ./ipacct-$(VERSION) -a -not -type d` ./ipacct-$(VERSION)
	chmod -R a+rw ./ipacct-$(VERSION)
	chmod a+x `find ./ipacct-$(VERSION) -type d`
	tar cvzf ipacct-$(VERSION).tar.gz ./ipacct-$(VERSION)
	rm -rf ./ipacct-$(VERSION)
