# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am

# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

# Ncat Makefile


SHELL = @SHELL@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
includedir = @includedir@
oldincludedir = /usr/include

top_builddir = .

pkgdatadir = $(datadir)/ncat

INSTALL = @INSTALL@
transform = @program_transform_name@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
srcdir = @srcdir@

NBASEDIR = ../nbase
NSOCKDIR = ../nsock/src
NSOCKLIB = $(NSOCKDIR)/libnsock.a
NBASELIB = $(NBASEDIR)/libnbase.a

CC = @CC@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
DEFS = @DEFS@ -DNCAT_DATADIR="\"$(pkgdatadir)\""
# With GCC, add extra security checks to source code.
DEFS += -D_FORTIFY_SOURCE=2
INCLS = -I. -I.. -I../nsock/include/ -I$(NBASEDIR)
RM = rm -f
OPENSSL_LIBS = @OPENSSL_LIBS@
HAVE_OPENSSL = @HAVE_OPENSSL@
PCAP_LIBS = @PCAP_LIBS@

CPPFLAGS += $(DEFS) $(INCLS)

SHTOOL = ../shtool

# DESTDIR can be used by package maintainers to install Ncat under its 
# usual directory structure into a different tree.
DESTDIR = 

SRCS = ncat_main.c ncat_connect.c ncat_core.c ncat_posix.c ncat_listen.c ncat_proxy.c ncat_broker.c ncat_hostmatch.c ncat_ssl.c base64.c http.c util.c sys_wrap.c
OBJS = ncat_main.o ncat_connect.o ncat_core.o ncat_posix.o ncat_listen.o ncat_proxy.o ncat_broker.o ncat_hostmatch.o ncat_ssl.o base64.o http.o util.o sys_wrap.o

DATAFILES = certs/ca-bundle.crt

TARGET = ncat
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = $(CONFIG_HEADER) config.cache config.log config.status

TEST_PROGS = test/addrset test/test-uri test/test-cmdline-split
ifneq ($(HAVE_OPENSSL),)
TEST_PROGS += test/cert-match-name
endif

all: $(TARGET) $(TEST_PROGS)

$(TARGET): $(OBJS) $(NSOCKLIB)
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LIBS)

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

Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) \
	  && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status

config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
	$(SHELL) ./config.status --recheck

$(srcdir)/configure: $(srcdir)/configure.ac $(CONFIGURE_DEPENDENCIES)
	cd $(srcdir) && autoconf

config.h:
	@if test ! -f config.h; then \
		cd $(top_builddir) && CONFIG_FILES= CONFIG_HEADERS=config.h \
		        $(SHELL) ./config.status; \
	fi

test/addrset: test/addrset.o ncat_core.o ncat_hostmatch.o sys_wrap.o util.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LIBS)

test/test-uri: test/test-uri.o base64.o http.o ncat_core.o ncat_hostmatch.o sys_wrap.o util.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LIBS)

test/test-cmdline-split: test/test-cmdline-split.c ncat_posix.o ncat_core.o ncat_hostmatch.o sys_wrap.o util.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LIBS)

test/cert-match-name: test/cert-match-name.c ncat_core.o ncat_hostmatch.o ncat_ssl.o sys_wrap.o util.o
	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(NSOCKLIB) $(NBASELIB) $(OPENSSL_LIBS) $(PCAP_LIBS) $(LIBS)

.PHONY: uninstall all clean distclean

$(NBASEDIR)/libnbase.a: $(NBASEDIR)/Makefile
	@echo Compiling libnbase;
	cd $(NBASEDIR) && $(MAKE)

$(NSOCKDIR)/libnsock.a: $(NSOCKDIR)/Makefile
	@echo Compiling libnsock;
	cd $(NSOCKDIR) && $(MAKE)

install: $(TARGET)
	@echo Installing Ncat;
	$(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir)/man1
	$(INSTALL) -c -m 755 -s ncat $(DESTDIR)$(bindir)/ncat
	$(INSTALL) -c -m 644 $(DATAFILES) $(DESTDIR)$(pkgdatadir)/
	$(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/$(TARGET).1

uninstall:
	@echo Uninstalling Ncat;
	$(RM) -f $(bindir)/$(TARGET)
	$(RM) -f $(mandir)/man1/$(TARGET).1

ncat_clean:
	$(RM) -f *.o test/*.o $(TARGET) $(TEST_PROGS) makefile.dep

clean: ncat_clean

distclean: clean
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

TESTS = ./test-addrset.sh ./test-cmdline-split ./test-uri
ifneq ($(HAVE_OPENSSL),)
TESTS += ./test-wildcard.sh
endif

check:
	cd test && ($(addsuffix &&,$(TESTS)) echo "All tests passed.")

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

makefile.dep:
	$(CC) -MM $(CPPFLAGS) $(SRCS) > $@
include makefile.dep