Hi list,

I am unable to find an imake template to create a rule to install
files from a directory which does not have a makefile itself.
I need to process some files matching a mask (e.g. somedir/*.xpm)
without having to list them all in a makefile.

There is a InstallMultiple(list,dest) macro, but it takes a file list
as an argument. That's exactly what I want to avoid.

I belive that this is quite a general task, so I dare to propose a
new template. Please have a look at the attached patch. I would
appreciate any ideas about this patch or maybe there are good reasons
not to have such a template? Better ways to do this?

Thanks in advance!


-- 
Alexander Pohoyda
<[EMAIL PROTECTED]>

--- Imake.rules.orig    Tue Jun 24 22:31:17 2003
+++ Imake.rules Tue Jun 24 22:34:52 2003
@@ -99,6 +99,9 @@
  * InstallMultipleFlags                (list,dest,flags)
  * InstallMultipleMan          (list,dest)
  * InstallMultipleManSuffix    (list,dest,suffix)
+ * InstallMultipleByMaskDestFlags      (step,dir,mask,dest,flags)
+ * InstallMultipleByMaskDest   (step,dir,mask,dest)
+ * InstallMultipleByMask       (dir,mask,dest)
  * DependDependency            ()
  * DependTarget                        ()
  * DependTarget3               (srcs1,srcs2,srcs3)
@@ -1832,6 +1835,33 @@
          (set -x; $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $$i.suffix 
$(DESTDIR)dest/$$i.$(MANSUFFIX)); \    @@\
        done
 #endif /* InstallMultipleManSuffix */
+
+
+/*
+ * InstallMultipleByMaskDestFlags - generate rules to install multiple files
+ * matching specified mask during a particular step in the build using a
+ * specific set of install flags.
+ */
+
+#ifndef InstallMultipleByMaskDestFlags
+#define InstallMultipleByMaskDestFlags(step,dir,mask,dest,flags)       @@\
+step:: dir                                                             @@\
+       MakeDir($(DESTDIR)dest)                                         @@\
+       @MakeFlagsToShellFlags(i,set +e); \                             @@\
+       for i in `ls dir/mask`; do \                                    @@\
+               (set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \       
 @@\
+       done
+#endif /* InstallMultipleByMaskDestFlags */
+
+#ifndef InstallMultipleByMaskDest
+#define InstallMultipleByMaskDest(step,dir,mask,dest)                  @@\
+InstallMultipleByMaskDestFlags(step,dir,mask,dest,$(INSTDATFLAGS))
+#endif /* InstallMultipleByMaskDest */
+
+#ifndef InstallMultipleByMask
+#define InstallMultipleByMask(dir,mask,dest)                           @@\
+InstallMultipleByMaskDest(install,dir,mask,dest)
+#endif /* InstallMultipleByMask */
 
 
 /*

Reply via email to