github.com/sylabs/singularity/v4@v4.1.3/makeit/gengodep (about)

     1  #!/bin/sh
     2  
     3  if [ "$1" != "-v3" ] ; then
     4  	cat 1>&2 <<-EOT
     5  
     6  ========================================================================
     7  A non-backwards compatible change has been added to the build system and
     8  it's necessary to start fresh.
     9  
    10  Please remove the build directory ("builddir" by default) and run
    11  mconfig again.
    12  ========================================================================
    13  
    14  	EOT
    15  	exit 1
    16  fi
    17  
    18  shift
    19  
    20  go=$1
    21  var=$2
    22  gotags=$3
    23  depfile=$4
    24  
    25  shift 4
    26  
    27  # this is needed so that the value we are getting from the makefile does
    28  # get propagated down to go list.
    29  export GOPROXY
    30  
    31  template='{{ with $d := . }}{{ if not $d.Standard }}{{ range $d.GoFiles }}{{ printf "%s/%s\n" $d.Dir . }}{{ end }}{{ range $d.CgoFiles }}{{ printf "%s/%s\n" $d.Dir . }}{{ end }}{{ end }}{{ end }}'
    32  
    33  godeps=`${go} list -deps -f "${template}" -tags "${gotags}" "$@" | sort -u`
    34  
    35  for m in ${godeps}; do
    36      echo "$var += $m" >> ${depfile}
    37  done