<commit_before>CC = gcc
PREFIX = /usr/local
BUILD = build
SRC = src
CFLAGS = -g -D _GNU_SOURCE -fPIC
BINARY = $(BUILD)/amath
LIBRARY = $(BUILD)/libamath.so
SOURCES = $(wildcard $(SRC)/*.c)
HEADERS = $(wildcard $(SRC)/*.h)
OBJECTS = $(patsubst $(SRC)/%.c,$(BUILD)/%.o,$(SOURCES))

all: $(LIBRARY) $(BINARY)

test:
	@bash test/test.sh

install: $(LIBRARY) $(BINARY)
	install -m 0755 $(BINARY) $(PREFIX)/bin
	install -m 0755 $(LIBRARY) $(PREFIX)/lib
	install -m 0644 $(SRC)/amath.h $(PREFIX)/include

uninstall:
	rm -f $(PREFIX)/bin/amath
	rm -f $(PREFIX)/lib/libamath.so
	rm -f $(PREFIX)/include/amath.h

$(SRC)/amath.c: $(SRC)/amath.leg
	leg -o $@ $<

$(BINARY): $(OBJECTS)
	$(CC) -o $(BINARY) $(OBJECTS)

$(LIBRARY): $(OBJECTS)
	$(CC) -shared -o $(LIBRARY) $(filter-out $(BUILD)/main.o, $(OBJECTS))

$(BUILD)/%.o: $(SRC)/%.c $(BUILD)
	$(CC) $(CFLAGS) -c $< -o $@

$(BUILD):
	mkdir -p $(BUILD)

clean:
	rm -rf $(BUILD)

.PHONY: all test install uninstall clean<commit_msg>Update Makefile to fix dependencies<commit_after>CC = gcc
PREFIX = /usr/local
BUILD = build
SRC = src
CFLAGS = -ansi -g -D _GNU_SOURCE -fPIC
BINARY = $(BUILD)/amath
LIBRARY = $(BUILD)/libamath.so
SOURCES = $(SRC)/amath.c $(SRC)/main.c $(SRC)/util.c
OBJECTS = $(BUILD)/amath.o $(BUILD)/main.o $(BUILD)/util.o

# phony targets

.PHONY: all test install uninstall clean

all: $(LIBRARY) $(BINARY)

test:
	@bash test/test.sh

install: all
	install -m 0755 $(BINARY) $(PREFIX)/bin
	install -m 0755 $(LIBRARY) $(PREFIX)/lib
	install -m 0644 $(SRC)/amath.h $(PREFIX)/include

uninstall:
	rm -f $(PREFIX)/bin/amath
	rm -f $(PREFIX)/lib/libamath.so
	rm -f $(PREFIX)/include/amath.h

clean:
	rm -rf $(BUILD)

# binary and library

$(BINARY): $(OBJECTS)
	$(CC) -o $@ $^

$(LIBRARY): $(OBJECTS)
	$(CC) -shared -o $@ $(filter-out $(BUILD)/main.o, $^)

# object files

$(BUILD)/%.o: $(SRC)/%.c | $(BUILD)
	$(CC) $(CFLAGS) -c $< -o $@

$(BUILD):
	mkdir -p $(BUILD)

# C dependencies

$(SRC)/amath.c: $(SRC)/amath.leg.c
	touch $@

$(SRC)/amath.leg.c: $(SRC)/amath.leg
	greg -o $@ $<

.SUFFIXES:
{'fraction_non_alphanumeric': 0.23035627135187897, 'fraction_numerical': 0.01171303074670571, 'mean_word_length': 3.7785547785547786, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3964612', 'n_tokens_mistral': 903, 'n_tokens_neox': 843, 'n_words': 211}