2010-12-03 17:53:02 +03:00
# step 3: copy the needed features to $(BUILDDIR)
# (only regarding the needed subprofiles)
2011-06-12 19:06:36 +04:00
i f n d e f B U I L D D I R
$( error BUILDDIR not defined )
e n d i f
2011-08-22 20:29:22 +04:00
i n c l u d e $( BUILDDIR ) / d i s t c f g . m k
2010-09-14 14:18:53 +04:00
2011-08-22 20:29:22 +04:00
# first rsync what's static, and make backups (*~) --
2010-09-14 14:18:53 +04:00
# these might signal of file clashes (or plain dirt);
2011-09-13 20:15:42 +04:00
# second, care for toplevel and tagged script dirs;
2010-09-14 14:18:53 +04:00
# then handle two more ways of implementing a feature
2011-09-13 20:15:42 +04:00
#
2011-09-11 17:08:31 +04:00
# NB: some subprofiles will be specified as "src/dst"
2011-09-13 20:15:42 +04:00
# -- then both src/ and dst/ can hold the addons;
# still both pieces go into a single destination
### {image-,}scripts.d/ get rsynced twice :-/
### still we don't want the trimmed-down case
2010-09-09 13:50:29 +04:00
all :
2010-09-14 14:18:53 +04:00
@echo "** starting feature configuration"
2011-09-11 17:08:31 +04:00
@if [ -n " $( GLOBAL_DEBUG) " ] ; then \
echo " ** target subprofiles: $( SUBPROFILES) " ; \
2011-08-22 20:29:22 +04:00
echo " ** requested features: $( FEATURES) " ; \
fi
2011-09-13 20:15:42 +04:00
@for feat in $( FEATURES) ; do \
pushd " $$ feat " && \
for sub in / $( SUBPROFILES) ; do \
src = " $$ {sub%/*} " ; \
dst = " $$ {sub#*/} " ; \
if [ -d " $$ src " ] ; then rsync -qab " $$ src/ " " $( BUILDDIR) / $$ dst/ " ; fi ; \
if [ -d " $$ dst " ] ; then rsync -qab " $$ dst/ " " $( BUILDDIR) / $$ dst/ " ; fi ; \
for scr in { image-,} scripts.d; do \
scriptdir = " $( BUILDDIR) / $$ dst/ $$ scr/ " ; \
if [ -d " $$ scriptdir " ] ; then \
if [ -d " $$ scr " ] ; then \
rsync -qab " $$ scr/ " " $$ scriptdir/ " ; \
fi ; \
if [ -d " tagged/ $$ scr " ] ; then \
pushd " tagged/ $$ scr " && \
echo " ( $$ src || $$ dst) " \
| tags2lists . \
| xargs -r cp -v -pLt " $$ scriptdir " --; \
popd; \
fi ; \
fi ; \
done ; \
2011-09-11 17:08:31 +04:00
type -t git >& /dev/null && \
pushd " $( BUILDDIR) / $$ dst/ " && \
git add . && \
2011-09-13 20:15:42 +04:00
if [ -n " $$ dst " ] ; then \
the = " $$ sub subprofile " ; \
else \
the = "toplevel" ; \
2011-08-22 22:37:21 +04:00
fi ; \
2011-09-13 20:15:42 +04:00
git commit -qam " $$ feat feature ( $$ the part) " || :; \
popd; \
2011-08-22 22:37:21 +04:00
done ; \
2011-09-11 17:08:31 +04:00
if [ -x "generate.sh" ] ; then sh generate.sh; fi ; \
if [ -s "generate.mk" ] ; then $( MAKE) -f generate.mk; fi ; \
2011-08-22 20:29:22 +04:00
type -t git >& /dev/null && \
pushd " $( BUILDDIR) / " && \
git add . && \
2011-09-13 20:15:42 +04:00
git commit -qam " $$ feat feature generation complete " || :; \
2011-08-22 20:29:22 +04:00
popd; \
2011-09-11 17:08:31 +04:00
popd; \
2010-09-14 09:44:35 +04:00
done
2011-08-22 20:29:22 +04:00
@find " $( BUILDDIR) / " -name '*~' \
| sed " s, $( BUILDDIR) /,** warning: file clash: , " >& 2
2010-09-18 18:46:32 +04:00
2011-08-22 20:29:22 +04:00
# FIXME: drop or fix regarding undefined BUILDDIR being ok
#help:
# @echo "** available features:"
# @grep -h '^use/' */config.mk | fmt -sw"$$((COLUMNS>>1))" | column -t