
# Makefile for Mup (and auxiliary programs mupdisp and mkmupfnt).
# This is not an optimal makefile; instead it tries to be very simple,
# and easy to understand, so it can be easily modified, if needed.

# On most Linux/Unix type systems, just doing
#	make install
# as root will probably work.
# (You really only need to be root to copy the products into the system bin.
# If you change BINDIR to point to some other writeable bin, you wouldn't
# need to be root.)

# If you want mupdisp to support Linux console mode, make sure you have
# the svgalib package installed, then find the two commented-out lines below
# related to Linux console support, and uncomment them.

# Lines you might conceivably want to change are commented.
# Any line without any comment by it is very unlikely to ever need changing.

#-----------------------------------------------------------------------

# This defines where to put the Mup program.
# You could change this to /usr/local/bin or your own bin if you like.
BINDIR = /usr/bin

# This is the name of your C compiler.
# gcc would be fine here too, if you have it.
CC = cc

# -O option turns on optimization for most C compilers
# You can add other options, if you like as appropriate for your C compiler
CFLAGS = -O

# You can change this if your X libraries are somewhere else
# (like /usr/X11R6/lib)
XLIB_LOCATION = /usr/X11/lib

#-----------------------------------------------------------------------

MUP_SRC =  \
	mup/abshorz.c \
	mup/absvert.c \
	mup/assign.c \
	mup/beaming.c \
	mup/beamstem.c \
	mup/brac.c \
	mup/charinfo.c \
	mup/check.c \
	mup/debug.c \
	mup/errors.c \
	mup/extchtbl.c \
	mup/font.c \
	mup/fontdata.c \
	mup/globals.c \
	mup/grpsyl.c \
	mup/ifgram.c \
	mup/lex.c \
	mup/locvar.c \
	mup/lyrics.c \
	mup/macros.c \
	mup/main.c \
	mup/mainlist.c \
	mup/map.c \
	mup/midi.c \
	mup/midiutil.c \
	mup/mkchords.c \
	mup/muschtbl.c \
	mup/nxtstrch.c \
	mup/parstssv.c \
	mup/parstuff.c \
	mup/phrase.c \
	mup/plutils.c \
	mup/print.c \
	mup/prntdata.c \
	mup/prntmisc.c \
	mup/prnttab.c \
	mup/prolog.c \
	mup/range.c \
	mup/rational.c \
	mup/relvert.c \
	mup/restsyl.c \
	mup/roll.c \
	mup/setgrps.c \
	mup/setnotes.c \
	mup/ssv.c \
	mup/stuff.c \
	mup/symtbl.c \
	mup/tie.c \
	mup/trantab.c \
	mup/trnspose.c \
	mup/undrscre.c \
	mup/utils.c \
	mup/ytab.c

MUP_HDRS = \
	mup/defines.h \
	mup/extchar.h \
	mup/globals.h \
	mup/muschar.h \
	mup/rational.h \
	mup/ssvused.h \
	mup/structs.h \
	mup/ytab.h

MUPDISP_SRC = \
	mupdisp/at386.c \
	mupdisp/do_cmd.c \
	mupdisp/dos.c \
	mupdisp/genfile.c \
	mupdisp/init.c \
	mupdisp/linvga.c \
	mupdisp/mupdisp.c \
	mupdisp/xterm.c

MUPDISP_HDRS = mupdisp/dispttyp.h mupdisp/mupdisp.h

MUPDISP_BITMAPS = mupdisp/help.bm mupdisp/waitmsg.bm

MKMUPFNT_SRC = mkmupfnt/mkmupfnt.c

#---------------------------------------------------------------

all: mup/mup mupdisp/mupdisp mkmupfnt/mkmupfnt

mup/mup: $(MUP_HDRS) $(MUP_SRC)
	$(CC) $(CFLAGS) -o $@ $(MUP_SRC) -lm

mupdisp/mupdisp: $(MUPDISP_HDRS) $(MUPDISP_BITMAPS) $(MUPDISP_SRC)
	$(CC) $(CFLAGS) -L$(XLIB_LOCATION) -o $@ -DNO_VGA_LIB $(MUPDISP_SRC) -lX11
	# For Linux console mode support, comment out the previous line
	# and uncomment the following line
	# $(CC) $(CFLAGS) -L$(XLIB_LOCATION) -o $@ $(MUPDISP_SRC) -lvga -lX11 -lm

mkmupfnt/mkmupfnt: $(MKMUPFNT_SRC)
	$(CC) $(CFLAGS) -o $@ $(MKMUPFNT_SRC)

install:	all
	cp mup/mup $(BINDIR)/mup
	cp mkmupfnt/mkmupfnt $(BINDIR)/mkmupfnt
	cp mupdisp/mupdisp $(BINDIR)/mupdisp
	# For Linux console mode support, uncomment the following line
	# chown root $(BINDIR)/mupdisp ; chmod 4755 $(BINDIR)/mupdisp

clean:
	rm -f mup/*.o mupdisp/*.o mkmupfnt/*.o

clobber:	clean
	rm -f mup/mup mupdisp/mupdisp mkmupfnt/mkmupfnt
