This version includes changes to protect shell variables with quotes.
Also, the output is stripped of any duplicate lines.

Finally, there are some [sub]makefiles which contain dependencies on
other makefiles which are not enabled by the configuration.  For example,
in the case of 'ipkg', the host Makefile depends on the target Makefile
also being included.  With the minimization process, the target Makefile
won't be included and this causes the host build to fail.  I've included
patches to make the tools I've tested build.

From: Gary Thomas <[EMAIL PROTECTED]>

By only including those [sub] makefiles which are actually used in the
build, the process runs faster and also avoids the dreaded error
  'bash: line too long'

Signed-off-by: Gary Thomas <[EMAIL PROTECTED]>
---

--- public_ptxdist-trunk/rules/host-ipkg.make   2008-08-15 04:49:34.000000000 
-0600
+++ my_ptxdist-trunk/rules/host-ipkg.make       2008-11-24 07:48:53.000000000 
-0700
@@ -15,6 +15,11 @@
 #
 HOST_PACKAGES-$(PTXCONF_HOST_IPKG) += host-ipkg

+# This keeps target & host tools in step
+ifeq ($(IPKG),)
+include $(RULESDIR)/ipkg.make
+endif
+
 #
 # Paths and names
 #
--- public_ptxdist-trunk/rules/host-lrzsz.make  2008-08-15 04:48:05.000000000 
-0600
+++ my_ptxdist-trunk/rules/host-lrzsz.make      2008-08-28 08:41:55.000000000 
-0600
@@ -14,6 +14,11 @@
 #
 HOST_PACKAGES-$(PTXCONF_HOST_LRZSZ) += host-lrzsz

+# This keeps target & host tools in step
+ifeq ($(LRZSZ),)
+include $(RULESDIR)/lrzsz.make
+endif
+
 #
 # Paths and names
 #
--- public_ptxdist-trunk/rules/host-mtd-utils.make      2008-10-29 
07:41:11.000000000 -0600
+++ my_ptxdist-trunk/rules/host-mtd-utils.make  2008-11-19 07:44:32.000000000 
-0700
@@ -14,6 +14,11 @@
 #
 HOST_PACKAGES-$(PTXCONF_HOST_MTD_UTILS) += host-mtd-utils

+# This keeps target & host tools in step
+ifeq ($(MTD_UTILS),)
+include $(RULESDIR)/mtd-utils.make
+endif
+
 #
 # Paths and names
 #
--- public_ptxdist-trunk/rules/other/Toplevel.make      2008-11-19 
07:55:29.000000000 -0700
+++ my_ptxdist-trunk/rules/other/Toplevel.make  2008-11-19 08:07:42.000000000 
-0700
@@ -37,7 +37,7 @@ include $(wildcard $(PROJECTPRERULESDIR)
 endif

 #include $(PTX_DGEN_DEPS_PRE)
-include $(PTX_DGEN_RULESFILES_MAKE)
+include $(PTX_DGEN_RULESFILES_MAKE_MIN)
 include $(PTX_DGEN_DEPS_POST)

 include $(PTX_MAP_ALL_MAKE)
--- public_ptxdist-trunk/scripts/lib/ptxd_lib_dgen.sh   2008-11-14 
06:38:57.000000000 -0700
+++ my_ptxdist-trunk/scripts/lib/ptxd_lib_dgen.sh       2008-11-24 
07:44:13.000000000 -0700
@@ -41,6 +41,31 @@ ptxd_dgen_rulesfiles() {
     ) > "${PTX_DGEN_RULESFILES}"

     sed -e "s/\(.*\)/include \1/" "${PTX_DGEN_RULESFILES}" > 
"${PTX_DGEN_RULESFILES_MAKE}"
+
+    # Compute minimal set of makefiles
+
+    # Compute the package strings
+    xargs <"${PTX_DGEN_RULESFILES}" fgrep -h 'PACKAGES-$' 
>"${PTXDIST_TEMPDIR}/pkg_names"
+
+    cat >"${PTXDIST_TEMPDIR}/show_pkgs" <<EOF
+# Read in configuration
+include  ${PTXDIST_PTXCONFIG}
+include  ${PTXDIST_PLATFORMCONFIG}
+
+# Figure out packages
+include ${PTXDIST_TEMPDIR}/pkg_names
+
+all:
+       @echo \${PACKAGES-y} \${PACKAGES-m} \${PACKAGES-y-y} \${PACKAGES-y-m}
+       @echo \${HOST_PACKAGES-y} \${HOST_PACKAGES-m} \${HOST_PACKAGES-y-y} 
\${HOST_PACKAGES-y-m}
+       @echo \${CROSS_PACKAGES-y} \${CROSS_PACKAGES-m} \${CROSS_PACKAGES-y-y} 
\${CROSS_PACKAGES-y-m}
+EOF
+    PKGS=`make -f "${PTXDIST_TEMPDIR}/show_pkgs"`
+    ( for i in ${PKGS}; do
+       grep /${i} ${PTX_DGEN_RULESFILES_MAKE}
+    done ) | sort | uniq > "${PTX_DGEN_RULESFILES_MAKE_MIN}"
+
+
 }


--- public_ptxdist-trunk/scripts/ptxdist_vars.sh        2008-11-14 
06:38:57.000000000 -0700
+++ my_ptxdist-trunk/scripts/ptxdist_vars.sh    2008-11-19 07:45:18.000000000 
-0700
@@ -27,6 +27,7 @@ PTX_DGEN_DEPS_PRE=${STATEDIR}/ptx_dgen_d
 PTX_DGEN_DEPS_POST=${STATEDIR}/ptx_dgen_deps.post
 PTX_DGEN_RULESFILES=${STATEDIR}/ptx_dgen_rulesfiles
 PTX_DGEN_RULESFILES_MAKE=${PTX_DGEN_RULESFILES}.make
+PTX_DGEN_RULESFILES_MAKE_MIN=${PTX_DGEN_RULESFILES}_min.make

 PTX_MAP_ALL=${STATEDIR}/ptx_map_all.sh
 PTX_MAP_ALL_MAKE=${PTX_MAP_ALL}.make

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

--
ptxdist mailing list
[email protected]

Reply via email to