BINDIR=/usr/local/bin

all: 
	@echo
	@echo "   You must specify internal or gateway"
	@echo
	@echo "           make gateway"
	@echo "                or"
	@echo "           make internal"
	@echo
	@echo "        make install_gateway"
	@echo "                or"
	@echo "        make install_internal"
	@echo
	@echo "            make lint"
	@echo "            make clean"
	@echo

install: all

internal: telout ftpout

gateway: 
	(cd ftp; $(MAKE))
	(cd telnet; $(MAKE))

telout:	telout.c
	$(CC) -o telout telout.c

ftpout:	telout.c
	$(CC) -o ftpout telout.c

lint: 
	@echo "Linting telout/ftpout" > lint.out
	@echo >> lint.out
	lint telout.c >> lint.out
	@echo >> lint.out
	@echo "Linting acftp" >> lint.out
	@echo >> lint.out
	(cd ftp; $(MAKE) lint) >> lint.out
	@echo >> lint.out
	@echo "Linting actelnet" >> lint.out
	@echo >> lint.out
	(cd telnet; $(MAKE) lint) >> lint.out

install_internal: internal
	install -c -s -o telout -g telout -m 6755 telout ${BINDIR}/telout
	install -c -s -o ftpout -g ftpout -m 6755 ftpout ${BINDIR}/ftpout

install_gateway: 
	(cd ftp; $(MAKE) install)
	(cd telnet; $(MAKE) install)

clean: 
	rm -f telout.o telout ftpout ftpout.o
	(cd ftp; $(MAKE) clean)
	(cd telnet; $(MAKE) clean)

