<commit_before>ifeq (,$(wildcard config.mak))
$(error "config.mak is not present, run configure !")
endif
include config.mak

PKGCONFIG_DIR = $(libdir)/pkgconfig
PKGCONFIG_FILE = libvalhalla.pc

VHTEST = libvalhalla-test
VHTEST_SRCS = libvalhalla-test.c

CFLAGS += -Isrc
LDFLAGS += -Lsrc -lvalhalla -lsqlite3 -lpthread

ifeq ($(BUILD_STATIC),yes)
  LDFLAGS += $(EXTRALIBS)
endif

DISTFILE = libvahalla-$(VERSION).tar.bz2

EXTRADIST = \
	AUTHORS \
	configure \
	COPYING \
	README \
	TODO \

SUBDIRS = \
	DOCS \
	utils \
	src \

all: lib test docs

lib:
	$(MAKE) -C src

test: lib
	$(CC) $(VHTEST_SRCS) $(OPTFLAGS) $(CFLAGS) $(EXTRACFLAGS) $(LDFLAGS) -o $(VHTEST)

docs:
	$(MAKE) -C DOCS

docs-clean:
	$(MAKE) -C DOCS clean

clean:
	$(MAKE) -C src clean
	rm -f $(VHTEST)

distclean: clean docs-clean
	rm -f config.log
	rm -f config.mak
	rm -f $(PKGCONFIG_FILE)

install: install-lib install-pkgconfig install-test install-docs

install-lib: lib
	$(MAKE) -C src install

install-test: test
	$(INSTALL) -d $(bindir)
	$(INSTALL) -c -m 755 $(VHTEST) $(bindir)

install-docs: docs
	$(MAKE) -C DOCS install

install-pkgconfig: $(PKGCONFIG_FILE)
	$(INSTALL) -d "$(PKGCONFIG_DIR)"
	$(INSTALL) -m 644 $< "$(PKGCONFIG_DIR)"

uninstall: uninstall-lib uninstall-pkgconfig uninstall-test uninstall-docs

uninstall-pkgconfig:
	rm -f $(PKGCONFIG_DIR)/$(PKGCONFIG_FILE)

uninstall-lib:
	$(MAKE) -C src uninstall

uninstall-test:
	rm -f $(bindir)/$(VHTEST)

uninstall-docs:
	$(MAKE) -C DOCS uninstall

.PHONY: clean distclean
.PHONY: *install*
.PHONY: docs

dist:
	-$(RM) $(DISTFILE)
	dist=$(shell pwd)/libvalhalla-$(VERSION) && \
	for subdir in . $(SUBDIRS); do \
		mkdir -p "$$dist/$$subdir"; \<commit_msg>cosmetic: use the same order for the targets in all libs for consistency<commit_after>ifeq (,$(wildcard config.mak))
$(error "config.mak is not present, run configure !")
endif
include config.mak

PKGCONFIG_DIR = $(libdir)/pkgconfig
PKGCONFIG_FILE = libvalhalla.pc

VHTEST = libvalhalla-test
VHTEST_SRCS = libvalhalla-test.c

CFLAGS += -Isrc
LDFLAGS += -Lsrc -lvalhalla -lsqlite3 -lpthread

ifeq ($(BUILD_STATIC),yes)
  LDFLAGS += $(EXTRALIBS)
endif

DISTFILE = libvahalla-$(VERSION).tar.bz2

EXTRADIST = \
	AUTHORS \
	configure \
	COPYING \
	README \
	TODO \

SUBDIRS = \
	DOCS \
	utils \
	src \

all: lib test docs

lib:
	$(MAKE) -C src

test: lib
	$(CC) $(VHTEST_SRCS) $(OPTFLAGS) $(CFLAGS) $(EXTRACFLAGS) $(LDFLAGS) -o $(VHTEST)

docs:
	$(MAKE) -C DOCS

docs-clean:
	$(MAKE) -C DOCS clean

clean:
	$(MAKE) -C src clean
	rm -f $(VHTEST)

distclean: clean docs-clean
	rm -f config.log
	rm -f config.mak
	rm -f $(PKGCONFIG_FILE)

install: install-lib install-pkgconfig install-test install-docs

install-lib: lib
	$(MAKE) -C src install

install-pkgconfig: $(PKGCONFIG_FILE)
	$(INSTALL) -d "$(PKGCONFIG_DIR)"
	$(INSTALL) -m 644 $< "$(PKGCONFIG_DIR)"

install-test: test
	$(INSTALL) -d $(bindir)
	$(INSTALL) -c -m 755 $(VHTEST) $(bindir)

install-docs: docs
	$(MAKE) -C DOCS install

uninstall: uninstall-lib uninstall-pkgconfig uninstall-test uninstall-docs

uninstall-lib:
	$(MAKE) -C src uninstall

uninstall-pkgconfig:
	rm -f $(PKGCONFIG_DIR)/$(PKGCONFIG_FILE)

uninstall-test:
	rm -f $(bindir)/$(VHTEST)

uninstall-docs:
	$(MAKE) -C DOCS uninstall

.PHONY: clean distclean
.PHONY: *install*
.PHONY: docs

dist:
	-$(RM) $(DISTFILE)
	dist=$(shell pwd)/libvalhalla-$(VERSION) && \
	for subdir in . $(SUBDIRS); do \
		mkdir -p "$$dist/$$subdir"; \
{'fraction_non_alphanumeric': 0.15856851905731742, 'fraction_numerical': 0.004655222577829503, 'mean_word_length': 3.9898403483309144, 'pattern_counts': {'":': 0, '<': 5, '<?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': '577823', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1399, 'n_words': 356}