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

PREFIX	?= /var/lib/pkg

pkg-m		:= a b c
a-vers		:= 0 1 2
a-deps		:= b c
b-vers		:= 3 4 5
b-deps		:= c
c-vers		:= 0

.PHONY: all

all::

.SILENT::

define pkg_control =
.SILENT:: tgz/$(1)-$(2)$(PREFIX)/$(1)/control
tgz/$(1)-$(2)$(PREFIX)/$(1)/control:
	install -d $$(@D)
	echo "Package: $(1)" >$$@
	echo "Version: $(2)" >>$$@
	[ -z "$$($(1)-deps)" ] || echo "Depends: $$($(1)-deps)" >>$$@
	cat $$@
	echo

pkgfiles-m += tgz/$(1)-$(2)$(PREFIX)/$(1)/control
endef

$(foreach pkg,$(pkg-m),$(eval $(call $(foreach vers,$($(pkg)-vers),$(eval $(call pkg_control,$(pkg),$(vers)))))))

all:: $(pkgfiles-m)

clean:
	rm -rf tgz/
<commit_msg>makefile: foreach: add pkg scripts.<commit_after>#!/usr/bin/gmake -f
#
# Copyright 2016 <NAME> <<EMAIL>>
#
# Licensed under the MIT license.
#

PREFIX	?= /var/lib/pkg

pkg-m		:= a b c
a-vers		:= 0 1 2
a-deps		:= b c
a-preinst	:= true
b-vers		:= 3 4 5
b-deps		:= c
c-vers		:= 0
c-postinst	:= false

.PHONY: all

all::

.SILENT::

define pkg_script =
ifneq (,$($(1)-$(3)))
.SILENT:: tgz/$(1)-$(2)$(PREFIX)/$(1)/$(3)
tgz/$(1)-$(2)$(PREFIX)/$(1)/$(3):
	install -d $$(@D)
	echo "#!/bin/sh" >$$@
	echo "$$($(1)-$(3))" >>$$@
	chmod a+x $$@
	echo "$(3): $$($(1)-$(3))" | sed 's/^.\| [a-z]/XXX-\U&/'

$(1)-$(2)-script-y := tgz/$(1)-$(2)$(PREFIX)/$(1)/$(3)
endif
endef

define pkg_control =
.SILENT:: tgz/$(1)-$(2)$(PREFIX)/$(1)/control
tgz/$(1)-$(2)$(PREFIX)/$(1)/control:
	install -d $$(@D)
	echo "Package: $(1)" >$$@
	echo "Version: $(2)" >>$$@
	[ -z "$$($(1)-deps)" ] || echo "Depends: $$($(1)-deps)" >>$$@
	echo
	cat $$@

$(foreach script,preinst postinst prerm postrm,$(eval $(call pkg_script,$(1),$(2),$(script))))

pkgfiles-m += tgz/$(1)-$(2)$(PREFIX)/$(1)/control $($(1)-$(2)-script-y)
endef

$(foreach pkg,$(pkg-m),$(eval $(call $(foreach vers,$($(pkg)-vers),$(eval $(call pkg_control,$(pkg),$(vers)))))))

all:: $(pkgfiles-m)

clean:
	rm -rf tgz/

{'fraction_non_alphanumeric': 0.3205837946653246, 'fraction_numerical': 0.03673880221439356, 'mean_word_length': 3.8845208845208847, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 22, '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': '2727964', 'n_tokens_mistral': 976, 'n_tokens_neox': 921, 'n_words': 188}