#
# Annex src/Makefile Sat Mar  1 17:16:23 EST 2003
#

SHELL    = /bin/sh
PARALLEL = 1
SRCDIRS =  libannex netadm na erpcd ien-116 timserver aprint rtelnet
BFS    = /usr/local/annex/bfs

all:    $(SRCDIRS)

install: install-src install-bfs install-man

build: install-src

install-src:
	-@sh -c 'for srcdir in $(SRCDIRS) ; \
	do \
	/bin/echo "*** Installing $$srcdir ***" > /dev/tty ; \
	cd $$srcdir ; \
	make -f ../make.config -f Makefile install ; \
	cd .. ; \
	done'

install-bfs:
	@/bin/echo "*** Installing Annex images ***" > /dev/tty
	-@sh -c '\
	    if [ ! -d $(BFS) ] ; \
	    then \
		/bin/mkdir $(BFS) ; \
	    fi ; \
	    cd ../bfs ; \
	    /usr/local/src/annex/ra_R5.4/src/installer readonly $(BFS) oper.*.enet ; \
	    cd $(BFS) ; \
	    >> config.annex ; \
	    >> motd'

clean:
	-@sh -c 'for srcdir in $(SRCDIRS) ; \
	do \
	cd $$srcdir ; \
	make -f ../make.config -f Makefile clean ; \
	cd .. ; \
	done'

libannex:    libannex.local

libannex.local:
	@/bin/echo "*** Building libannex ***" > /dev/tty
	cd libannex ; make -f ../make.config -f Makefile 

netadm:    netadm.local

netadm.local:
	@/bin/echo "*** Building netadm ***" > /dev/tty
	cd netadm ; make -f ../make.config -f Makefile 

na:    na.local

na.local:
	@/bin/echo "*** Building na ***" > /dev/tty
	cd na ; make -f ../make.config -f Makefile 

erpcd:    erpcd.local

erpcd.local:
	@/bin/echo "*** Building erpcd ***" > /dev/tty
	cd erpcd ; make -f ../make.config -f Makefile 

ien-116:    ien-116.local

ien-116.local:
	@/bin/echo "*** Building ien-116 ***" > /dev/tty
	cd ien-116 ; make -f ../make.config -f Makefile 

timserver:    timserver.local

timserver.local:
	@/bin/echo "*** Building timserver ***" > /dev/tty
	cd timserver ; make -f ../make.config -f Makefile 

aprint:    aprint.local

aprint.local:
	@/bin/echo "*** Building aprint ***" > /dev/tty
	cd aprint ; make -f ../make.config -f Makefile 

rtelnet:    rtelnet.local

rtelnet.local:
	@/bin/echo "*** Building rtelnet ***" > /dev/tty
	cd rtelnet ; make -f ../make.config -f Makefile 

# MANTYPE = V7
MANDIR = ../man/src
MANEXTS = 1 5 8
MANBASE = /usr/local/man
MANMAP = 
PACKABLE = false

install-man:
	@/bin/echo "*** Installing manual pages ***" > /dev/tty
	@sh -c 'cd $(MANDIR) ; for ext in $(MANEXTS) ; do \
	for page in *.$$ext ; do \
		dstname=$(MANBASE)/man$$ext/$$page ; \
		/bin/rm -f $$dstname* ; \
		/bin/cp $$page $$dstname ; \
		$(PACKABLE) && pack -f $$dstname ; \
		/bin/chmod 444 $$dstname* ; \
	done ; \
	done'
