# 
#  Argus-5.0 Client Software. Tools to read, analyze and manage Argus data.
#  Copyright (c) 2000-2024 QoSient, LLC
#  All rights reserved.
# 
#  This program is free software, released under the GNU General
#  Public License; 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 3, or any later version.
#
#  Other licenses are available through QoSient, LLC.
#  Inquire at info@qosient.com.
#
#  This program is distributed 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.
#
#

NOOP = $(SHELL) -c true
NOECHO = @

CC = @CC@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

DEFS = @DEFS@
LIBS = @LIBS@
WRAPLIBS = @WRAPLIBS@
VERSION = @PACKAGE_VERSION@.@PACKAGE_RELEASE@

CFLAGS = -g $(EXTRA_CFLAGS)
LDFLAGS = -g

prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
perlextlib = @PERL_EXT_LIB@

srcdir = @srcdir@
incdir = @prefix@/include
docdir = @datadir@/doc/argus-clients-5.0

#### End of system configuration section. ####

SHELL = /bin/sh

DIRS = @DIRS@
INSTDIRS = @DIRS@ ./include
OSXPACKAGE_INSTDIRS = ./clients ./examples/ratop ./examples/ratrace
CLEANDIRS = @DIRS@ ./pkg


DISTFILES = AUTHORS CHANGES CREDITS ChangeLog INSTALL MANIFEST Makefile.in \
	include lib man support aclocal.m4 acsite.m4 config configure configure.ac \
	.threads bin clients examples common debian pkg perllib pythonlib README.rst VERSION 

.c.o:
	$(CC) -c $(CPPFLAGS) $(DEFS) $(CFLAGS) $<

.PHONY: install installdirs install-perl uninstall-perl

all: force
	@set -e ; for i in  $(DIRS) ; do \
		if [ -d $$i ] ; then \
		echo "making in $$i"; \
		(cd $$i > /dev/null; $(MAKE));\
		fi; \
	done

.PHONY: all uninstall uninstall-perl

clients: common
examples: common
include: common

install: install-perl force installdirs
	@for i in  $(INSTDIRS) ; do \
		if [ -d $$i ] ; then \
		echo "making in $$i"; \
		(cd $$i > /dev/null; $(MAKE) install); \
		fi; \
	done
	$(INSTALL) -m 0644 $(srcdir)/support/Config/rarc $(DESTDIR)$(prefix)/argus/rarc
	$(INSTALL) -m 0644 $(srcdir)/support/Config/delegated-ipv4-latest $(DESTDIR)$(prefix)/argus/delegated-ipv4-latest
	$(INSTALL) -m 0644 $(srcdir)/support/Config/wireshark.manuf.txt $(DESTDIR)$(prefix)/argus/wireshark.manuf.txt
	$(INSTALL) -m 0644 $(srcdir)/support/Config/std.sig $(DESTDIR)$(prefix)/argus/std.sig
	$(INSTALL) -m 0755 $(srcdir)/bin/argusclientbug $(DESTDIR)@bindir@/argusclientbug
	[ -d $(DESTDIR)@mandir@ ] || \
		(mkdir -p $(DESTDIR)@mandir@; chmod 755 $(DESTDIR)@mandir@)
	[ -d $(DESTDIR)@mandir@/man1 ] || \
		(mkdir -p $(DESTDIR)@mandir@/man1; chmod 755 $(DESTDIR)@mandir@/man1)
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ra.1 \
		$(DESTDIR)@mandir@/man1/ra.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rabins.1 \
		$(DESTDIR)@mandir@/man1/rabins.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/racluster.1 \
		$(DESTDIR)@mandir@/man1/racluster.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/raconvert.1 \
		$(DESTDIR)@mandir@/man1/raconvert.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/racount.1 \
		$(DESTDIR)@mandir@/man1/racount.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/radecode.1 \
		$(DESTDIR)@mandir@/man1/radecode.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/radns.1 \
		$(DESTDIR)@mandir@/man1/radns.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/radump.1 \
		$(DESTDIR)@mandir@/man1/radump.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/raevent.1 \
		$(DESTDIR)@mandir@/man1/raevent.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rafilteraddr.1 \
		$(DESTDIR)@mandir@/man1/rafilteraddr.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ragen.1 \
		$(DESTDIR)@mandir@/man1/ragen.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ragraph.1 \
		$(DESTDIR)@mandir@/man1/ragraph.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ragrep.1 \
		$(DESTDIR)@mandir@/man1/ragrep.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rahisto.1 \
		$(DESTDIR)@mandir@/man1/rahisto.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ralabel.1 \
		$(DESTDIR)@mandir@/man1/ralabel.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ranonymize.1 \
		$(DESTDIR)@mandir@/man1/ranonymize.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rapath.1 \
		$(DESTDIR)@mandir@/man1/rapath.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rapolicy.1 \
		$(DESTDIR)@mandir@/man1/rapolicy.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rasort.1 \
		$(DESTDIR)@mandir@/man1/rasort.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ramanage.1 \
		$(DESTDIR)@mandir@/man1/ramanage.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rasql.1 \
		$(DESTDIR)@mandir@/man1/rasql.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rasqlcheckconf.1 \
		$(DESTDIR)@mandir@/man1/rasqlcheckconf.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rasqlinsert.1 \
		$(DESTDIR)@mandir@/man1/rasqlinsert.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rasqltimeindex.1 \
		$(DESTDIR)@mandir@/man1/rasqltimeindex.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rastream.1 \
		$(DESTDIR)@mandir@/man1/rastream.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/rastrip.1 \
		$(DESTDIR)@mandir@/man1/rastrip.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ratrace.1 \
		$(DESTDIR)@mandir@/man1/ratrace.1
	$(INSTALL) -m 0644 $(srcdir)/man/man1/ratop.1 \
		$(DESTDIR)@mandir@/man1/ratop.1
	[ -d $(DESTDIR)@mandir@/man5 ] || \
		(mkdir -p $(DESTDIR)@mandir@/man5; chmod 755 $(DESTDIR)@mandir@/man5)
	[ -d $(DESTDIR)@mandir@/man8 ] || \
		(mkdir -p $(DESTDIR)@mandir@/man8; chmod 755 $(DESTDIR)@mandir@/man8)
	$(INSTALL) -m 0644 $(srcdir)/man/man5/rarc.5 \
		$(DESTDIR)@mandir@/man5/rarc.5
	$(INSTALL) -m 0644 $(srcdir)/man/man5/racluster.conf.5 \
		$(DESTDIR)@mandir@/man5/racluster.conf.5
	$(INSTALL) -m 0644 $(srcdir)/man/man5/racolor.conf.5 \
		$(DESTDIR)@mandir@/man5/racolor.conf.5
	$(INSTALL) -m 0644 $(srcdir)/man/man5/ralabel.conf.5 \
		$(DESTDIR)@mandir@/man5/ralabel.conf.5
	$(INSTALL) -m 0644 $(srcdir)/man/man5/radium.conf.5 \
		$(DESTDIR)@mandir@/man5/radium.conf.5
	$(INSTALL) -m 0644 $(srcdir)/man/man5/ranonymize.5 \
		$(DESTDIR)@mandir@/man5/ranonymize.5
	$(INSTALL) -m 0644 $(srcdir)/man/man8/radium.8 \
		$(DESTDIR)@mandir@/man8/radium.8

	[ -d $(DESTDIR)@prefix@ ] || \
		(mkdir -p $(DESTDIR)@prefix@; chmod 755 $(DESTDIR)@prefix@)
	[ -d $(DESTDIR)$(docdir) ] || \
		(mkdir -p $(DESTDIR)$(docdir); chmod 755 $(DESTDIR)$(docdir))
	$(INSTALL) -m 0644 $(srcdir)/README.rst $(DESTDIR)$(docdir)

install-perl:
	@set -e ; \
	mkdir -p $(DESTDIR)$(perlextlib)/qosient ; \
	$(INSTALL) -m 0644 $(srcdir)/lib/perl5/qosient/util.pm \
	           $(DESTDIR)$(perlextlib)/qosient/util.pm

uninstall: uninstall-perl
	@for i in  $(INSTDIRS) ; do \
		if [ -d $$i ] ; then \
			echo "making in $$i"; \
			(cd $$i > /dev/null; $(MAKE) uninstall); \
		fi; \
	done
	rm -f $(DESTDIR)@bindir@/argusclientbug
	rm -f $(DESTDIR)@mandir@/man1/ra.1
	rm -f $(DESTDIR)@mandir@/man1/rabins.1
	rm -f $(DESTDIR)@mandir@/man1/racluster.1
	rm -f $(DESTDIR)@mandir@/man1/raconvert.1
	rm -f $(DESTDIR)@mandir@/man1/racount.1
	rm -f $(DESTDIR)@mandir@/man1/radecode.1
	rm -f $(DESTDIR)@mandir@/man1/radns.1
	rm -f $(DESTDIR)@mandir@/man1/radump.1
	rm -f $(DESTDIR)@mandir@/man1/raevent.1
	rm -f $(DESTDIR)@mandir@/man1/rafilteraddr.1
	rm -f $(DESTDIR)@mandir@/man1/ragen.1
	rm -f $(DESTDIR)@mandir@/man1/ragraph.1
	rm -f $(DESTDIR)@mandir@/man1/ragrep.1
	rm -f $(DESTDIR)@mandir@/man1/rahisto.1
	rm -f $(DESTDIR)@mandir@/man1/ralabel.1
	rm -f $(DESTDIR)@mandir@/man1/ranonymize.1
	rm -f $(DESTDIR)@mandir@/man1/rapath.1
	rm -f $(DESTDIR)@mandir@/man1/rapolicy.1
	rm -f $(DESTDIR)@mandir@/man1/rasort.1
	rm -f $(DESTDIR)@mandir@/man1/rasql.1
	rm -f $(DESTDIR)@mandir@/man1/rasqlcheckconf.1
	rm -f $(DESTDIR)@mandir@/man1/rasqlinsert.1
	rm -f $(DESTDIR)@mandir@/man1/rasqltimeindex.1
	rm -f $(DESTDIR)@mandir@/man1/rastream.1
	rm -f $(DESTDIR)@mandir@/man1/rastrip.1
	rm -f $(DESTDIR)@mandir@/man1/ratrace.1
	rm -f $(DESTDIR)@mandir@/man1/ratop.1
	rm -f $(DESTDIR)@mandir@/man5/rarc.5
	rm -f $(DESTDIR)@mandir@/man5/racluster.conf.5
	rm -f $(DESTDIR)@mandir@/man5/ralabel.conf.5
	rm -f $(DESTDIR)@mandir@/man5/radium.conf.5
	rm -f $(DESTDIR)@mandir@/man5/ranonymize.5
	rm -f $(DESTDIR)@mandir@/man5/racolor.conf.5
	rm -f $(DESTDIR)@mandir@/man8/radium.8
	rm -f $(DESTDIR)@mandir@/man8/ragen.8
	rm -rf $(DESTDIR)$(docdir)
	rm -rf $(DESTDIR)$(prefix)/argus
	rm -f $(DESTDIR)@datarootdir@/argus-clients/std.sig

uninstall-perl:
	rm -f $(DESTDIR)$(perlextlib)/qosient/util.pm

installdirs:
	${srcdir}/config/mkinstalldirs \
	$(DESTDIR)@sbindir@ \
	$(DESTDIR)@bindir@ \
	$(DESTDIR)@infodir@ \
	$(DESTDIR)$(prefix)/argus \
	$(DESTDIR)@datarootdir@/argus-clients

Makefile: Makefile.in config.status
	$(SHELL) config.status

config.status: configure
	$(srcdir)/configure --no-create

TAGS: $(SRCS)
	etags $(SRCS)


.PHONY: clean mostlyclean distclean realclean dist

clean: force
	rm -f config.log
	rm -f pkg/osx/*.pkg
	@for i in $(CLEANDIRS) ; do \
		if [ -d $$i ] ; then \
		(cd $$i > /dev/null; $(MAKE) clean ); \
		fi; \
	done

mostlyclean: clean

distclean: force
	rm -f config.*
	rm -f TAGS
	rm -f lib/*.a
	rm -f bin/ra*
	rm -f Makefile
	rm -f *~
	@for i in $(CLEANDIRS) ; do \
		if [ -d $$i ] ; then \
		(cd $$i > /dev/null; $(MAKE) distclean); \
		fi; \
	done

clobber realclean: force
	rm -f TAGS
	rm -f lib/*.a
	rm -f include/argus_config.h
	rm -f include/tm.h
	rm -f include/*~
	rm -f bin/ra*
	rm -f pkg/osx/*.pkg
	rm -rf pkg/osx/BUILDROOT/
	rm -rf log
	rm -rf autom4te.cache

	@for i in $(CLEANDIRS) ; do \
		if [ -d $$i ] ; then \
		(cd $$i > /dev/null; $(MAKE) distclean); \
		fi; \
	done

	rm -f *~
	rm -f ./Makefile config.*


dist: $(DISTFILES) distclean
	echo argus-clients-`cat VERSION` > .fname
	rm -rf `cat .fname`
	mkdir `cat .fname`
	tar cf - $(DISTFILES) | (cd `cat .fname`; tar xpf -)
	ls -lR `cat .fname` | fgrep CVS: | sed 's/:$///' > exfile
	env COPYFILE_DISABLE=1 tar -X exfile -chzf `cat .fname`.tar.gz `cat .fname`
	rm -rf `cat .fname` .fname exfile

force:  /tmp
depend: $(GENSRC) force
	@for i in $(DIRS) ; do \
		if [ -d $$i ] ; then \
		(cd $$i > /dev/null; $(MAKE) depend ); \
		fi; \
	done

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
