<commit_before>###
# opts
# -----
# Copyright (c)2010-2012 <NAME> <<EMAIL>>
#
#  This file is part of opts.
#
#  Distributed under the OSI-approved BSD License (the "License");
#  see accompanying file BDS-LICENSE for details or see
#  <http://www.opensource.org/licenses/bsd-license.php>.
#
#  This software is distributed WITHOUT ANY WARRANTY; without even the
#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the License for more information.
##

-include Makefile.local
-include Makefile.include

CFLAGS += -I.
LDFLAGS += -L. -lopts -lm

TARGETS  = libopts.a
TARGETS += test test2
OBJS  = opts.o


all: $(TARGETS)

libopts.a: $(OBJS)
	ar cr $@ $(OBJS)
	ranlib $@

test: test.c libopts.a
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
	@if ! $(SH) unittest.sh; then echo "Unit test FAILED."; exit -1; fi
test2: test2.c libopts.a
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
#./test2 -o 2.2 -h -a 2,3.1,11

opts.c: parse.c optarg.c
	touch opts.c

%.o: %.c %.h
	$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

install: libopts.a doc
	mkdir -p $(PREFIX)/$(INCLUDEDIR)
	mkdir -p $(PREFIX)/$(LIBDIR)
	mkdir -p $(PREFIX)/$(MANDIR)
	cp opts.h $(PREFIX)/$(INCLUDEDIR)
	cp libopts.a $(PREFIX)/$(LIBDIR)
	cp opts.3 $(PREFIX)/$(MANDIR)

clean:
	rm -f $(OBJS)
	rm -f $(TARGETS)
	rm -f *.3 *.3.gz
	if [ -d testsuites ]; then $(MAKE) -C testsuites clean; fi;
	if [ -d doc ]; then $(MAKE) -C doc clean; fi;

doc: opts.3

opts.3: opts.3.txt
	a2x -d manpage -f manpage $<

html-doc:
	asciidoc -d manpage -b html5 -s -f man-html.conf opts.3.txt

analyze: clean
	$(SCAN_BUILD) $(MAKE)<commit_msg>Improved building of manual page (because of older versions of asciidoc).<commit_after>###
# opts
# -----
# Copyright (c)2010-2012 <NAME> <<EMAIL>>
#
#  This file is part of opts.
#
#  Distributed under the OSI-approved BSD License (the "License");
#  see accompanying file BDS-LICENSE for details or see
#  <http://www.opensource.org/licenses/bsd-license.php>.
#
#  This software is distributed WITHOUT ANY WARRANTY; without even the
#  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#  See the License for more information.
##

-include Makefile.local
-include Makefile.include

CFLAGS += -I.
LDFLAGS += -L. -lopts -lm

TARGETS  = libopts.a
TARGETS += test test2
OBJS  = opts.o


all: $(TARGETS)

libopts.a: $(OBJS)
	ar cr $@ $(OBJS)
	ranlib $@

test: test.c libopts.a
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
	@if ! $(SH) unittest.sh; then echo "Unit test FAILED."; exit -1; fi
test2: test2.c libopts.a
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
#./test2 -o 2.2 -h -a 2,3.1,11

opts.c: parse.c optarg.c
	touch opts.c

%.o: %.c %.h
	$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

install: libopts.a doc
	mkdir -p $(PREFIX)/$(INCLUDEDIR)
	mkdir -p $(PREFIX)/$(LIBDIR)
	mkdir -p $(PREFIX)/$(MANDIR)
	cp opts.h $(PREFIX)/$(INCLUDEDIR)
	cp libopts.a $(PREFIX)/$(LIBDIR)
	cp opts.3 $(PREFIX)/$(MANDIR)

clean:
	rm -f $(OBJS)
	rm -f $(TARGETS)
	rm -f *.3 *.3.gz
	if [ -d testsuites ]; then $(MAKE) -C testsuites clean; fi;
	if [ -d doc ]; then $(MAKE) -C doc clean; fi;

doc: opts.3

opts.3: opts.3.txt
	a2x -d manpage -f manpage $<
	if [ -f opts,_optsAdd,_optsAddDesc,_optsClear,_optsPrint.3 ] \
        && [ ! -f opts.3 ]; then \
            mv opts,_optsAdd,_optsAddDesc,_optsClear,_optsPrint.3 opts.3; \
    fi;

html-doc:
	asciidoc -d manpage -b html5 -s -f man-html.conf opts.3.txt

analyze: clean
	$(SCAN_BUILD) $(MAKE)
{'fraction_non_alphanumeric': 0.18370285056147423, 'fraction_numerical': 0.01785200115174201, 'mean_word_length': 3.1805054151624548, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '7158133', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1382, 'n_words': 423}