0

Suppose this makefile snippet

 $(cfstdlib):
    svn export --force $(CF_REPO)/masterfiles/trunk/lib/$(VERSION)/

Where cfstdlib is a list of files, and the svn command, run only once, will create all the files the list. When I run make it executes svn for each file in the list. How can I make the svn command run only once?

Neil H Watson
  • 1,002
  • 1
  • 14
  • 31
  • possible duplicate of [GNU Makefile rule generating a few targets from a single source file](http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file) – Louis Nov 28 '14 at 17:22

1 Answers1

0
$(cfstdlib): sentinel ;                                                         

.PHONY: phony                                                                   
.ONESHELL:                                                                      

sentinel: phony                                                                 
    temp=`mktemp -d`                                                      
    svn export --force $(CF_REPO)/masterfiles/trunk/lib/$(VERSION)/ $$temp                                                    
    if [ "`diff -r $(VERSION) $$temp 2>&1`" ]                             
    then                                                                   
            rm -rf $(VERSION)                                             
            mv $$temp $(VERSION)                                          
            touch $@ 
    else
            rm -rf $$temp                                                     
    fi
Mark Galeck
  • 6,155
  • 1
  • 28
  • 55