# Generated automatically from Makefile.in by configure.
# $Id: Makefile,v 1.17 2002/04/28 19:33:21 bergo Exp $

#
# rgpsp toplevel Makefile
# Particular implementations are in this source tree
# (most installation is handled in the toplevel Makefile,
#  not here)

CCC = c++
CXXFLAGS= -DTHIS_SYSTEM=Linux
PROGINST = /usr/bin/ginstall -c
PREFIX = /usr/local
DEBUG =

DESTDIR =

all: valid_rgpsp_implementations

valid_rgpsp_implementations:   rgpsp_linux

# common code between (almost) all native implementations
rgpsp_common.o: rgpsp_common.cc
	$(CCC) $(CXXFLAGS) $(DEBUG) -I.. -c rgpsp_common.cc -o rgpsp_common.o 

# rtop (polling via piped top)
rgpsp_rtop: rgpsp_common.o
	$(MAKE) -C rtop

# linux /proc poller
rgpsp_linux: rgpsp_common.o
	$(MAKE) -C linux

# freebsd poller
rgpsp_freebsd: rgpsp_common.o
	$(MAKE) -C freebsd

# dummy
install:
	@echo "** use the make target install_net_all of the upper"
	@echo "   directory instead."
	@echo

# install man page
install_docs:
	$(PROGINST) -d              $(DESTDIR)$(PREFIX)/man/man1
	$(PROGINST) rgpsp.1         $(DESTDIR)$(PREFIX)/man/man1

#install config file and sysv init script
install_scripts:
	mkdir -p $(DESTDIR)/etc/rc.d/init.d
	@if [ -f $(DESTDIR)/etc/rgpsp.conf ] ; then echo "/etc/rgpsp.conf already exists, keeping the old one."; else $(PROGINST) sample.rgpsp.conf $(DESTDIR)/etc/rgpsp.conf; fi
	$(PROGINST) -d $(DESTDIR)/etc/rc.d/init.d
	@if [ -f $(DESTDIR)/etc/rc.d/init.d/rgpsp ] ; then echo "Backing up existing rgpsp sysv script to rgpsp.orig" ; mv $(DESTDIR)/etc/rc.d/init.d/rgpsp $(DESTDIR)/etc/rc.d/init.d/rgpsp.orig; fi
	@if [ -f /etc/rc.d/init.d/functions -a -f /etc/sysconfig/network ] ; then echo "Installing RedHat-like rgpsp script."; $(PROGINST) rh.rgpsp.sh $(DESTDIR)/etc/rc.d/init.d/rgpsp; else echo "Installing non-RedHat-like rgpsp script." ; $(PROGINST) sysv.rgpsp.sh $(DESTDIR)/etc/rc.d/init.d/rgpsp; fi

install_rpm:
	$(PROGINST) -d              $(DESTDIR)$(PREFIX)/man/man1
	$(PROGINST) rgpsp.1         $(DESTDIR)$(PREFIX)/man/man1

clean:
	$(MAKE) -C rtop clean
	$(MAKE) -C linux clean
	$(MAKE) -C freebsd clean
	rm -f *~ *.o

distclean:
	$(MAKE) -C rtop  distclean
	$(MAKE) -C linux distclean
	$(MAKE) -C freebsd distclean
	@rm -f freebsd/Makefile
	@rm -f linux/Makefile
	@rm -f rtop/Makefile
	@rm -f *~ *.o *.cache config.*


