#
# Cluster Information Service - makefile
#

# Change the ports used by CIS: <CISD_PORT-1, CISD_PORT+NMONTORS>
#
#CFLAGS += -DCISD_PORT=500

# If you prefer separate monitors change this line
#
#DAEMONS = cisd sysmon procmon sockmon netmon
DAEMONS = cisd cismon

TOOLS = cis_info cis_rec cis_print cis_cut cis_merge

LIBRARIES = libCis.a libCisrec.a

CC =  gcc

# Debugging flags
#
#CFLAGS += -O0 -g -DDEBUG -D_GNU_SOURCE -Wall
CFLAGS += -O -D_GNU_SOURCE

VERSION=0.9.3

all:    #kernel
	
	@ $(MAKE) -C src 'CFLAGS=$(CFLAGS)' $(DAEMONS) $(LIBRARIES)
	@ echo Copying $(DAEMONS) to bin directory.
	@ cd src ; cp $(DAEMONS) ../bin
	@ echo Copying $(LIBRARIES) to lib directory.
	@ cd src ; cp $(LIBRARIES) ../lib
	@ $(MAKE) -C tools 'CFLAGS=$(CFLAGS)'
	cd tools ; cp $(TOOLS) ../bin

kernel: FORCE
	 $(MAKE) -C kernel
FORCE:

clean: 
	$(MAKE) -C tools clean
	$(MAKE) -C src clean
	$(MAKE) -C kernel clean
	cd bin ; rm -f $(DAEMONS) $(TOOLS)
	cd lib ; rm -f libCis.a libCisrec.a
        
install:
	cd bin ; cp -vf $(DAEMONS) /usr/sbin
	$(MAKE) -C tools install
	cd man ; cp -vf *.1 /usr/local/man/man1
	cd man ; cp -vf *.8 /usr/local/man/man8
