# $Id: Makefile.in,v 1.97 2001/12/22 02:34:35 vkurland Exp $

SHELL = @SHELL@
DESTDIR = 

@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ../..

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
bindir = @bindir@
sbindir = @sbindir@
iconsdir = $(prefix)/share/pixmaps/fwbuilder

mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

AS = @AS@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
LIBTOOL = @LIBTOOL@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ 

CPPFLAGS = @CPPFLAGS@ @DEFS@

LIBFWBUILDER_CFLAGS = @LIBFWBUILDER_CFLAGS@
LIBFWBUILDER_LIBS = @LIBFWBUILDER_LIBS@
LIBFWBUILDER_STATICLIBS = @LIBFWBUILDER_STATICLIBS@
LIBFWBUILDER_LIBPATH = @LIBFWBUILDER_LIBPATH@

# GNOMEUI_LIBS = @GNOMEUI_LIBS@
# GNOME_CONFIG = @GNOME_CONFIG@
# GNOME_INCLUDEDIR = @GNOME_INCLUDEDIR@
# GNOME_LIBDIR = @GNOME_LIBDIR@
# GNOME_LIBS = @GNOME_LIBS@

GTKMM_CFLAGS = @GTKMM_CFLAGS@
GTKMM_CONFIG = @GTKMM_CONFIG@
GTKMM_LIBS = @GTKMM_LIBS@

GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@


GLIB_CFLAGS = @GLIB_CFLAGS@
GLIB_LIBS = @GLIB_LIBS@

PTHREAD_LIB = @PTHREAD_LIB@
RANLIB = @RANLIB@
VERSION = @VERSION@
# XPM_LIBS = @XPM_LIBS@

XML_CFLAGS   = @XML_CFLAGS@
XML_LIBS     = @XML_LIBS@

XSLT_CFLAGS  = @XSLT_CFLAGS@
XSLT_LIBS    = @XSLT_LIBS@

IMLIB_CFLAGS = @IMLIB_CFLAGS@
IMLIB_LIBS   = @IMLIB_LIBS@

OTHER_LIBS = @LIBS@

PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@


CFLAGS = -Wall  -g -I. -I$(top_srcdir) $(CPPFLAGS) \
	$(LIBFWBUILDER_CFLAGS) $(GTKMM_CFLAGS) $(GLIB_CFLAGS) \
	$(XML_CFLAGS) $(XSLT_CFLAGS) $(IMLIB_CFLAGS)

LDFLAGS = -g 
LIBS =  $(LIBFWBUILDER_LIBS) $(XPM_LIBS) $(GTKMM_LIBS) $(GLIB_LIBS) \
	$(XSLT_LIBS) $(XML_LIBS) $(IMLIB_LIBS) \
	$(OTHER_LIBS)

STATICLIBS = $(LIBFWBUILDER_STATICLIBS) $(XPM_LIBS) $(GTKMM_LIBS) $(GLIB_LIBS)\
	$(XSLT_LIBS) $(XML_LIBS) \
	$(OTHER_LIBS)

CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CFLAGS) 

CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@


LTCXXCOMPILE =  $(LIBTOOL) --mode=compile $(CXXCOMPILE)
# LTCXXLINK = $(LIBTOOL) --mode=link $(CXXLINK) -R$(DESTDIR)$(libdir) -L$(DESTDIR)$(libdir) 
LTCXXLINK = $(LIBTOOL) --mode=link $(CXXLINK)
LTINSTALL = $(LIBTOOL) --mode=install $(INSTALL) 


#
# script listicons.sh generates list of icon files actually used in
# fwbuilder_prefs.xml . This way we install only icons we need (distribution
# comes with some more icons, both experimental and rejected ones)
#
ICONS = $(shell ./listicons.sh)

GLADE_SOURCES= \
	AboutDialog_glade.cc \
	SimpleProgressDialog_glade.cc \
	WhereUsedDialog_glade.cc \
	ASDruidP05Dialog_glade.cc \
	ASDruidP10Dialog_glade.cc \
	ASDruidP11Dialog_glade.cc \
	ASDruidP12Dialog_glade.cc \
	ASDruidP20Dialog_glade.cc \
	ASDruidP30Dialog_glade.cc \
	ASDruidP40Dialog_glade.cc \
	ASDruidP44Dialog_glade.cc \
	ASDruidP47Dialog_glade.cc \
	ASDruidP49Dialog_glade.cc \
	DiscoveryDruidP05Dialog_glade.cc \
	DiscoveryDruidP10Dialog_glade.cc \
	DiscoveryDruidP20Dialog_glade.cc \
	DiscoveryDruidP30Dialog_glade.cc \
	DiscoveryDruidP35Dialog_glade.cc \
	DiscoveryDruidP40Dialog_glade.cc \
	DiscoveryDruidP50Dialog_glade.cc \
	DiscoveryDruidP51Dialog_glade.cc \
	DiscoveryDruidP53Dialog_glade.cc \
	DiscoveryDruidP65Dialog_glade.cc \
	DiscoveryDruidP70Dialog_glade.cc \
	CommentDialog_glade.cc \
	FWObjectDialog_glade.cc \
	FirewallDialog_glade.cc \
	GroupDialog_glade.cc \
	HostDialog_glade.cc \
	ICMPServiceDialog_glade.cc \
	IPServiceDialog_glade.cc \
	InterfaceDialog_glade.cc \
	MessageDialog_glade.cc \
	NATDialog_glade.cc \
	NetworkDialog_glade.cc \
	OptionsDlg_glade.cc \
	PolicyDialog_glade.cc \
	RuleOptionsDialog_glade.cc \
	TCPServiceDialog_glade.cc \
	UDPServiceDialog_glade.cc \
	CustomServiceDialog_glade.cc \
	TimeDialog_glade.cc \
	FilterDialog_glade.cc \
	FindDialog_glade.cc


SOURCES = \
		$(GLADE_SOURCES) \
		glademm_support.cc \
		ObjectDescriptor.cc \
		StockButton.cc \
		PixmapButton.cc \
                IconList.cc \
		InterfaceListWidget.cc \
		Druid.cc \
                AboutDialog.cc \
		SimpleProgressDialog.cc \
		WhereUsedDialog.cc \
                MessageDialog.cc \
                main_window.cc \
                main_window2.cc \
                main_window_menu.cc \
		ObjectQuickView.cc \
                FWObjectDatabaseGUI.cc \
		DialogFactory.cc \
                FWObjectClipboard.cc \
                FWObjectDialog.cc \
                InterfaceDialog.cc \
                HostDialog.cc \
                FirewallDialog.cc \
                NetworkDialog.cc \
                TCPServiceDialog.cc \
                UDPServiceDialog.cc \
		CustomServiceDialog.cc \
                ICMPServiceDialog.cc \
                IPServiceDialog.cc \
		TimeDialog.cc \
                GroupDialog.cc \
                Preferences.cc \
                Resources.cc \
                PolicyListElement.cc \
                PolicyListItem.cc \
                PolicyList.cc \
                PolicyDialog.cc \
                PrintDialog.cc \
                NATDialog.cc \
                BuiltinDialog.cc \
                DialogPlugin.cc \
                ObjectTree.cc \
		FWObjectBook.cc \
                BackgroundOpWidget.cc \
                BackgroundRunWidget.cc \
                ExecBgr.cc \
                ExecBgr-2.cc \
                ExecDialog.cc \
		GenericBackgroundOpDialog.cc \
                ttips.cc \
                OptionsDlg.cc \
		RuleOptionsDialog.cc \
                FileSel.cc \
                ListOfIcons.cc \
                helpers.cc \
                StandardRulesDruid.cc \
                StandardRulesDruid2.cc \
		DiscoveryDruid.cc \
                ASDruidP05Dialog.cc \
                ASDruidP10Dialog.cc \
                ASDruidP11Dialog.cc \
                ASDruidP12Dialog.cc \
                ASDruidP20Dialog.cc \
                ASDruidP30Dialog.cc \
                ASDruidP40Dialog.cc \
                ASDruidP44Dialog.cc \
                ASDruidP47Dialog.cc \
                ASDruidP49Dialog.cc \
		DiscoveryDruidP05Dialog.cc \
		DiscoveryDruidP10Dialog.cc \
		DiscoveryDruidP20Dialog.cc \
		DiscoveryDruidP30Dialog.cc \
		DiscoveryDruidP35Dialog.cc \
		DiscoveryDruidP40Dialog.cc \
		DiscoveryDruidP50Dialog.cc \
		DiscoveryDruidP51Dialog.cc \
		DiscoveryDruidP53Dialog.cc \
		DiscoveryDruidP65Dialog.cc \
		DiscoveryDruidP70Dialog.cc \
		TableOfObjects.cc \
		TableOfObjectsWithTypeChoice.cc \
		FilterDialog.cc \
		FindDialog.cc \
		CommentDialog.cc \
		IPAddressWidget.cc \
		OptionMenuWidget.cc \
                fwbuilder.cc \
                gen_popup_menu.cc


OBJECTS = \
		glade_stubs.o \
		glademm_support.o \
		ObjectDescriptor.o \
		StockButton.o \
		PixmapButton.o \
                IconList.o \
		InterfaceListWidget.o \
		Druid.o \
                AboutDialog.o \
		SimpleProgressDialog.o \
		WhereUsedDialog.o \
                MessageDialog.o \
                main_window.o \
                main_window2.o \
                main_window_menu.o \
		ObjectQuickView.o \
                FWObjectDatabaseGUI.o \
		DialogFactory.o \
                FWObjectClipboard.o \
                FWObjectDialog.o \
                InterfaceDialog.o \
                HostDialog.o \
                FirewallDialog.o \
                NetworkDialog.o \
                TCPServiceDialog.o \
                UDPServiceDialog.o \
		CustomServiceDialog.o \
                ICMPServiceDialog.o \
                IPServiceDialog.o \
		TimeDialog.o \
                GroupDialog.o \
                Preferences.o \
                Resources.o \
                PolicyListElement.o \
                PolicyListItem.o \
                PolicyList.o \
                PolicyDialog.o \
                PrintDialog.o \
                NATDialog.o \
                BuiltinDialog.o \
                DialogPlugin.o \
                ObjectTree.o \
		FWObjectBook.o \
                BackgroundOpWidget.o \
                BackgroundRunWidget.o \
                ExecBgr.o \
                ExecBgr-2.o \
                ExecDialog.o \
		GenericBackgroundOpDialog.o \
                ttips.o \
                OptionsDlg.o \
		RuleOptionsDialog.o \
                FileSel.o \
                ListOfIcons.o \
                helpers.o \
                StandardRulesDruid.o \
                StandardRulesDruid2.o \
                ASDruidP05Dialog.o \
                ASDruidP10Dialog.o \
                ASDruidP11Dialog.o \
                ASDruidP12Dialog.o \
                ASDruidP20Dialog.o \
                ASDruidP30Dialog.o \
                ASDruidP40Dialog.o \
                ASDruidP44Dialog.o \
                ASDruidP47Dialog.o \
                ASDruidP49Dialog.o \
		DiscoveryDruid.o \
		DiscoveryDruidP05Dialog.o \
		DiscoveryDruidP10Dialog.o \
		DiscoveryDruidP20Dialog.o \
		DiscoveryDruidP30Dialog.o \
		DiscoveryDruidP35Dialog.o \
		DiscoveryDruidP40Dialog.o \
		DiscoveryDruidP50Dialog.o \
		DiscoveryDruidP51Dialog.o \
		DiscoveryDruidP53Dialog.o \
		DiscoveryDruidP65Dialog.o \
		DiscoveryDruidP70Dialog.o \
		TableOfObjects.o \
		TableOfObjectsWithTypeChoice.o \
		FilterDialog.o \
		FindDialog.o \
		CommentDialog.o \
		IPAddressWidget.o \
		OptionMenuWidget.o \
                fwbuilder.o \
                gen_popup_menu.o 

all: fwbuilder

clean:
	rm -f *.o
	rm -f glade_stubs.cc
	rm -f core fwbuilder fwbuilder-static
	rm -f *_glade *.bak

#	cd gnome-wrappers && $(MAKE) clean

distclean: clean
	rm -f Makefile
	rm -f glade_stubs.cc

glade_stubs.o:	glade_stubs.cc

glade_stubs.cc: $(GLADE_SOURCES)
	rm -f glade_stubs.cc
	touch glade_stubs.cc
	for d in $(GLADE_SOURCES); do echo "#include \"$$d\"" >> glade_stubs.cc; done;

from-glade:
	cd glade; glade-- --noautoconf fwbuilder.glade; ./post-glade.pl

glade/postglade.timestamp: *_glade.cc *_glade.hh
	cd glade; ./post-glade.pl

# $(OBJECTS): glade/postglade.timestamp

fwbuilder: $(OBJECTS)  Makefile
	@rm -f fwbuilder
	$(CXXLINK) $(LDFLAGS) $(OBJECTS) $(LIBS)

fwbuilder-static: $(OBJECTS)  Makefile
	@rm -f fwbuilder
	$(CXXLINK) $(LDFLAGS) $(OBJECTS) $(STATICLIBS)


.cc.o:
	$(CXXCOMPILE) -c $<

depend:
	makedepend -o o $(CFLAGS) $(SOURCES)


install: fwbuilder install-icons
	$(mkinstalldirs) $(DESTDIR)$(bindir)
	$(INSTALL_PROGRAM) -s fwbuilder $(DESTDIR)$(bindir)

uninstall: uninstall-icons
	rm -f $(DESTDIR)$(bindir)/fwbuilder

install-icons: $(ICONS)
	$(mkinstalldirs) $(DESTDIR)$(iconsdir)
	@list='$(ICONS)'; for p in $$list; do \
	  if test -f $$p; then \
	    echo cp $$p $(DESTDIR)$(iconsdir); \
	    cp $$p $(DESTDIR)$(iconsdir); \
	  else :; fi; \
	done

uninstall-icons:
	rm -rf $(DESTDIR)$(iconsdir)


run:
	sh -c "LD_LIBRARY_PATH=$(LIBFWBUILDER_LIBPATH) ./fwbuilder "

debug:
	sh -c "LD_LIBRARY_PATH=`libfwbuilder-config --libpath` gdb fwbuilder"
