prefix = $(HOME)/.irc
version = 2
revision = 2
subrev = 1
config = $(prefix)/ux22-settings
help = $(prefix)/ux22-help

SRCS = kernel.irc display.irc uhcache.irc spy.irc channel.irc list.irc userlist.irc ui.irc prot.irc tabkey.irc netsplit.irc help.irc misc.irc announce.irc

# if the ex line fails, the user will just have to
# put up with an unpacked script

ux22: $(SRCS) dummy
	@if [ -f ux22 ]; then echo \#\#\# Old script is `cat ux22|wc -c` bytes; fi
	echo '@ux.version=[$(version).$(revision)]'>ux22.irc
	echo '@ux.subrev=[$(subrev)]'>>ux22.irc
	echo '@ux.configpath=[$(config)]'>>ux22.irc
	cat $(SRCS) >> ux22.irc
#	-ex ux22.irc < pack.ex
	cp header.irc ux22
	cat ux22.irc>>ux22
	@echo \#\#\# Script is `cat ux22|wc -c` bytes

dummy:

install: ux22
	-mkdir -p $(prefix)
	-rm -rf $(prefix)/ux22 $(help)
	cp ux22 $(prefix)/ux22
	cp -r help $(help)
	echo '@ux.uhelp_path=[$(help)]'>ux22.cfg
	@echo
	@echo \#\#\# UNIFEX-$(version).$(revision).$(subrev) installed in $(prefix)
	@if [ ! -f $(config) ]; then \
		cp ux22.cfg $(config); \
		echo \#\#\# Configuration file set to $(config); \
	fi
	@echo \#\#\# Help files installed in $(help)
	@echo

clean:
	-rm -f ux22 ux22.cfg ux22.irc
