#
# Makefile for cheops
#
#

CFLAGS = @CFLAGS@
LIBS = @LIBS@

CFLAGS+=-Wall

CC=@CC@

prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
infodir = @infodir@

# According to the comments in install-sh, this won't work for multiple files
# if ./install-sh is what is used.
INSTALL = @INSTALL@

#Just to see what it says
THE_DEFS = @DEFS@

LIBS+=@cheops_needs_lresolv@

DEFAULT_PATH=$(datadir)/cheops

LIB_PATH=$(libdir)/cheops

CFLAGS+=-I..

ifdef DEFAULT_PATH
CFLAGS+=-DDEFAULT_PATH=\"$(DEFAULT_PATH)\"
endif

ifdef LIB_PATH
CFLAGS+=-DLIB_PATH=\"$(LIB_PATH)\"
endif

# Gnome or GTK support
CFLAGS+=@XTRACFLAGS@
LIBS+=@XTRALIBS@

# SNMP Support.
CFLAGS+=@SNMPCFLAGS@
LIBS+=@SNMPLFLAGS@

# Plugin method
CFLAGS+=@PLUGINCFLAG@
LIBS+=@PLUGINLIB@

PLUGINS=generic-connect.so vnc-connect.so http-monitor.so smtp-monitor.so \
        ftp-monitor.so ping-monitor.so dns-monitor.so

.SUFFIXES: .c .lo .so

.c.lo:
	$(CC) -fPIC $(CFLAGS) -c -o $@ $<
.lo.so:
	$(CC) -shared -o $@ $<
 

all: plugs

clean:
	rm -f $(OBJS) *.lo *.o *.so

plugs: $(PLUGINS)

distclean: clean
	rm -f Makefile config.status config.cache config.h

install: plugs
ifdef DEFAULT_PATH
	mkdir -p $(LIB_PATH)/plugins
	$(INSTALL) -d $(LIB_PATH)/plugins
	$(INSTALL) -s -m 555 $(PLUGINS) $(LIB_PATH)/plugins
else
	echo "No Default Path in Makefile"
endif

.PHONEY: all devclean
