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
2011-09-19 11:55:45 +04:00
help all :
@echo "** BUILDDIR not defined; available features:"
@for dir in */; do \
echo -n " $$ dir: " ; \
grep -h '^use/' $$ dir/config.mk \
| cut -f1 -d: \
| tr '\n' ' ' \
| sort -u; \
done
e l s e
2011-06-12 19:06:36 +04:00
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
2011-10-20 19:44:15 +04:00
### sorry for somewhat complicated and overly long lines
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 \
2011-10-21 22:07:44 +04:00
if [ -n " $( GLOBAL_DEBUG) " ] ; then \
echo " ** adding $$ feat feature " ; \
fi ; \
pushd " $$ feat " >/dev/null && \
2011-09-13 20:15:42 +04:00
for sub in / $( SUBPROFILES) ; do \
src = " $$ {sub%/*} " ; \
dst = " $$ {sub#*/} " ; \
2011-10-21 22:07:44 +04:00
if [ -d " $$ src " ] ; then \
rsync -qab " $$ src/ " " $( BUILDDIR) / $$ dst/ " ; \
dirtags = " && $$ src " ; \
fi ; \
if [ -d " $$ dst " ] ; then \
rsync -qab " $$ dst/ " " $( BUILDDIR) / $$ dst/ " ; \
if [ " $$ dst " != " $$ src " ] ; then \
dirtags = " && ( $$ src || $$ dst) " ; \
fi ; \
fi ; \
2011-10-06 12:46:31 +04:00
for dir in lib { image-,} scripts.d; do \
destdir = " $( BUILDDIR) / $$ dst/ $$ dir/ " ; \
if [ -d " $$ destdir " ] ; then \
if [ -d " $$ dir " ] ; then \
rsync -qab " $$ dir/ " " $$ destdir/ " ; \
2011-09-13 20:15:42 +04:00
fi ; \
2011-10-06 12:46:31 +04:00
if [ -d " tagged/ $$ dir " ] ; then \
2011-10-21 22:07:44 +04:00
if pushd " tagged/ $$ dir " >/dev/null; then \
echo " $$ feat $$ dirtags " \
2011-10-20 19:44:15 +04:00
| tags2lists . \
2011-10-21 22:07:44 +04:00
| xargs -r cp -vpLt " $$ destdir " --; \
popd >/dev/null; \
2011-10-20 19:44:15 +04:00
fi ; \
2011-09-13 20:15:42 +04:00
fi ; \
fi ; \
done ; \
2011-10-20 19:44:15 +04:00
if type -t git >& /dev/null && \
2011-10-21 22:07:44 +04:00
pushd " $( BUILDDIR) / $$ dst/ " >/dev/null; then \
2011-10-20 19:44:15 +04:00
test -n "`git status -s`" && \
git add . && \
if [ -n " $$ dst " ] ; then \
the = " $$ sub subprofile " ; \
else \
the = "toplevel" ; \
fi && \
2011-10-21 20:17:57 +04:00
git commit -qam " $$ feat feature: $$ the part added " ; \
2011-10-21 22:07:44 +04:00
popd >/dev/null; \
2011-08-22 22:37:21 +04:00
fi ; \
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-10-20 19:44:15 +04:00
if type -t git >& /dev/null && \
2011-10-21 22:07:44 +04:00
pushd " $( BUILDDIR) / " >/dev/null; then \
2011-10-20 19:44:15 +04:00
if test -n "`git status -s`" ; then \
git add . && \
git commit -qam " $$ feat feature generation complete " ; \
fi ; \
2011-10-21 22:07:44 +04:00
popd >/dev/null; \
2011-10-20 19:44:15 +04:00
fi ; \
2011-10-21 22:07:44 +04:00
popd >/dev/null; \
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
2011-09-19 11:55:45 +04:00
e n d i f