<commit_before>BIN = binary
LIBS = $(addsuffix .dylib, binary_add binary_mul)

CFLAGS = -std=c11 -Wall -Werror
LDLIBS = -ldl

all: $(BIN) $(LIBS)
$(BIN): $(BIN).o

%.dylib: %.o
	libtool -dynamic -compatibility_version 1 -current_version 1 -macosx_version_min 10.11 -o $@ $<

clean:
	$(RM) $(BIN) $(wildcard *.o) $(wildcard *.dylib) $(wildcard *.so)

test: $(BIN) $(LIBS)
	chmod a+rx binary_mul.dylib
	./$< add 13 7
	./$< mul 13 7
	! ./$< exp 13 7
	! ./$< add herp 7
	! ./$< mul 13 derp
	! ./$< add 13
	! ./$< add
	! ./$< add 13 7 42
	chmod a-rx binary_mul.dylib
	! ./$< mul 13 7<commit_msg>Cross-platforming the Makefile.<commit_after>BIN = binary
LIBS = $(addsuffix .$(SO), binary_add binary_mul)

CFLAGS = -std=c11 -Wall -Werror
LDLIBS = -ldl

ifeq ($(shell uname -s),Darwin)
SO = dylib
else
SO = so
endif

all: $(BIN) $(LIBS)

$(BIN): LDFLAGS := $(LDFLAGS) -Wl,-rpath=$(PWD)
$(BIN): $(BIN).o

%.dylib: %.o
	libtool -dynamic -compatibility_version 1 -current_version 1 -macosx_version_min 10.11 -o $@ $<

%.so: %.o
	$(LD) -shared -o $@ $<

$(LIBS:.o=.so): CFLAGS := $(CFLAGS) -fpic
$(LIBS:.o=.so):

clean:
	$(RM) $(BIN) $(wildcard *.o) $(wildcard *.dylib) $(wildcard *.so)

test: $(BIN) $(LIBS)
	@chmod a+rx binary_mul.$(SO)
	./$< add 13 7
	./$< mul 13 7
	! ./$< exp 13 7
	! ./$< add herp 7
	! ./$< mul 13 derp
	! ./$< add 13
	! ./$< add
	! ./$< add 13 7 42
	@chmod a-rx binary_mul.$(SO)
	! ./$< mul 13 7

.PHONY: all clean test
{'fraction_non_alphanumeric': 0.22517482517482518, 'fraction_numerical': 0.04195804195804196, 'mean_word_length': 3.019662921348315, 'pattern_counts': {'":': 0, '<': 24, '<?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': '5224550', 'n_tokens_mistral': 724, 'n_tokens_neox': 642, 'n_words': 173}