<commit_before>ROOT := ..
include $(ROOT)/Rules.mk

SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SRCS))
PICOBJS := $(patsubst %.o,%.opic,$(OBJS))

MAJOR_VERSION := 0
MINOR_VERSION := 0

# base name of the shared library name
SOLIB_PFX := libdisk

ifeq ($(PLATFORM),osx)
SOLIB   := $(SOLIB_PFX).dylib
SONAME  := $(SOLIB_PFX).$(MAJOR_VERSION).dylib
SOVERS  := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dylib
LDFLAGS ?= -dynamiclib -install_name $(SONAME)
endif

ifeq ($(PLATFORM),linux)
SOLIB   := $(SOLIB_PFX).so
SONAME  := $(SOLIB_PFX).so.$(MAJOR_VERSION)
SOVERS  := $(SOLIB_PFX).so.$(MAJOR_VERSION).$(MINOR_VERSION)
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif

ifeq ($(PLATFORM),win32)
SOLIB   := $(SOLIB_PFX).dll
SONAME  := $(SOLIB_PFX).$(MAJOR_VERSION).dll
SOVERS  := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dll
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif

LIBS :=
LIBS-$(caps) := -ldl
LIBS += $(LIBS-y)

all:
ifneq ($(SHARED_LIB),n)
	$(MAKE) -C stream streams.apic
	$(MAKE) -C container containers.apic
	$(MAKE) -C format formats.apic
	$(MAKE) $(SOVERS)
else
	$(MAKE) -C stream streams.o
	$(MAKE) -C container containers.o
	$(MAKE) -C format formats.o
	$(MAKE) libdisk.a
endif

libdisk.a: $(OBJS) stream/streams.o container/containers.o format/formats.o
	$(AR) rcs $@ $^

$(SOVERS): $(PICOBJS) stream/streams.apic container/containers.apic \
		format/formats.apic
	$(CC) $(LDFLAGS) $(LIBS) -o $(SOVERS) $^
#	strip -x $(SOVERS)
	ln -sf $(SOVERS) $(SONAME)
	ln -sf $(SONAME) $(SOLIB)

install: all
	$(INSTALL_DIR) $(LIBDIR)
	$(INSTALL_PROG) $(SOVERS) $(LIBDIR)
	ln -sf $(SOVERS) $(LIBDIR)/$(SONAME)
	ln -sf $(SONAME) $(LIBDIR)/$(SOLIB)
	$(INSTALL_DIR) $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/disk.h $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/stream.h $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/util.h $(INCLUDEDIR)/libdisk<commit_msg>libdisk: Libraries must follow source files on link command line<commit_after>ROOT := ..
include $(ROOT)/Rules.mk

SRCS := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SRCS))
PICOBJS := $(patsubst %.o,%.opic,$(OBJS))

MAJOR_VERSION := 0
MINOR_VERSION := 0

# base name of the shared library name
SOLIB_PFX := libdisk

ifeq ($(PLATFORM),osx)
SOLIB   := $(SOLIB_PFX).dylib
SONAME  := $(SOLIB_PFX).$(MAJOR_VERSION).dylib
SOVERS  := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dylib
LDFLAGS ?= -dynamiclib -install_name $(SONAME)
endif

ifeq ($(PLATFORM),linux)
SOLIB   := $(SOLIB_PFX).so
SONAME  := $(SOLIB_PFX).so.$(MAJOR_VERSION)
SOVERS  := $(SOLIB_PFX).so.$(MAJOR_VERSION).$(MINOR_VERSION)
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif

ifeq ($(PLATFORM),win32)
SOLIB   := $(SOLIB_PFX).dll
SONAME  := $(SOLIB_PFX).$(MAJOR_VERSION).dll
SOVERS  := $(SOLIB_PFX).$(MAJOR_VERSION).$(MINOR_VERSION).dll
LDFLAGS ?= -Wl,-h,$(SONAME) -shared
endif

LIBS :=
LIBS-$(caps) := -ldl
LIBS += $(LIBS-y)

all:
ifneq ($(SHARED_LIB),n)
	$(MAKE) -C stream streams.apic
	$(MAKE) -C container containers.apic
	$(MAKE) -C format formats.apic
	$(MAKE) $(SOVERS)
else
	$(MAKE) -C stream streams.o
	$(MAKE) -C container containers.o
	$(MAKE) -C format formats.o
	$(MAKE) libdisk.a
endif

libdisk.a: $(OBJS) stream/streams.o container/containers.o format/formats.o
	$(AR) rcs $@ $^

$(SOVERS): $(PICOBJS) stream/streams.apic container/containers.apic \
		format/formats.apic
	$(CC) $(LDFLAGS) -o $(SOVERS) $^ $(LIBS)
#	strip -x $(SOVERS)
	ln -sf $(SOVERS) $(SONAME)
	ln -sf $(SONAME) $(SOLIB)

install: all
	$(INSTALL_DIR) $(LIBDIR)
	$(INSTALL_PROG) $(SOVERS) $(LIBDIR)
	ln -sf $(SOVERS) $(LIBDIR)/$(SONAME)
	ln -sf $(SONAME) $(LIBDIR)/$(SOLIB)
	$(INSTALL_DIR) $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/disk.h $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/stream.h $(INCLUDEDIR)/libdisk
	$(INSTALL_DATA) include/libdisk/util.h $(INCLUDEDIR)/libdisk
{'fraction_non_alphanumeric': 0.2048004174276024, 'fraction_numerical': 0.0020871380120010435, 'mean_word_length': 5.028301886792453, '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': '4392419', 'n_tokens_mistral': 1711, 'n_tokens_neox': 1620, 'n_words': 316}