<commit_before>include ../common.mk

OBJDIR = obj/linux
OUTDIR = .
ifneq ($(CC_BUILDSTATIC),yes)
OUTNAME = libCrissCross.so
OUTBIN = $(OUTNAME).$(VERSION)
else
OUTNAME = libCrissCross
OUTBIN = $(OUTNAME)-$(VERSION).a
endif
prefix = /usr/local

SOURCES = \
core_io_reader.cpp \
core_io_writer.cpp \
core_network.cpp \
core_socket.cpp \
console.cpp \
cpuid.cpp \
databuffer.cpp \
debug.cpp \
error.cpp \
filesystem.cpp \
mutex.cpp \
system.cpp \
stopwatch.cpp \
tcpsocket.cpp \
udpsocket.cpp \
textreader.cpp \
textwriter.cpp \
version.cpp \
universal_include.cpp

OBJECTS = $(SOURCES:%.cpp=$(OBJDIR)/%.o)

ifneq ($(GCC_ISCYGMING),yes)
LINK += -rdynamic
endif
INCLUDES += -I.
CXXFLAGS += $(FPIC) $(INCLUDES)

ifeq ($(GCC_MAJOR),4)
PCH = crisscross/universal_include.h
GCH = $(PCH).gch
endif

all: .depend precomp $(OUTDIR)/$(OUTBIN)

precomp: $(GCH)

install: $(OUTDIR)/$(OUTBIN)
	-rm -rf $(prefix)/include/crisscross
	mkdir -p $(prefix)/include/crisscross
	mkdir -p $(prefix)/lib
	cp crisscross/*.h $(prefix)/include/crisscross/
	cp crisscross/*.cpp $(prefix)/include/crisscross/
	cp $(OUTBIN) $(prefix)/lib/
	cd $(prefix)/lib; chmod 755 $(OUTBIN)
	cd $(prefix)/lib; if test -f $(OUTBIN); then \
		rm -f $(OUTNAME) $(OUTNAME).$(VERSION_MAJOR); \
		ln -s $(OUTBIN) $(OUTNAME); \
		ln -s $(OUTBIN) $(OUTNAME).$(VERSION_MAJOR); \
		(ldconfig || true)  >/dev/null 2>&1; \
	fi

clean:
	-rm -rf obj
	-rm -f .depend
	-rm -rf .libs
	-rm -f crisscross/build_number.h
	-rm -f $(OUTDIR)/$(OUTBIN)
	-rm -f $(OUTDIR)/$(OUTBIN).map
	-rm -f $(GCH)
	-rm -f $(OUTNAME).$(VERSION_MAJOR)
	-rm -f $(OUTNAME)
	
$(OUTDIR)/$(OUTBIN): $(OBJECTS)
ifneq ($(CC_BUILDSTATIC),yes)
ifneq ($(GCC_ISAPPLE),yes)
	$(CXX) -shared -Wl,-soname,$(OUTNAME).$(VERSION_MAJOR) -o $(OUTNAME).$(VERSION) $+
else
	$(CXX) -dynamiclib -Wl,-install_name,$(OUTNAME).$(VERSION_MAJOR) -o $(OUTNAME).$(VERSION) $+
endif
	ln -sf $(OUTNAME).$(VERSION) $(OUTNAME)
	ln -sf $(OUTNAME).$(VERSION) $(OUTNAME).$(VERSION_MAJOR)
else
	$(AR) $@ $+
	-($(RANLIB) $@ || true) >/dev/null 2>&1
endif
	$(NM) $(OUTDIR)/$(OUTBIN) > $(OUTDIR)/$(OUTBIN).map
	$(STRIP) $(OUTDIR)/$(OUTBIN)

$(GCH): $(PCH)
	$(shell pwd)/../tools/GenerateBuildNumber.sh "$(shell pwd)/crisscross"
	$(CXX) $(CXXFLAGS) -c $(PCH) -o $(GCH)

$(OBJDIR)/%.o: %.cpp
	@test -d $(dir $(OBJDIR)/$<) || mkdir -p $(dir $(OBJDIR)/$<)
	$(CXX) $(CXXFLAGS) -c $< -o $@

$(OBJDIR)/%.o: %.c
	@test -d $(dir $(OBJDIR)/$<) || mkdir -p $(dir $(OBJDIR)/$<)
	$(CC) $(CXXFLAGS) -c $< -o $@<commit_msg>GCC 3.x corrections.<commit_after>include ../common.mk

OBJDIR = obj/linux
OUTDIR = .
ifneq ($(CC_BUILDSTATIC),yes)
OUTNAME = libCrissCross.so
OUTBIN = $(OUTNAME).$(VERSION)
else
OUTNAME = libCrissCross
OUTBIN = $(OUTNAME)-$(VERSION).a
endif
prefix = /usr/local

SOURCES = \
core_io_reader.cpp \
core_io_writer.cpp \
core_network.cpp \
core_socket.cpp \
console.cpp \
cpuid.cpp \
databuffer.cpp \
debug.cpp \
error.cpp \
filesystem.cpp \
mutex.cpp \
system.cpp \
stopwatch.cpp \
tcpsocket.cpp \
udpsocket.cpp \
textreader.cpp \
textwriter.cpp \
version.cpp \
universal_include.cpp

OBJECTS = $(SOURCES:%.cpp=$(OBJDIR)/%.o)

ifneq ($(GCC_ISCYGMING),yes)
LINK += -rdynamic
endif
INCLUDES += -I.
CXXFLAGS += $(FPIC) $(INCLUDES)

ifeq ($(GCC_MAJOR),4)
PCH = crisscross/universal_include.h
GCH = $(PCH).gch
else
GCH = build_number.h
endif

all: .depend precomp $(OUTDIR)/$(OUTBIN)

precomp: $(GCH)

install: $(OUTDIR)/$(OUTBIN)
	-rm -rf $(prefix)/include/crisscross
	mkdir -p $(prefix)/include/crisscross
	mkdir -p $(prefix)/lib
	cp crisscross/*.h $(prefix)/include/crisscross/
	cp crisscross/*.cpp $(prefix)/include/crisscross/
	cp $(OUTBIN) $(prefix)/lib/
	cd $(prefix)/lib; chmod 755 $(OUTBIN)
	cd $(prefix)/lib; if test -f $(OUTBIN); then \
		rm -f $(OUTNAME) $(OUTNAME).$(VERSION_MAJOR); \
		ln -s $(OUTBIN) $(OUTNAME); \
		ln -s $(OUTBIN) $(OUTNAME).$(VERSION_MAJOR); \
		(ldconfig || true)  >/dev/null 2>&1; \
	fi

clean:
	-rm -rf obj
	-rm -f .depend
	-rm -rf .libs
	-rm -f crisscross/build_number.h
	-rm -f $(OUTDIR)/$(OUTBIN)
	-rm -f $(OUTDIR)/$(OUTBIN).map
	-rm -f $(GCH)
	-rm -f $(OUTNAME).$(VERSION_MAJOR)
	-rm -f $(OUTNAME)
	
$(OUTDIR)/$(OUTBIN): $(OBJECTS)
ifneq ($(CC_BUILDSTATIC),yes)
ifneq ($(GCC_ISAPPLE),yes)
	$(CXX) -shared -Wl,-soname,$(OUTNAME).$(VERSION_MAJOR) -o $(OUTNAME).$(VERSION) $+
else
	$(CXX) -dynamiclib -Wl,-install_name,$(OUTNAME).$(VERSION_MAJOR) -o $(OUTNAME).$(VERSION) $+
endif
	ln -sf $(OUTNAME).$(VERSION) $(OUTNAME)
	ln -sf $(OUTNAME).$(VERSION) $(OUTNAME).$(VERSION_MAJOR)
else
	$(AR) $@ $+
	-($(RANLIB) $@ || true) >/dev/null 2>&1
endif
	$(NM) $(OUTDIR)/$(OUTBIN) > $(OUTDIR)/$(OUTBIN).map
	$(STRIP) $(OUTDIR)/$(OUTBIN)

$(GCH): $(PCH)
	$(shell pwd)/../tools/GenerateBuildNumber.sh "$(shell pwd)/crisscross"
ifeq ($(GCC_MAJOR),4)
	$(CXX) $(CXXFLAGS) -c $(PCH) -o $(GCH)
endif

$(OBJDIR)/%.o: %.cpp
	@test -d $(dir $(OBJDIR)/$<) || mkdir -p $(dir $(OBJDIR)/$<)
	$(CXX) $(CXXFLAGS) -c $< -o $@

$(OBJDIR)/%.o: %.c
	@test -d $(dir $(OBJDIR)/$<) || mkdir -p $(dir $(OBJDIR)/$<)
	$(CC) $(CXXFLAGS) -c $< -o $@
{'fraction_non_alphanumeric': 0.23402985074626867, 'fraction_numerical': 0.003582089552238806, 'mean_word_length': 3.9419862340216323, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '714579', 'n_tokens_mistral': 2226, 'n_tokens_neox': 2105, 'n_words': 446}