<commit_before>
# ==============================================================================
#                          Unix Makefile for libndtypes
# ==============================================================================

LIBSTATIC = libndtypes.a

CC ?= gcc
LD ?= gcc
AR ?= ar
RANLIB ?= ranlib
CFLAGS ?= -Wall -Wextra -std=c11 -pedantic -O2 -g

ifeq ($(MAKECMDGOALS), coverage)
  CFLAGS = -O0 -g -fno-inline -fprofile-arcs -ftest-coverage -fpic
  LDFLAGS = -fprofile-arcs
endif


default: $(LIBSTATIC)


OBJS = alloc.o display.o equal.o grammar.o lexer.o match.o ndtypes.o \
       parsefuncs.o parser.o seq.o symtable.o

$(LIBSTATIC):\
Makefile $(OBJS)
	$(AR) rc $(LIBSTATIC) $(OBJS)
	$(RANLIB) $(LIBSTATIC)

alloc.o:\
Makefile alloc.c ndtypes.h
	$(CC) $(CFLAGS) -c alloc.c

display.o:\
Makefile display.c ndtypes.h
	$(CC) $(CFLAGS) -c display.c

equal.o:\
Makefile equal.c ndtypes.h
	$(CC) $(CFLAGS) -c equal.c

grammar.o:\
Makefile grammar.c grammar.h lexer.h ndtypes.h parsefuncs.h seq.h
	$(CC) $(CFLAGS) -c grammar.c

lexer.o:\
Makefile lexer.c grammar.h lexer.h parsefuncs.h
	$(CC) $(CFLAGS) -c lexer.c

match.o:\
Makefile match.c ndtypes.h symtable.h
	$(CC) $(CFLAGS) -c match.c

ndtypes.o:\
Makefile ndtypes.c ndtypes.h
	$(CC) $(CFLAGS) -c ndtypes.c

parsefuncs.o:\
Makefile parsefuncs.c ndtypes.h parsefuncs.h seq.h
	$(CC) $(CFLAGS) -c parsefuncs.c

parser.o:\
Makefile parser.c grammar.h lexer.h ndtypes.h seq.h
	$(CC) $(CFLAGS) -c parser.c

seq.o:\
Makefile seq.c ndtypes.h seq.h
	$(CC) $(CFLAGS) -c seq.c

symtable.o:\
Makefile symtable.c ndtypes.h symtable.h
	$(CC) $(CFLAGS) -c symtable.c


# Flex generated files
lexer.h:\
Makefile lexer.c

lexer.c:\
Makefile lexer.l ndtypes.h parsefuncs.h
	flex -o lexer.c --header-file=lexer.h lexer.l

# Bison generated files
grammar.h:\
Makefile grammar.c

grammar.c:\
Makefile grammar.y ndtypes.h parsefuncs.h ndtypes.h
	bison -Wall -o grammar.c --defines=grammar.h grammar.y


# Tests
runtest:\
Makefile tests/runtest.c tests/alloc_fail.c tests/test_parse.c tests/test_parse_error.c \
tests/test_parse_roundtrip.c tests/test_typedef.c tests/test_match.c \
ndtypes.h tests/test.h tests/alloc_fail.h $(LIBSTATIC)
	$(CC) -I. $(CFLAGS) -DTEST_ALLOC -o tests/runtest tests/runtest.c \<commit_msg>The Bison version shipped with Xcode does not support -Wall.<commit_after>
# ==============================================================================
#                          Unix Makefile for libndtypes
# ==============================================================================

LIBSTATIC = libndtypes.a

CC ?= gcc
LD ?= gcc
AR ?= ar
RANLIB ?= ranlib
CFLAGS ?= -Wall -Wextra -std=c11 -pedantic -O2 -g

# Xcode ships with an outdated Bison.
ifeq ($(shell uname), Darwin)
  BISON_WARN=
else
  BISON_WARN=-Wall
endif

ifeq ($(MAKECMDGOALS), coverage)
  CFLAGS = -O0 -g -fno-inline -fprofile-arcs -ftest-coverage -fpic
  LDFLAGS = -fprofile-arcs
endif


default: $(LIBSTATIC)


OBJS = alloc.o display.o equal.o grammar.o lexer.o match.o ndtypes.o \
       parsefuncs.o parser.o seq.o symtable.o

$(LIBSTATIC):\
Makefile $(OBJS)
	$(AR) rc $(LIBSTATIC) $(OBJS)
	$(RANLIB) $(LIBSTATIC)

alloc.o:\
Makefile alloc.c ndtypes.h
	$(CC) $(CFLAGS) -c alloc.c

display.o:\
Makefile display.c ndtypes.h
	$(CC) $(CFLAGS) -c display.c

equal.o:\
Makefile equal.c ndtypes.h
	$(CC) $(CFLAGS) -c equal.c

grammar.o:\
Makefile grammar.c grammar.h lexer.h ndtypes.h parsefuncs.h seq.h
	$(CC) $(CFLAGS) -c grammar.c

lexer.o:\
Makefile lexer.c grammar.h lexer.h parsefuncs.h
	$(CC) $(CFLAGS) -c lexer.c

match.o:\
Makefile match.c ndtypes.h symtable.h
	$(CC) $(CFLAGS) -c match.c

ndtypes.o:\
Makefile ndtypes.c ndtypes.h
	$(CC) $(CFLAGS) -c ndtypes.c

parsefuncs.o:\
Makefile parsefuncs.c ndtypes.h parsefuncs.h seq.h
	$(CC) $(CFLAGS) -c parsefuncs.c

parser.o:\
Makefile parser.c grammar.h lexer.h ndtypes.h seq.h
	$(CC) $(CFLAGS) -c parser.c

seq.o:\
Makefile seq.c ndtypes.h seq.h
	$(CC) $(CFLAGS) -c seq.c

symtable.o:\
Makefile symtable.c ndtypes.h symtable.h
	$(CC) $(CFLAGS) -c symtable.c


# Flex generated files
lexer.h:\
Makefile lexer.c

lexer.c:\
Makefile lexer.l ndtypes.h parsefuncs.h
	flex -o lexer.c --header-file=lexer.h lexer.l

# Bison generated files
grammar.h:\
Makefile grammar.c

grammar.c:\
Makefile grammar.y ndtypes.h parsefuncs.h ndtypes.h
	bison $(BISON_WARN) -o grammar.c --defines=grammar.h grammar.y


# Tests
runtest:\
Makefile tests/runtest.c tests/alloc_fail.c tests/test_parse.c tests/test_parse_error.c \
tests/test_parse_roundtrip.c tests/test_typedef.c tests/test_match.c \
ndtypes.h tests/test.h tests/alloc_fail.h $(LIBSTATIC)
	$(CC) -I. $(CFLAGS) -DTEST_ALLOC -o tests/runtest tests/runtest.c \
{'fraction_non_alphanumeric': 0.20678617157490398, 'fraction_numerical': 0.0017072129748186087, 'mean_word_length': 3.6729810568295114, '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': '5050914', 'n_tokens_mistral': 1921, 'n_tokens_neox': 1830, 'n_words': 453}