# Don't edit Makefile!  Use conf-* for configuration.
#
# Generated by spac see http://untroubled.org/spac/

SHELL=/bin/sh

DEFAULT: all

all: libraries programs docs

authenticated.o: compile authenticated.c relay-ctrl.h
	./compile authenticated.c

chdir.o: compile chdir.c relay-ctrl.h
	./compile chdir.c

clean: TARGETS
	rm -f `cat TARGETS`

clean-spac: clean AUTOFILES
	rm -f `cat AUTOFILES`

compile: conf-cc
	( echo '#!/bin/sh'; \
	  echo 'source=$$1; shift'; \
	  echo 'base=`echo "$$source" | sed -e s:\\\\.c$$::`'; \
	  echo exec `head -n 1 conf-cc` -I.  '-o $${base}.o -c $$source $${1+"$$@"}'; \
	) >compile
	chmod 755 compile

docs: relay-ctrl-send.8.html relay-ctrl-allow.8.html relay-ctrl-check.8.html relay-ctrl-age.8.html relay-ctrl-udp.8.html

install: INSTHIER conf-bin conf-man
	bg-installer -v <INSTHIER
	bg-installer -c <INSTHIER

libraries: relay-ctrl.a

load: conf-ld
	( echo '#!/bin/sh';\
	  echo 'main="$$1"; shift';\
	  echo exec `head -n 1 conf-ld` -L. '-o "$$main" "$$main.o" $${1+"$$@"}'; \
	) >load
	chmod 755 load

makelib: 
	( echo '#!/bin/sh'; \
	  echo 'lib="$$1"; shift';\
	  echo 'rm -f "$$lib"';\
	  echo 'ar cr "$$lib" $${1+"$$@"}';\
	  echo 'ranlib "$$lib"';\
	) >makelib
	chmod 755 makelib

programs: relay-ctrl-check relay-ctrl-send relay-ctrl-age relay-ctrl-allow relay-ctrl-chdir relay-ctrl-udp

relay-ctrl-age: relay-ctrl-age.o load
	./load relay-ctrl-age  -lbg 

relay-ctrl-age.8.html: relay-ctrl-age.8
	man --html='cat %s' ./relay-ctrl-age.8 > relay-ctrl-age.8.html

relay-ctrl-age.o: compile relay-ctrl-age.c
	./compile relay-ctrl-age.c

relay-ctrl-allow: relay-ctrl-allow.o load relay-ctrl.a
	./load relay-ctrl-allow relay-ctrl.a -lbg 

relay-ctrl-allow.8.html: relay-ctrl-allow.8
	man --html='cat %s' ./relay-ctrl-allow.8 > relay-ctrl-allow.8.html

relay-ctrl-allow.o: compile relay-ctrl-allow.c relay-ctrl.h
	./compile relay-ctrl-allow.c

relay-ctrl-chdir: relay-ctrl-chdir.o load
	./load relay-ctrl-chdir  -lbg 

relay-ctrl-chdir.o: compile relay-ctrl-chdir.c
	./compile relay-ctrl-chdir.c

relay-ctrl-check: relay-ctrl-check.o load relay-ctrl.a
	./load relay-ctrl-check relay-ctrl.a -lbg 

relay-ctrl-check.8.html: relay-ctrl-check.8
	man --html='cat %s' ./relay-ctrl-check.8 > relay-ctrl-check.8.html

relay-ctrl-check.o: compile relay-ctrl-check.c relay-ctrl.h
	./compile relay-ctrl-check.c

relay-ctrl-send: relay-ctrl-send.o load relay-ctrl.a
	./load relay-ctrl-send relay-ctrl.a -lbg 

relay-ctrl-send.8.html: relay-ctrl-send.8
	man --html='cat %s' ./relay-ctrl-send.8 > relay-ctrl-send.8.html

relay-ctrl-send.o: compile relay-ctrl-send.c relay-ctrl.h
	./compile relay-ctrl-send.c

relay-ctrl-udp: relay-ctrl-udp.o load relay-ctrl.a
	./load relay-ctrl-udp relay-ctrl.a -lbg 

relay-ctrl-udp.8.html: relay-ctrl-udp.8
	man --html='cat %s' ./relay-ctrl-udp.8 > relay-ctrl-udp.8.html

relay-ctrl-udp.o: compile relay-ctrl-udp.c relay-ctrl.h
	./compile relay-ctrl-udp.c

relay-ctrl.a: makelib authenticated.o chdir.o touch.o validate_ip.o
	./makelib relay-ctrl.a authenticated.o chdir.o touch.o validate_ip.o

touch.o: compile touch.c relay-ctrl.h
	./compile touch.c

validate_ip.o: compile validate_ip.c relay-ctrl.h
	./compile validate_ip.c

