#
# XINCDIR is the directory for the X11 include files.
#
XINCDIR = /usr/X11/include

#
# XLIBDIR is the directory for the X11 library files.
#
XLIBDIR = /usr/X11/lib

#
# XTRALIBS are any extra libraries your system might want
# for instance a SVR4 system might want -lns -lnsl -lsocket
#
# XTRALIBS = -lns -lnsl -lsocket
XTRALIBS =

#
# INSTALL is the install program
#
# INSTALL = cp
INSTALL = install

#
# INSTALLEXECFLAG are the flags used when installing executables
#
# INSTALLEXECFLAG =
INSTALLEXECFLAG = -c -m 755

#
# INSTALLTEXTFLAG are the flags used when installing text files
#
# INSTALLTEXTFLAG =
INSTALLTEXTFLAG = -c -m 644

#
# INSTALLMANFLAG are the flags used when installing the man pages
#
# INSTALLMANFLAG =
INSTALLMANFLAG = -c -m 444 -o bin -g bin

#
# INSTALLDIR is the directory where wishm and xdrum should go.
# If you change this, be sure to change the 1st line of
# xdrum script so the path to wishm is correct.
#
INSTALLDIR = /usr/local/bin

#
# TKLIBDIR is the directory where the wishm.tcl startup
# script should go.  wishm.tcl contains the default bindings
# for the drumgrid widget
#
TKLIBDIR = /usr/local/lib/tk

#
# LIBDIR is the directory where libraries like libtcl.a, libtk.a,
# and libtclm.a can be found.
#
LIBDIR = /usr/local/lib

#
# INCDIR is the directory where include files like tk.h, tclm.h
# mutil.h can be found
#
INCDIR = /usr/local/include

#
# If you don't have or don't need ranlib, set this to true
#
# RANLIB = true
RANLIB = ranlib

#
# NROFF is the command to format the man pages
#
NROFF = groff -mdoc -Tascii

#
# MANDIR is the directory when the man pages go
#
MANDIR = /usr/local/man

#
# MANSUB is the subdirectory for man pages
#
# MANSUB = man
MANSUB = cat

#
# MANEXT1 is the extension for man section 1 pages
#
MANEXT1 = 1

#
# MANEXT3 is the extension for man section 3 pages
#
MANEXT3 = 3

TKMSRCS = tkmGrid.c
TKMOBJS = tkmGrid.o
TKMLIB = libtkm.a

WISHMSRCS = main.c
WISHMOBJS = main.o
WISHMEXEC = wishm

SCRIPTS = xdrum

MAN1 = xdrum.1
MAN3 = drumgrid.3 wishmversion.3

MAN10 = xdrum.0
MAN30 = drumgrid.0 wishmversion.0

LIBPATH = -L. -L$(LIBDIR) -L$(XLIBDIR)
LIBS = -ltkm -ltclm -lmutil -ltk -ltcl -lX11 -lm $(XTRALIBS)
LFLAGS = $(LIBPATH) $(LIBS)

CFLAGS = -O -I$(INCDIR) -I$(XINCDIR)

CC = cc

.SUFFIXES: $(.SUFFIXES) .0 .1 .3

$(WISHMEXEC): $(WISHMOBJS) $(TKMLIB)
	$(CC) -o $(WISHMEXEC) $(WISHMOBJS) $(LFLAGS)

$(TKMLIB): $(TKMOBJS)
	ar cr $(TKMLIB) $(TKMOBJS)
	$(RANLIB) $(TKMLIB)

install: $(WISHMEXEC)
	$(INSTALL) $(INSTALLEXECFLAG) $(WISHMEXEC) $(SCRIPTS) $(INSTALLDIR)
	$(INSTALL) $(INSTALLTEXTFLAG) wishm.tcl $(TKLIBDIR)
	$(INSTALL) $(INSTALLTEXTFLAG) $(TKMLIB) $(LIBDIR)
	$(RANLIB) $(LIBDIR)/$(TKMLIB)
	$(INSTALL) $(INSTALLTEXTFLAG) tkm.h $(INCDIR)


install-man-cooked: $(MAN10) $(MAN30)
	$(INSTALL) $(INSTALLMANFLAG) $(MAN10) $(MANDIR)/$(MANSUB)$(MANEXT1)
	$(INSTALL) $(INSTALLMANFLAG) $(MAN30) $(MANDIR)/$(MANSUB)$(MANEXT3)

install-man-raw:
	$(INSTALL) $(INSTALLMANFLAG) $(MAN1) $(MANDIR)/$(MANSUB)$(MANEXT1)
	$(INSTALL) $(INSTALLMANFLAG) $(MAN3) $(MANDIR)/$(MANSUB)$(MANEXT3)

.1.0:
	$(NROFF) $< > $@

.3.0:
	$(NROFF) $< > $@

clean:
	rm -f $(WISHMOBJS) $(TKMOBJS) $(TKMLIB) $(WISHMEXEC) errlist core* \
	    $(MAN10) $(MAN30)

tkmGrid.o: tkm.h
