# Makefile for hbb

# Where to put the service's boot file.
Hbbstart=/etc/rc.local/hbb

# Where to put the configuration file.
Hbbconf=/etc/hbb.conf

# Where to put the binary
Hbb=/sbin/hbb

# Owner of the above files
Owner=0

#---------- No changes required after this line. ----
# Copyright 1999 Robert Ransbottom

Version="1.0"
Release=Alpha

OldVersion=""
OldRelease=""

CFLAGS = -Wall -D"conffile=\"${Hbbconf}\""

hbb: hbb.c

all:  hbb hbb.conf hbb.boot


install: all
	cp hbb.boot $(Hbbstart)
	chown $(Owner) $(Hbbstart)
	chmod 0755 $(Hbbstart)
	cp hbb $(Hbb)
	chown $(Owner) $(Hbb)
	chmod 0755 $(Hbb)
	cp hbb.conf $(Hbbconf)
	chown $(Owner) $(Hbbconf)
	chmod 0644 $(Hbbconf)

hbb.boot: boot.sh
	sh boot.sh $(Hbb)


clean:
	rm -rf Dist hbb-$(Version).shar hbb-$(Version).tar.gz hbb-$(Version) 
	rm -rf hbb hbb.boot core distrib tar shar

distrib: 
	mkdir Dist
	co -r$(Release) License && cp License Dist/
	co -r$(Release) README && cp README Dist/
	co -r$(Release) boot.sh && cp boot.sh Dist/
	co -r$(Release) hbb.c && cp hbb.c Dist/
	co -r$(Release) hbb.conf && cp hbb.conf Dist/
	co -r$(Release) try && cp try Dist/
	co -r$(Release) Makefile && cp Makefile Dist/
	echo $(Release) > Dist/Release
	mv Dist hbb-$(Version)
	touch distrib

shar: distrib
	cd hbb-$(Version) &&   shar -cV * > ../hbb-$(Version).shar   && cd ..
	touch shar


tar: distrib
	tar -czf hbb-$(Version).tar.gz ./hbb-$(Version)
	touch tar
