<commit_before>#!/usr/bin/gmake -f
#
# Copyright 2015-2016 <NAME> <<EMAIL>>
#
# Licensed under the MIT license.
#

VERSION		 = 0
PATCHLEVEL	 = 1
SUBLEVEL	 = 1
EXTRAVERSION	 = 
NAME		 = I am not an Hero!
RELEASE		 = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)

PATH		:= $(PWD)/bin:$(PATH)
sysconfdir	:= /etc
localstatedir	:= /var

PREFIX		?= /usr/local
EPREFIX		?= $(PREFIX)
bindir		?= $(EPREFIX)/bin
sbindir		?= $(EPREFIX)/sbin
libexecdir	?= $(EPREFIX)/libexec
sysconfdir	?= $(PREFIX)/etc
sharedstatedir	?= $(PREFIX)/com
localstatedir	?= $(PREFIX)/var
libdir		?= $(EPREFIX)/lib
includedir	?= $(PREFIX)/include
oldincludedir	?= /usr/include
datarootdir	?= $(PREFIX)/share
datadir		?= $(datarootdir)
infodir		?= $(datarootdir)
localedir	?= $(datarootdir)/locale
mandir		?= $(datarootdir)/man
docdir		?= $(datarootdir)/doc/mpkg
htmldir		?= $(datarootdir)
dvidir		?= $(datarootdir)
pdfdir		?= $(datarootdir)
psdir		?= $(datarootdir)

pkg-m		:= mpkg mpkg-tools
mpkg-dir	:= $(sysconfdir)/mpkg/repos.d $(localstatedir)/lib/mpkg/lists
mpkg-sbin	:= bin/mpkg
mpkg-tools-bin	:= bin/mpkg-build bin/mpkg-deb2tgz bin/mpkg-make-index

all::

.PHONY:: all

.SILENT:: all version

define do_install =
.SILENT:: tgz/$(1)_$(2)/$(3)
tgz/$(1)_$(2)/$(3): $(3)
	install -d $$(@D)
	install -m 755 $$< $$(@D)
	chmod a+x $$@

$(1)-$(2)-bin-y += tgz/$(1)_$(2)/$(3)
endef

define do_install_dir =
tgz/$(1)_$(2)/$(3):
	echo "Doing $$@..."
	install -m 644 -d $$@

$(1)-$(2)-dir-y += tgz/$(1)_$(2)/$(3)
endef

define do_pkg_info =
.SILENT:: tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control
tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control:
	install -d $$(@D)
	echo "Package: $(1)" >$$@
	echo "Version: $(2)" >>$$@
	echo
	cat $$@

$(1)-$(2)-info-y += tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control
$(foreach dir,$($(1)-dir),$(eval $(call do_install_dir,$(1),$(2),$(dir))))
$(foreach bin,$($(1)-sbin),$(eval $(call do_install,$(1),$(2),$(bin))))
$(foreach bin,$($(1)-bin),$(eval $(call do_install,$(1),$(2),$(bin))))
endef

define do_pkg =
$(eval $(call do_pkg_info,$(1),$(RELEASE)))

pkgdirs-m  += tgz/$(1)_$(RELEASE)
tgz/$(1)_$(RELEASE).tgz:: $($(1)-$(RELEASE)-info-y) $($(1)-$(RELEASE)-bin-y) $($(1)-$(RELEASE)-dir-y)
endef

$(foreach pkg,$(pkg-m),$(eval $(call do_pkg,$(pkg))))

tgz-m := $(patsubst %,%.tgz,$(pkgdirs-m))

tgz/%.tgz:
	( cd $(@D)/ && fakeroot -- mpkg-build $* )

tgz/Index: $(tgz-m)<commit_msg>Makefile: fix installation directory of bin/sbin files.<commit_after>#!/usr/bin/gmake -f
#
# Copyright 2015-2016 <NAME> <<EMAIL>>
#
# Licensed under the MIT license.
#

VERSION		 = 0
PATCHLEVEL	 = 1
SUBLEVEL	 = 1
EXTRAVERSION	 = 
NAME		 = I am not an Hero!
RELEASE		 = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)

PATH		:= $(PWD)/bin:$(PATH)
sysconfdir	:= /etc
localstatedir	:= /var

PREFIX		?= /usr/local
EPREFIX		?= $(PREFIX)
bindir		?= $(EPREFIX)/bin
sbindir		?= $(EPREFIX)/sbin
libexecdir	?= $(EPREFIX)/libexec
sysconfdir	?= $(PREFIX)/etc
sharedstatedir	?= $(PREFIX)/com
localstatedir	?= $(PREFIX)/var
libdir		?= $(EPREFIX)/lib
includedir	?= $(PREFIX)/include
oldincludedir	?= /usr/include
datarootdir	?= $(PREFIX)/share
datadir		?= $(datarootdir)
infodir		?= $(datarootdir)
localedir	?= $(datarootdir)/locale
mandir		?= $(datarootdir)/man
docdir		?= $(datarootdir)/doc/mpkg
htmldir		?= $(datarootdir)
dvidir		?= $(datarootdir)
pdfdir		?= $(datarootdir)
psdir		?= $(datarootdir)

pkg-m		:= mpkg mpkg-tools
mpkg-dir	:= $(sysconfdir)/mpkg/repos.d $(localstatedir)/lib/mpkg/lists
mpkg-sbin	:= bin/mpkg
mpkg-tools-bin	:= bin/mpkg-build bin/mpkg-deb2tgz bin/mpkg-make-index

all::

.PHONY:: all

.SILENT:: all version

define do_install =
.SILENT:: tgz/$(1)_$(2)/$(3)/$(notdir $(4))
tgz/$(1)_$(2)/$(3)/$(notdir $(4)): $(4)
	install -d $$(@D)
	install -m 755 $$< $$(@D)
	chmod a+x $$@

$(1)-$(2)-bin-y += tgz/$(1)_$(2)/$(3)/$(notdir $(4))
endef

define do_install_dir =
tgz/$(1)_$(2)/$(3):
	echo "Doing $$@..."
	install -m 644 -d $$@

$(1)-$(2)-dir-y += tgz/$(1)_$(2)/$(3)
endef

define do_pkg_info =
.SILENT:: tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control
tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control:
	install -d $$(@D)
	echo "Package: $(1)" >$$@
	echo "Version: $(2)" >>$$@
	echo
	cat $$@

$(1)-$(2)-info-y += tgz/$(1)_$(2)$(localstatedir)/lib/mpkg/info/$(1)/control
$(foreach dir,$($(1)-dir),$(eval $(call do_install_dir,$(1),$(2),$(dir))))
$(foreach bin,$($(1)-sbin),$(eval $(call do_install,$(1),$(2),$(sbindir),$(bin))))
$(foreach bin,$($(1)-bin),$(eval $(call do_install,$(1),$(2),$(bindir),$(bin))))
endef

define do_pkg =
$(eval $(call do_pkg_info,$(1),$(RELEASE)))

pkgdirs-m  += tgz/$(1)_$(RELEASE)
tgz/$(1)_$(RELEASE).tgz:: $($(1)-$(RELEASE)-info-y) $($(1)-$(RELEASE)-bin-y) $($(1)-$(RELEASE)-dir-y)
endef

$(foreach pkg,$(pkg-m),$(eval $(call do_pkg,$(pkg))))

tgz-m := $(patsubst %,%.tgz,$(pkgdirs-m))

tgz/%.tgz:
	( cd $(@D)/ && fakeroot -- mpkg-build $* )

tgz/Index: $(tgz-m)
{'fraction_non_alphanumeric': 0.2733439744612929, 'fraction_numerical': 0.02693535514764565, 'mean_word_length': 4.849474912485414, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '385845', 'n_tokens_mistral': 2343, 'n_tokens_neox': 2253, 'n_words': 370}