extracts tag definition
[build.git] / Rules.mk
index ff292ae..7a8647d 100644 (file)
--- a/Rules.mk
+++ b/Rules.mk
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2003-2006 The Trustees of Princeton University
 #
-# $Id: Rules.mk,v 1.25 2006/11/28 22:45:05 mef Exp $
+# $Id: Rules.mk,v 1.30 2007/02/12 09:42:25 thierry Exp $
 #
 
 # Base rpmbuild in the current directory
@@ -27,7 +27,10 @@ else
         # Define cvstag for tagged builds
        echo "%define cvstag $(TAG)" >> $@
 endif
-       cvs -d $(CVSROOT) checkout -r $(TAG) -p $(SPEC) >> $@
+       $(if $($(package)-SVNPATH),\
+  svn cat $($(package)-SVNPATH)/$(SPEC) >> $@,\
+  cvs -d $(CVSROOT) checkout -r $(TAG) -p $(SPEC) >> $@)
+
 
 #
 # Parse spec file into Makefile fragment
@@ -60,9 +63,29 @@ $(patsubst %.tar,%,$(1))))))
 
 SOURCEDIRS := $(call stripext,$(SOURCES))
 
+# Thierry - Jan 29 2007
+# Allow different modules to have  different CVSROOT
+# and/or to be extracted from their SVNPATH
+#
+# is there a single module ? to mimick cvs export -d behaviour
+MULTI_MODULE := $(word 2,$(MODULE))
+ifeq "$(MULTI_MODULE)" ""
+# single module: do as before
 SOURCES/$(package):
        mkdir -p SOURCES
-       cd SOURCES && cvs -d $(CVSROOT) export -r $(TAG) -d $(package) $(MODULE)
+       $(if $($(package)-SVNPATH),\
+  cd SOURCES && svn export $($(package)-SVNPATH) $(package),\
+  cd SOURCES && cvs -d $(CVSROOT) export -r $(TAG) -d $(package) $(MODULE))
+else
+# multiple modules : iterate 
+SOURCES/$(package):
+       mkdir -p SOURCES/$(package) && cd SOURCES/$(package) && (\
+       $(foreach module,$(MODULE),\
+        $(if $($(module)-SVNPATH), \
+  svn export $($(module)-SVNPATH) $(module), \
+  cvs -d $(if $($(module)-CVSROOT),$($(module)-CVSROOT),$(CVSROOT)) export -r $(TAG)  $(module);\
+         )))
+endif
 
 # Make a hard-linked copy of the exported directory for each Source
 # defined in the spec file. However, our convention is that there
@@ -126,3 +149,13 @@ clean:
        $(MK) $(SPECFILE)
 
 .PHONY: all clean
+
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
+++%: varname=$(subst +,,$@)
+++%:
+       @echo $(varname)=$($(varname))
++%: varname=$(subst +,,$@)
++%:
+       @echo $($(varname))