# 
#  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; 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 (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.  */
# 
#
# Various configurable paths (remember to edit Makefile.in, not Makefile)
#
#  $Id: //depot/gargoyle/clients/clients/Makefile.in#10 $
#  $DateTime: 2016/10/31 23:30:40 $
#  $Change: 3237 $
#  


# Top level hierarchy

prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@

# Pathname of directory to install the system binaries
SBINDIR = @sbindir@
# Pathname of directory to install the system binaries
BINDIR = @bindir@
# Pathname of directory to install the include files
INCLDEST = @includedir@
# Pathname of directory to install the library
LIBDEST =  @libdir@
# Pathname of directory to install the man page
MANDEST = @mandir@

# Pathname of preferred perl to use for perl scripts
PERL = @V_PERL@

# VPATH
srcdir = @srcdir@
VPATH = @srcdir@

#
# You shouldn't need to edit anything below.
#

CC = @CC@
CCOPT = @V_CCOPT@
INCLS = -I. -I../include -I../common @V_INCLS@ @LIBCARES_CFLAGS@
DEFS = @DEFS@ -DSYSCONFDIR=\"@sysconfdir@\" -DSHAREDSTATEDIR=\"@sharedstatedir@\"
COMPATLIB = @V_PCRE@ @COMPATLIB@ @LIB_SASL@ @LIB_XDR@ @LIBS@ @V_THREADS@ @V_GEOIPDEP@ @V_FTDEP@ @ZLIB@ @DNSLIB@ @LIBMAXMINDDB_LIBS@

# Standard CFLAGS
CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(EXTRA_CFLAGS)

INSTALL = @INSTALL@
RANLIB = @V_RANLIB@

#
# Flex and bison allow you to specify the prefixes of the global symbols
# used by the generated parser.  This allows programs to use lex/yacc
# and link against libpcap.  If you don't have flex or bison, get them.
#
LEX = @V_LEX@
YACC = @V_YACC@

# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.c.o:
	@rm -f $@
	$(CC) $(CFLAGS) -c $(srcdir)/$*.c

LIB = @INSTALL_LIB@/argus_parse.a @INSTALL_LIB@/argus_common.a @INSTALL_LIB@/argus_client.a

SRC = ra.c radium.c racount.c rasort.c rastream.c rabins.c racluster.c \
      ramanage.c ranonymize.c

PROGS = @INSTALL_BIN@/ra @INSTALL_BIN@/radium @INSTALL_BIN@/racount @INSTALL_BIN@/rasort \
	@INSTALL_BIN@/rastream @INSTALL_BIN@/rabins @INSTALL_BIN@/racluster \
	@INSTALL_BIN@/ramanage @INSTALL_BIN@/ranonymize

all: $(PROGS)

@INSTALL_BIN@/ra: ra.o $(LIB)
	$(CC) $(CFLAGS) -o $@ ra.o $(LIB) $(COMPATLIB)

@INSTALL_BIN@/radium: radium.o $(LIB)
	$(CC) $(CFLAGS) -o $@ radium.o $(LIB) $(COMPATLIB) @WRAPLIBS@

@INSTALL_BIN@/rabins: rabins.o $(LIB)
	$(CC) $(CFLAGS) -o $@ rabins.o $(LIB) $(COMPATLIB) @WRAPLIBS@

@INSTALL_BIN@/racluster: racluster.o $(LIB)
	$(CC) $(CFLAGS) -o $@ racluster.o $(LIB) $(COMPATLIB)

@INSTALL_BIN@/racount: racount.o $(LIB)
	$(CC) $(CFLAGS) -o $@ racount.o $(LIB) $(COMPATLIB)

@INSTALL_BIN@/ramanage: ramanage.o ramanage_sha1.o $(LIB)
	$(CC) $(CFLAGS) -o $@ ramanage.o ramanage_sha1.o $(LIB) $(COMPATLIB) @LIBCURL@ @LIBCARES_LIBS@

ramanage_sha1.o: ../common/sha1.c
	$(CC) $(CFLAGS) -c $^ -o $@

@INSTALL_BIN@/ranonymize: ranonymize.o $(LIB)
	$(CC) $(CFLAGS) -o $@ ranonymize.o $(LIB) $(COMPATLIB)

@INSTALL_BIN@/rasort: rasort.o $(LIB)
	$(CC) $(CFLAGS) -o $@ rasort.o $(LIB) $(COMPATLIB)
 
@INSTALL_BIN@/rastream: rastream.o $(LIB)
	$(CC) $(CFLAGS) -o $@ rastream.o $(LIB) $(COMPATLIB)

# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
# hack the extra indirection

OBJ =	$(SRC:.c=.o)

CLEANFILES = $(OBJ) $(PROGS) ramanage_sha1.o

install: force all
	[ -d $(DESTDIR)$(BINDIR) ] || \
		(mkdir -p $(DESTDIR)$(BINDIR); chmod 755 $(DESTDIR)$(BINDIR))
	[ -d $(DESTDIR)$(SBINDIR) ] || \
		(mkdir -p $(DESTDIR)$(SBINDIR); chmod 755 $(DESTDIR)$(SBINDIR))
	$(INSTALL) @INSTALL_BIN@/ra $(DESTDIR)$(BINDIR)/ra
	$(INSTALL) @INSTALL_BIN@/rabins $(DESTDIR)$(BINDIR)/rabins
	$(INSTALL) @INSTALL_BIN@/racluster $(DESTDIR)$(BINDIR)/racluster
	$(INSTALL) @INSTALL_BIN@/racount $(DESTDIR)$(BINDIR)/racount
	$(INSTALL) @INSTALL_BIN@/radium $(DESTDIR)$(SBINDIR)/radium
	$(INSTALL) @INSTALL_BIN@/ramanage $(DESTDIR)$(BINDIR)/ramanage
	$(INSTALL) @INSTALL_BIN@/ranonymize $(DESTDIR)$(BINDIR)/ranonymize
	$(INSTALL) @INSTALL_BIN@/rasort $(DESTDIR)$(BINDIR)/rasort
	$(INSTALL) @INSTALL_BIN@/rastream $(DESTDIR)$(BINDIR)/rastream

uninstall: force all
	rm -f $(DESTDIR)$(BINDIR)/ra
	rm -f $(DESTDIR)$(BINDIR)/rabins
	rm -f $(DESTDIR)$(BINDIR)/racluster
	rm -f $(DESTDIR)$(BINDIR)/racount
	rm -f $(DESTDIR)$(SBINDIR)/radium
	rm -f $(DESTDIR)$(BINDIR)/ramanage
	rm -f $(DESTDIR)$(BINDIR)/ranonymize
	rm -f $(DESTDIR)$(BINDIR)/rasort
	rm -f $(DESTDIR)$(BINDIR)/rastream

.PHONY: clean mostlyclean distclean realclean clobber

clean:
	rm -f $(CLEANFILES)

clobber realclean distclean:
	rm -f $(CLEANFILES) Makefile 

tags: $(TAGFILES)
	ctags -wtd $(TAGFILES)

force:	/tmp
depend:	$(GENSRC) force
	../bin/mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC) ../common/sha1.c
