# tk3play for Digital Unix (MME audio service)
#
# installer

CD = cd
CP = /bin/cp
MAKE = make
MKDIR = /bin/mkdir
CHMOD = /bin/chmod
RM = /bin/rm -f
STRIP = strip
LN = ln -sf

# If you change BINDIR or TK3DIR make sure you change the 
# corresponding lines at the top of the tk3play script.

BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1
TCLBASE = /usr/local/lib
TK3DIR = /usr/local/lib/tk3play

BINFILES = tk3play

BINFULL = $(addprefix $(BINDIR)/, $(BINFILES) )

MANFILES = tk3play.1

MANFULL = $(addprefix $(MANDIR)/, $(MANFILES) )

TK3FILES = title.xbm close.xbm next.xbm pause.xbm play.xbm prev.xbm \
           system.tk3playrc playedit.tcl

TK3FULL = $(addprefix $(TK3DIR)/, $(TK3FILES) )


# Section to manage installation files

cleaninstall: uninstall install
	$(RM) $(OLDFILES)

uninstall:
	$(RM) $(BINFULL)
	$(RM) $(MANFULL)
	$(RM) -r $(TK3DIR)

install: $(TK3DIR) $(TK3FULL) $(BINDIR) $(BINFULL) $(MANFULL)

$(TK3DIR):
	$(MKDIR) $(TK3DIR)

$(BINDIR):
	@echo $(BINDIR) not found, please choose another install
	@echo location and update the makefile & tk3play accordingly
	@echo or create $(BINDIR) and add it to your path.

$(MANFULL): $(MANFILES)
	$(CP) $(MANFILES) $(MANDIR)

$(TK3DIR)/%.xbm: %.xbm
	$(CP) $< $@

$(TK3DIR)/%.tcl: %.tcl 
	$(CP) $< $@

$(TK3DIR)/system.tk3playrc: system.tk3playrc
	$(CP) $< $@

$(BINDIR)/tk3play: tk3play
	$(CP) $< $@

# This clean tries to return the local directories to their original 
# (just untarred) state.

clean:
	$(RM) *.o *~ core
