###############################################################################
#                                                                             #
#   Copyright 2005 University of Cambridge Computer Laboratory.               #
#                                                                             #
#   This file is part of Nprobe.                                              #
#                                                                             #
#   Nprobe 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.                                       #
#                                                                             #
#   Nprobe 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 Nprobe; if not, write to the Free Software                     #
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA #
#                                                                             #
###############################################################################


#
# Patch Td into Nprobe Make architecture
#

#
# Where to find various stuff
#

# Archive root
NPROBE_ROOT = ../..

# Import all relative paths defined at top level
include $(NPROBE_ROOT)/Makefile.paths

all tdump depend install: config_both
	$(MAKE) -C $(LIBPCAP_DIR) $(MFLAGS) $@
	$(MAKE) -C $(TD_DIR) $(MFLAGS) $@

clean clobber distclean install: config_both
	$(MAKE) -C $(LIBPCAP_DIR) $(MFLAGS) $@
	$(MAKE) -C $(TD_DIR) $(MFLAGS) $@

libpcap: config_libpcap
	$(MAKE) -C $(LIBPCAP_DIR) $(MFLAGS) all

config_both: config_libpcap config_td

config_libpcap:
	(if [ ! -f $(LIBPCAP_DIR)/Makefile ];\
		then \
			echo 'Configuring libpcap'; \
			cd $(LIBPCAP_DIR); \
			./configure; \
			cd $(TD_ROOT); \
	fi)

config_td:
	(if [ ! -f $(TD_DIR)/Makefile ];\
		then \
			echo 'Configuring td'; \
			cd $(TD_DIR); \
			./configure; \
			cd $(TD_ROOT); \
	fi)


very_clean test_clean update_install:
