<commit_before># MAKEFILE FOR PORTMIDI AND PORTTIME


# For debugging, define PM_CHECK_ERRORS
PMFLAGS = -DPM_CHECK_ERRORS
# Otherwise do not define PM_CHECK_ERRORS
# PMFLAGS = 

# Use this for linux alsa (0.9x) version
versions = pm_linux/pmlinuxalsa.o
ALSALIB = -lasound
VFLAGS = -DPMALSA

# Use this for null (a dummy implementation for no Midi I/O:
# versions = pmlinuxnull.o
# ALSALIB = 
# VFLAGS = -DPMNULL

pmlib = pm_linux/libportmidi.a

ptlib = porttime/libporttime.a

CC = gcc $(VFLAGS) $(PMFLAGS) -g -Ipm_common -Iporttime

pmobjects = pm_common/pmutil.o $(versions) pm_linux/pmlinux.o  \
	pm_common/portmidi.o pm_linux/pmlinuxalsa.o

ptobjects = porttime/porttime.o porttime/ptlinux.o 

current: all

all: $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread \
	pm_test/latency pm_test/midithru

$(pmlib): Makefile $(pmobjects)
	ar -cr $(pmlib) $(pmobjects)

$(ptlib): Makefile $(ptobjects)
	ar -cr $(ptlib) $(ptobjects)

pm_linux/pmlinuxalsa.o: Makefile pm_linux/pmlinuxalsa.c pm_linux/pmlinuxalsa.h
	$(CC) -c pm_linux/pmlinuxalsa.c -o pm_linux/pmlinuxalsa.o

pm_test/test: Makefile pm_test/test.o $(pmlib) $(ptlib)
	$(CC) pm_test/test.c -o pm_test/test $(pmlib) $(ptlib) $(ALSALIB)

pm_test/sysex: Makefile pm_test/sysex.o $(pmlib) $(ptlib)
	$(CC) pm_test/sysex.c -o pm_test/sysex $(pmlib) $(ptlib) $(ALSALIB)

pm_test/midithread: Makefile pm_test/midithread.o $(pmlib) $(ptlib)
	$(CC) pm_test/midithread.c -o pm_test/midithread \
        $(pmlib) $(ptlib) $(ALSALIB)

pm_test/latency: Makefile $(ptlib) pm_test/latency.o 
	$(CC) pm_test/latency.c -o pm_test/latency $(pmlib) $(ptlib) \
        $(ALSALIB) -lpthread -lm

pm_test/midithru: Makefile $(ptlib) pm_test/midithru.o 
	$(CC) pm_test/midithru.c -o pm_test/midithru $(pmlib) $(ptlib) \
        $(ALSALIB) -lpthread -lm

porttime/ptlinux.o: Makefile porttime/ptlinux.c
	$(CC) -c porttime/ptlinux.c -o porttime/ptlinux.o

clean:
	rm -f *.o *~ core* */*.o */*~ */core* pm_test/*/pm_dll.dll 
	rm -f *.opt *.ncb *.plg pm_win/Debug/pm_dll.lib pm_win/Release/pm_dll.lib
	rm -f pm_test/*.opt pm_test/*.ncb

cleaner: clean

cleanest: cleaner
	rm -f $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread
	rm -f pm_test/latency pm_test/midithru

backup: cleanest
	cd ..; zip -r portmidi.zip portmidi<commit_msg>First attempt to bring this into the RTcmix realm.<commit_after>include ../../../../makefile.conf

# Define this for debugging only
PMFLAGS = -DPM_CHECK_ERRORS

PTOBJECTS = porttime/porttime.o porttime/ptlinux.o 
PTLIB = porttime/libporttime.a
PMOBJECTS = pm_common/pmutil.o pm_common/portmidi.o

ifeq ($(ARCH), MACOSX)
	VFLAGS = 
	PMLIB = pm_mac/libportmidi.a
	AUDIOLIB = -framework CoreFoundation -framework CoreAudio -framework CoreMIDI
	PMOBJECTS += pm_mac/pmmac.o pm_mac/pmmacosxcm.o
endif
ifeq ($(ARCH), LINUX)
	VFLAGS = -DPMALSA
	PMLIB = pm_linux/libportmidi.a
	AUDIOLIB = -lasound
	PMOBJECTS += pm_linux/pmlinux.o pm_linux/pmlinuxalsa.o
endif

CFLAGS += $(VFLAGS) $(PMFLAGS) -Ipm_common -Iporttime


TESTPRG = pm_test/test pm_test/sysex pm_test/midithread pm_test/latency \
pm_test/midithru

all: $(PMLIB) $(PTLIB) $(TESTPRG)

$(PMLIB): Makefile $(PMOBJECTS)
	ar -cr $(PMLIB) $(PMOBJECTS)

$(PTLIB): Makefile $(PTOBJECTS)
	ar -cr $(PTLIB) $(PTOBJECTS)

pm_linux/pmlinuxalsa.o: Makefile pm_linux/pmlinuxalsa.c pm_linux/pmlinuxalsa.h
	$(CC) $(CFLAGS) -c pm_linux/pmlinuxalsa.c -o pm_linux/pmlinuxalsa.o

pm_test/test: Makefile pm_test/test.o $(PMLIB) $(PTLIB)
	$(CC) $(CFLAGS) pm_test/test.c -o pm_test/test $(PMLIB) $(PTLIB) $(AUDIOLIB)

pm_test/sysex: Makefile pm_test/sysex.o $(PMLIB) $(PTLIB)
	$(CC) $(CFLAGS) pm_test/sysex.c -o pm_test/sysex $(PMLIB) $(PTLIB) \
		$(AUDIOLIB)

pm_test/midithread: Makefile pm_test/midithread.o $(PMLIB) $(PTLIB)
	$(CC) $(CFLAGS) pm_test/midithread.c -o pm_test/midithread \
		$(PMLIB) $(PTLIB) $(AUDIOLIB)

pm_test/latency: Makefile $(PTLIB) pm_test/latency.o 
	$(CC) $(CFLAGS) pm_test/latency.c -o pm_test/latency $(PMLIB) $(PTLIB) \
		$(AUDIOLIB) -lpthread -lm

pm_test/midithru: Makefile $(PTLIB) pm_test/midithru.o 
	$(CC) $(CFLAGS) pm_test/midithru.c -o pm_test/midithru $(PMLIB) $(PTLIB) \
		$(AUDIOLIB) -lpthread -lm

porttime/ptlinux.o: Makefile porttime/ptlinux.c
	$(CC) $(CFLAGS) -c porttime/ptlinux.c -o porttime/ptlinux.o

clean:
	$(RM) *.o *~ core* */*.o */*~ */core*
	$(RM) $(PMLIB) $(PTLIB) pm_test/test pm_test/sysex pm_test/midithread
	$(RM) pm_test/latency pm_test/midithru

{'fraction_non_alphanumeric': 0.15382877795346736, 'fraction_numerical': 0.00045177320984865596, 'mean_word_length': 4.328519855595668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '504482', 'n_tokens_mistral': 2001, 'n_tokens_neox': 1925, 'n_words': 395}