#
# Makefile for Eduardo's apps
#
include ../Makefile.common
CC        = gcc
INCDIR	  = -I.
LDFLAGS   = 
CFLAGS   += -D_SVID_SOURCE
#------------------------------------------------------------------------------

PROG1OBJS = startnet.o
PROG2OBJS = sethost.o 
PROG3OBJS = dnmirror.o
PROG4OBJS = dnping.o
PROG5OBJS = ctermd.o
PROG6OBJS = dnmount.o

PROG1 = startnet
PROG2 = sethost
PROG3 = dnmirror
PROG4 = dnping
PROG5 = ctermd
PROG6 = dnmount
MANPAGES1 = startnet.1 sethost.1 dnping.1 dnmirror.1 ctermd.1 dnmount.1
MANPAGES5 = decnet.conf.5

ALLPROGS=$(PROG1) $(PROG2) $(PROG3) $(PROG4) $(PROG5) 
ifeq (/usr/include/linux/dap_fs.h,$(wildcard /usr/include/linux/dap_fs.h))
ALLPROGS+=$(PROG6)
endif

all: $(ALLPROGS)

$(PROG1): $(PROG1OBJS)
	$(CC) -o $@ $^ $(LIBS)

$(PROG2): $(PROG2OBJS)
	$(CC) -o $@ $^ $(LIBS)

$(PROG3): $(PROG3OBJS)
	$(CC) -o $@ $^ $(LIBS)

$(PROG4): $(PROG4OBJS)
	$(CC) -o $@ $^ $(LIBS)

$(PROG5): $(PROG5OBJS)
	$(CC) -o $@ $^ $(LIBS)

$(PROG6): $(PROG6OBJS)
	$(CC) -o $@ $^ $(LIBS)

dep:	
	makedepend *.c 2>/dev/null

clean:
	rm -f $(PROG1) $(PROG2) $(PROG3) $(PROG4) $(PROG5) $(PROG6) *.o *.a *.so *~

install:
	install -d $(prefix)/sbin
	install -d $(prefix)/bin
	install -d $(prefix)/man/man8
	install -d $(prefix)/man/man5
	install -m 0750 -s $(PROG1) $(prefix)/sbin
	install -m 0755 -s $(PROG2) $(prefix)/bin
	install -m 0750 -s $(PROG3) $(prefix)/sbin
	install -m 0755 -s $(PROG4) $(prefix)/bin
	install -m 0750 -s $(PROG5) $(prefix)/sbin
	if [ -f $(PROG6) ]; then install -m 0750 -s $(PROG6) $(prefix)/sbin; fi
	install -m 0644 $(MANPAGES1) $(prefix)/man/man1
	install -m 0644 $(MANPAGES5) $(prefix)/man/man5
	if [ ! -f /etc/decnet.conf ]; then cp decnet.conf /etc; fi

# DO NOT DELETE THIS LINE -- make  depend  depends  on it.
