# Borland command line compiler bcc version 5.5 Makefile for abcMIDI package 
# Can also use mingw or gnu standard make program with this makefile.
# 
#
# compilation #ifdefs - you may need to change these defined to get
#                       the code to compile with a different C compiler.
#
# NOFTELL in midifile.c and tomidi.c selects a version of the file-writing
#         code which doesn't use file seeking.
#
# PCCFIX in mftext.c midifile.c midi2abc.c
#        comments out various things that aren't available in PCC
#
# USE_INDEX causes index() to be used instead of strchr(). This is needed
#           by some pre-ANSI C compilers.
#
# ASCTIME causes asctime() to be used instead of strftime() in pslib.c.
#         If ANSILIBS is not set, neither routine is used.
#
# ANSILIBS causes code to include some ANSI standard headers
#
# KANDR selects functions prototypes without argument prototypes.
#
# If your Borland compiler is in another path, change the include
# and library options below in CFLAGS and LDFLAGS.
#
CC=bcc32
CFLAGS=-g0 -v -WC -c -I/bcc55/include
LNK=ilink32
LDFLAGS=/ap  /L\bcc55\lib c0x32.obj
LDFLAGS2=import32.lib cw32.lib

all : abc2midi.exe midi2abc.exe abc2abc.exe mftext.exe yaps.exe midicopy.exe abcmatch.exe

abc2midi.exe : parseabc.obj store.obj genmidi.obj queues.obj midifile.obj parser2.obj stresspat.obj -lm
	$(LNK) $(LDFLAGS) parseabc.obj genmidi.obj store.obj \
	queues.obj midifile.obj parser2.obj stresspat.obj, abc2midi.exe,, $(LDFLAGS2)

abc2abc.exe : parseabc.obj toabc.obj
	$(LNK) $(LDFLAGS) parseabc.obj toabc.obj,    abc2abc.exe,, $(LDFLAGS2) 

midi2abc.exe : midifile.obj midi2abc.obj 
	$(LNK) $(LDFLAGS)  midifile.obj midi2abc.obj, midi2abc.exe,, $(LDFLAGS2)

mftext.exe : midifile.obj mftext.obj crack.obj
	$(LNK) $(LDFLAGS) midifile.obj mftext.obj crack.obj, mftext.exe,, $(LDFLAGS2)

yaps.exe : parseabc.obj yapstree.obj drawtune.obj debug.obj pslib.obj position.obj parser2.obj
	$(LNK)  $(LDFLAGS)  parseabc.obj yapstree.obj drawtune.obj debug.obj \
	position.obj pslib.obj parser2.obj, yaps.exe,,  $(LDFLAGS2)

midicopy.exe: midicopy.obj
	$(LNK)  $(LDFLAGS) midicopy.obj, midicopy.exe,, $(LDFLAGS2)

abcmatch.exe : abcmatch.obj matchsup.obj parseabc.obj
	$(LNK) $(LDFLAGS) abcmatch.obj matchsup.obj parseabc.obj,  abcmatch.exe,, $(LDFLAGS2)



# common parser object code
#
parseabc.obj : parseabc.c abc.h parseabc.h
	$(CC) $(CFLAGS) parseabc.c 

parser2.obj : parser2.c parseabc.h parser2.h
	$(CC) $(CFLAGS) parser2.c

# objects needed by abc2abc
#
toabc.obj : toabc.c abc.h parseabc.h
	$(CC) $(CFLAGS) toabc.c 

# objects needed by abc2midi
#
store.obj : store.c abc.h parseabc.h parser2.h genmidi.h 
	$(CC) $(CFLAGS) store.c 

genmidi.obj : genmidi.c abc.h midifile.h genmidi.h
	$(CC) $(CFLAGS) genmidi.c 

stresspat.obj : stresspat.c
	$(CC) $(CFLAGS) stresspat.c

queues.obj: queues.c genmidi.h
	$(CC) $(CFLAGS) queues.c

# common midifile library
#
# could use -DNOFTELL here
midifile.obj : midifile.c midifile.h
	$(CC) $(CFLAGS) midifile.c

# objects needed by yaps
#
yapstree.obj: yapstree.c abc.h parseabc.h structs.h drawtune.h parser2.h
	$(CC) $(CFLAGS) yapstree.c

drawtune.obj: drawtune.c structs.h sizes.h abc.h drawtune.h
	$(CC) $(CFLAGS) drawtune.c

pslib.obj: pslib.c drawtune.h
	$(CC) $(CFLAGS) pslib.c

position.obj: position.c abc.h structs.h sizes.h
	$(CC) $(CFLAGS) position.c

debug.obj: debug.c structs.h abc.h
	$(CC) $(CFLAGS) debug.c

# objects needed by midi2abc
#
midi2abc.obj : midi2abc.c midifile.h
	$(CC) $(CFLAGS) midi2abc.c

# objects for mftext
#
crack.obj : crack.c
	$(CC) $(CFLAGS) crack.c 

mftext.obj : mftext.c midifile.h
	$(CC) $(CFLAGS) mftext.c

# objects for midicopy
#
midicopy.obj :midicopy.c midicopy.h
	$(CC) $(CFLAGS) midicopy.c

# objects for abcmatch
#
abcmatch.obj : abcmatch.c abc.h
	$(CC) $(CFLAGS) abcmatch.

matchsup.obj : matchsup.c abc.h parseabc.h parser2.h
	$(CC) $(CFLAGS) matchsup.c



clean:
	rm *.obj
	rm *.exe

zipfile: midi2abc.exe abc2midi.exe mftext.exe yaps.exe abc2abc.exe midicopy.exe
	zip pcexe2.zip *.exe readme.txt abcguide.txt demo.abc yaps.txt
