<commit_before>prefix?=/usr/local
exec_prefix?=$(prefix)
bindir?=$(exec_prefix)/bin
libdir?=$(exec_prefix)/lib
datarootdir?=$(prefix)/share
mandir?=$(datarootdir)/man
man1dir?=$(mandir)/man1
sysconfdir?=$(prefix)/etc

ifeq ($(prefix),$(HOME))
  plugindir?=$(HOME)/.gstreamer-0.10/plugins
else
  plugindir?=$(libdir)/gstreamer-0.10
endif

INSTALL?=install
TAR?=tar  # Must be GNU tar

dependencies = gstreamer-0.10
dependencies += gstreamer-base-0.10
dependencies += gstreamer-video-0.10
dependencies += opencv

# Generate version from 'git describe' when in git repository, and from
# VERSION file included in the dist tarball otherwise.
generate_version := $(shell \
	git describe --always --dirty > VERSION.now 2>/dev/null && \
	{ cmp VERSION.now VERSION 2>/dev/null || mv VERSION.now VERSION; }; \
	rm -f VERSION.now)
VERSION?=$(shell cat VERSION)

all: stbt stbt.1 gst/libgst-stb-tester.so

stbt: stbt.in
	sed -e 's,@VERSION@,$(VERSION),g' \
	    -e 's,@LIBDIR@,$(libdir),g' \
	    -e 's,@SYSCONFDIR@,$(sysconfdir),g' $< > $@

install: stbt stbt.1 gst/libgst-stb-tester.so
	$(INSTALL) -m 0755 -d \
	    $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/stbt $(DESTDIR)$(man1dir) \
	    $(DESTDIR)$(plugindir) \
	    $(DESTDIR)$(sysconfdir)/{stbt,bash_completion.d}
	$(INSTALL) -m 0755 stbt $(DESTDIR)$(bindir)
	$(INSTALL) -m 0755 stbt-record stbt-run $(DESTDIR)$(libdir)/stbt
	$(INSTALL) -m 0644 stbt.py $(DESTDIR)$(libdir)/stbt
	$(INSTALL) -m 0644 stbt.1 $(DESTDIR)$(man1dir)
	$(INSTALL) -m 0755 gst/libgst-stb-tester.so $(DESTDIR)$(plugindir)
	$(INSTALL) -m 0644 stbt.conf $(DESTDIR)$(sysconfdir)/stbt
	$(INSTALL) -m 0644 stbt-completion \
	    $(DESTDIR)$(sysconfdir)/bash_completion.d/stbt

doc: stbt.1

# Requires python-docutils
stbt.1: README.rst VERSION
	sed -e 's/@VERSION@/$(VERSION)/g' $< |\
	rst2man > $@

# Can only be run from within a git clone of stb-tester or VERSION wont be
# set correctly
dist: stb-tester-$(VERSION).tar.gz

stb-tester-$(VERSION).tar.gz: stbt-record stbt-run stbt.conf stbt.in stbt.py \
                              LICENSE Makefile README.rst VERSION
	$(TAR) -c -z --transform='s,^,stb-tester-$(VERSION)/,' -f $@ $^

clean:
	rm -f stbt.1 stbt gst/*.o gst/libgst-stb-tester.so

check: check-nosetests check-integrationtests check-pep8 check-bashcompletion
check-nosetests:
	nosetests --with-doctest -v stbt.py
check-integrationtests:
	PATH="$$PWD:$$PATH" tests/run-tests.sh
check-pep8:
	pep8 stbt.py stbt-run stbt-record
check-bashcompletion:
	set -e; \
	. ./stbt-completion; \
	for t in `declare -F | awk '/_stbt_test_/ {print $$3}'`; do ($$t); done

.DELETE_ON_ERROR:


### GStreamer plugin ###

# CFLAGS and LDFLAGS are for the user to override from the command line.
CFLAGS ?= -g -O2
extra_cflags = -fPIC '-DPACKAGE="stb-tester"' '-DVERSION="$(VERSION)"'
extra_cflags += $(shell pkg-config --cflags $(dependencies))
extra_ldflags = $(shell pkg-config --libs $(dependencies))

OBJS = gst/gst-stb-tester.o
OBJS += gst/gstmotiondetect.o

$(OBJS): %.o: %.c
	$(CC) -o $@ -c $(extra_cflags) $(CPPFLAGS) $(CFLAGS) $<
# Header dependencies:
gst/gstmotiondetect.o: gst/gstmotiondetect.h

gst/libgst-stb-tester.so: $(OBJS)
	$(CC) -shared -o $@ $^ $(extra_ldflags) $(LDFLAGS)<commit_msg>Makefile: Cleanup internal order of various targets<commit_after># The default target of this Makefile is:
all:

prefix?=/usr/local
exec_prefix?=$(prefix)
bindir?=$(exec_prefix)/bin
libdir?=$(exec_prefix)/lib
datarootdir?=$(prefix)/share
mandir?=$(datarootdir)/man
man1dir?=$(mandir)/man1
sysconfdir?=$(prefix)/etc

ifeq ($(prefix),$(HOME))
  plugindir?=$(HOME)/.gstreamer-0.10/plugins
else
  plugindir?=$(libdir)/gstreamer-0.10
endif

INSTALL?=install
TAR?=tar  # Must be GNU tar

dependencies = gstreamer-0.10
dependencies += gstreamer-base-0.10
dependencies += gstreamer-video-0.10
dependencies += opencv

# CFLAGS and LDFLAGS are for the user to override from the command line.
CFLAGS ?= -g -O2
extra_cflags = -fPIC '-DPACKAGE="stb-tester"' '-DVERSION="$(VERSION)"'
extra_cflags += $(shell pkg-config --cflags $(dependencies))
extra_ldflags = $(shell pkg-config --libs $(dependencies))

OBJS = gst/gst-stb-tester.o
OBJS += gst/gstmotiondetect.o

# Generate version from 'git describe' when in git repository, and from
# VERSION file included in the dist tarball otherwise.
generate_version := $(shell \
	git describe --always --dirty > VERSION.now 2>/dev/null && \
	{ cmp VERSION.now VERSION 2>/dev/null || mv VERSION.now VERSION; }; \
	rm -f VERSION.now)
VERSION?=$(shell cat VERSION)

.DELETE_ON_ERROR:


all: stbt stbt.1 gst/libgst-stb-tester.so

stbt: stbt.in
	sed -e 's,@VERSION@,$(VERSION),g' \
	    -e 's,@LIBDIR@,$(libdir),g' \
	    -e 's,@SYSCONFDIR@,$(sysconfdir),g' $< > $@

install: stbt stbt.1 gst/libgst-stb-tester.so
	$(INSTALL) -m 0755 -d \
	    $(DESTDIR)$(bindir) \
	    $(DESTDIR)$(libdir)/stbt \
	    $(DESTDIR)$(plugindir) \
	    $(DESTDIR)$(man1dir) \
	    $(DESTDIR)$(sysconfdir)/{stbt,bash_completion.d}
	$(INSTALL) -m 0755 stbt $(DESTDIR)$(bindir)
	$(INSTALL) -m 0755 stbt-record stbt-run $(DESTDIR)$(libdir)/stbt
	$(INSTALL) -m 0644 stbt.py $(DESTDIR)$(libdir)/stbt
	$(INSTALL) -m 0755 gst/libgst-stb-tester.so $(DESTDIR)$(plugindir)
	$(INSTALL) -m 0644 stbt.1 $(DESTDIR)$(man1dir)
	$(INSTALL) -m 0644 stbt.conf $(DESTDIR)$(sysconfdir)/stbt
	$(INSTALL) -m 0644 stbt-completion \
	    $(DESTDIR)$(sysconfdir)/bash_completion.d/stbt

doc: stbt.1

# Requires python-docutils
stbt.1: README.rst VERSION
	sed -e 's/@VERSION@/$(VERSION)/g' $< |\
	rst2man > $@

clean:
	rm -f stbt.1 stbt gst/*.o gst/libgst-stb-tester.so

check: check-nosetests check-integrationtests check-pep8 check-bashcompletion
check-nosetests:
	nosetests --with-doctest -v stbt.py
check-integrationtests:
	PATH="$$PWD:$$PATH" tests/run-tests.sh
check-pep8:
	pep8 stbt.py stbt-run stbt-record
check-bashcompletion:
	set -e; \
	. ./stbt-completion; \
	for t in `declare -F | awk '/_stbt_test_/ {print $$3}'`; do ($$t); done


# Can only be run from within a git clone of stb-tester or VERSION wont be
# set correctly
dist: stb-tester-$(VERSION).tar.gz

DIST = stbt.in
DIST += stbt-record
DIST += stbt-run
DIST += stbt.py
DIST += README.rst
DIST += stbt.conf
DIST += LICENSE
DIST += Makefile
DIST += VERSION

stb-tester-$(VERSION).tar.gz: $(DIST)
	$(TAR) -c -z --transform='s,^,stb-tester-$(VERSION)/,' -f $@ $^


# GStreamer plugin
gst/libgst-stb-tester.so: $(OBJS)
	$(CC) -shared -o $@ $^ $(extra_ldflags) $(LDFLAGS)

$(OBJS): %.o: %.c
	$(CC) -o $@ -c $(extra_cflags) $(CPPFLAGS) $(CFLAGS) $<
# Header dependencies:
gst/gstmotiondetect.o: gst/gstmotiondetect.h
{'fraction_non_alphanumeric': 0.18181818181818182, 'fraction_numerical': 0.01979594944419065, 'mean_word_length': 4.159465828750982, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3758963', 'n_tokens_mistral': 2814, 'n_tokens_neox': 2637, 'n_words': 570}