<commit_before>PROJECT = tlsinterposer

## The version is based on the last tag set on the current branch.
VERSION = $(shell sed -n -e 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' CHANGES.txt | tail -1)
MAJOR = $(word 1, $(subst ., , $(VERSION)))

SHAREDLIB = lib$(PROJECT).so
SONAME    = $(SHAREDLIB).$(MAJOR)
CFILES = tlsinterposer.c
GENHDR = ssl-version.h
HFILES = $(GENHDR)
PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
INSTALL = install
DESTDIR =

TARGETS = $(SHAREDLIB)

# targets which are not filenames:
.PHONY:	all install clean distclean

all:	$(TARGETS) install

install: $(SHAREDLIB)
	mkdir -p $(DESTDIR)$(LIBDIR)
	$(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(LIBDIR)/$(SHAREDLIB).$(VERSION)
	ln -sf $(SHAREDLIB).$(VERSION) $(DESTDIR)$(LIBDIR)/$(SONAME)
	ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/$(SHAREDLIB)

ssl-version.h: CHANGES.txt
	ldconfig -p | sed -n -e 's/^\t*\(libssl\.so\.[0-9]\.[0-9]\.[0-9]\).*/#define DEFAULT_SSLLIB "\1"/p' > $@

$(SHAREDLIB): $(CFILES) $(HFILES)
	$(CC) -g -Wall -fPIC -shared -o $(SHAREDLIB) $(CFILES) -ldl

clean:
	find . \( -name "*.so" $(patsubst %.h,-o -name %.h,$(GENHDR)) \) -print0 | xargs -0 --no-run-if-empty rm -v

distclean: clean

# vim: set noexpandtab tabstop=4 :<commit_msg>Extract CFLAGS, optimize<commit_after>PROJECT = tlsinterposer

## The version is based on the last tag set on the current branch.
VERSION = $(shell sed -n -e 's/^\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' CHANGES.txt | tail -1)
MAJOR = $(word 1, $(subst ., , $(VERSION)))

SHAREDLIB = lib$(PROJECT).so
SONAME    = $(SHAREDLIB).$(MAJOR)
CFILES = tlsinterposer.c
GENHDR = ssl-version.h
HFILES = $(GENHDR)
PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
INSTALL = install
DESTDIR =
CFLAGS  = -g -Wall -O2

TARGETS = $(SHAREDLIB)

# targets which are not filenames:
.PHONY:	all install clean distclean

all:	$(TARGETS) install

install: $(SHAREDLIB)
	mkdir -p $(DESTDIR)$(LIBDIR)
	$(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(LIBDIR)/$(SHAREDLIB).$(VERSION)
	ln -sf $(SHAREDLIB).$(VERSION) $(DESTDIR)$(LIBDIR)/$(SONAME)
	ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/$(SHAREDLIB)

ssl-version.h: CHANGES.txt
	ldconfig -p | sed -n -e 's/^\t*\(libssl\.so\.[0-9]\.[0-9]\.[0-9]\).*/#define DEFAULT_SSLLIB "\1"/p' > $@

$(SHAREDLIB): $(CFILES) $(HFILES)
	$(CC) $(CFLAGS) -fPIC -shared -o $(SHAREDLIB) $(CFILES) -ldl

clean:
	find . \( -name "*.so" $(patsubst %.h,-o -name %.h,$(GENHDR)) \) -print0 | xargs -0 --no-run-if-empty rm -v

distclean: clean

# vim: set noexpandtab tabstop=4 :
{'fraction_non_alphanumeric': 0.22707070707070706, 'fraction_numerical': 0.01818181818181818, 'mean_word_length': 3.770712909441233, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5019582', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1077, 'n_words': 247}