<commit_before>#
# LIBRARY.MK: rules to build and install a library composed of a set of objects.
#
# Contents:
# build:           --build the library ".a"
# install-include: --install the include files, if any.
# archdir-LIB:     --Rules for building/updating the library.
# src-library:     --get a list of sub-directories that are libraries.
#
# Remarks:
# These rules require that LIB and OBJ are already defined (usually
# in the including makefile).
#
LIB_INCLUDEDIR=$(LIB_ROOT)/$(subdir)/include
$(LIB_INCLUDEDIR):	;		$(INSTALL_DIRECTORY) $@
$(LIB_INCLUDEDIR)/%.h:	%.h;		$(INSTALL_FILE) $*.h $@

#
# libdir/%.a: --install rule for libraries
#
$(libdir)/%.a:	$(archdir)/%.a
	$(ECHO_TARGET)
	$(INSTALL_FILE) $? $@
	$(RANLIB) $@

#
# build: --build the library ".a"
#
build:	var-defined[LIB_ROOT] var-defined[LIB] var-defined[LIB_OBJ] \
	$(archdir)/$(LIB)

#
# install-include: --install the include files, if any.
# install-lib:	--install the library files.
# install-man:	--install manual pages for the library
#
#install:	install-lib install-include install-man
install-include:	$(H_SRC:%=$(includedir)/%)
install-lib:		$(libdir)/$(LIB) install-include
install-man:		$(man3dir)/$(MAN3_SRC)

$(libdir)/$(LIB):	$(archdir)/$(LIB)

installdirs:	$(libdir) $(includedir) $(man3dir)

#
# archdir-LIB: --Rules for building/updating the library.
#
$(archdir)/$(LIB):	$(LIB_OBJ) $(SUBLIB_SRC)
	$(ECHO_TARGET)
	$(AR) $(ARFLAGS) $@ $(LIB_OBJ)
	ar-merge -v $@ $(SUBLIB_SRC)
	$(RANLIB) $@

clean:	clean-library
clean-library:
	$(ECHO_TARGET)
	$(RM) $(archdir)/$(LIB)

#
# src-library: --get a list of sub-directories that are libraries.
#
src:	src-library
src-library:
	$(ECHO_TARGET)
	mk-filelist -qpn SUBLIB_SRC $$( \
	    grep -l '^include.* library.mk' */Makefile 2>/dev/null | \
	    while read file; do \
	        ( d=$$(dirname $$file); cd $$d >/dev/null && \
	        $(MAKE) -s print-lib-target| sed -e "s/^/$$d\//"; ) \
	    done)

print-lib-target:	;	@echo "$(archdir)/$(LIB)"
<commit_msg>added pre-build rules for include files<commit_after>#
# LIBRARY.MK: rules to build and install a library composed of a set of objects.
#
# Contents:
# build:           --build the library ".a"
# install-include: --install the include files, if any.
# archdir-LIB:     --Rules for building/updating the library.
# src-library:     --get a list of sub-directories that are libraries.
#
# Remarks:
# These rules require that LIB and OBJ are already defined (usually
# in the including makefile).
#
LIB_INCLUDEDIR=$(LIB_ROOT)/$(subdir)/include
LIB_INCLUDE_SRC = $(H_SRC:%=$(LIB_INCLUDEDIR)/%)

$(LIB_INCLUDEDIR):	;		$(INSTALL_DIRECTORY) $@
$(LIB_INCLUDEDIR)/%.h:	%.h;		$(INSTALL_FILE) $*.h $@
#$(LIB_INCLUDE_SRC):     mkdir[$(LIB_INCLUDEDIR)]

#
# libdir/%.a: --install rule for libraries
#
$(libdir)/%.a:	$(archdir)/%.a
	$(ECHO_TARGET)
	$(INSTALL_FILE) $? $@
	$(RANLIB) $@

pre-build:      $(LIB_INCLUDE_SRC)

#
# build: --build the library ".a"
#
build:	var-defined[LIB_ROOT] var-defined[LIB] var-defined[LIB_OBJ] \
	$(archdir)/$(LIB)

#
# install-include: --install the include files, if any.
# install-lib:	--install the library files.
# install-man:	--install manual pages for the library
#
#install:	install-lib install-include install-man
install-include:	$(H_SRC:%=$(includedir)/%)
install-lib:		$(libdir)/$(LIB) install-include
install-man:		$(man3dir)/$(MAN3_SRC)

$(libdir)/$(LIB):	$(archdir)/$(LIB)

installdirs:	$(libdir) $(includedir) $(man3dir)

#
# archdir-LIB: --Rules for building/updating the library.
#
$(archdir)/$(LIB):	$(LIB_OBJ) $(SUBLIB_SRC)
	$(ECHO_TARGET)
	$(AR) $(ARFLAGS) $@ $(LIB_OBJ)
	ar-merge -v $@ $(SUBLIB_SRC)
	$(RANLIB) $@

clean:	clean-library
clean-library:
	$(ECHO_TARGET)
	$(RM) $(archdir)/$(LIB) $(LIB_INCLUDE_SRC)


#
# src-library: --get a list of sub-directories that are libraries.
#
src:	src-library
src-library:
	$(ECHO_TARGET)
	mk-filelist -qpn SUBLIB_SRC $$( \
	    grep -l '^include.* library.mk' */Makefile 2>/dev/null | \
	    while read file; do \
	        ( d=$$(dirname $$file); cd $$d >/dev/null && \
	        $(MAKE) -s print-lib-target| sed -e "s/^/$$d\//"; ) \
	    done)

print-lib-target:	;	@echo "$(archdir)/$(LIB)"

{'fraction_non_alphanumeric': 0.1936180422264875, 'fraction_numerical': 0.0019193857965451055, 'mean_word_length': 3.7754868270332187, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3342347', 'n_tokens_mistral': 1629, 'n_tokens_neox': 1565, 'n_words': 384}