1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:04:44 -07:00

use multiline string literal in gobuild

R=r
DELTA=76  (1 added, 0 deleted, 75 changed)
OCL=30497
CL=30510
This commit is contained in:
Russ Cox 2009-06-18 16:32:26 -07:00
parent eba82f4391
commit 05240bb290

View File

@ -12,81 +12,82 @@ import (
"template"; "template";
) )
var makefileTemplate = var makefileTemplate = `
"# DO NOT EDIT. Automatically generated by gobuild.\n" # DO NOT EDIT. Automatically generated by gobuild.
"{Args|args} >Makefile\n" {Args|args} >Makefile
"\n"
"D={.section Dir}/{@}{.end}\n" D={.section Dir}/{@}{.end}
"\n"
"include $(GOROOT)/src/Make.$(GOARCH)\n" include $(GOROOT)/src/Make.$(GOARCH)
"AR=gopack\n" AR=gopack
"\n"
"default: packages\n" default: packages
"\n"
"clean:\n" clean:
" rm -rf *.[$(OS)] *.a [$(OS)].out {ObjDir}\n" rm -rf *.[$(OS)] *.a [$(OS)].out {ObjDir}
"\n"
"test: packages\n" test: packages
" gotest\n" gotest
"\n"
"coverage: packages\n" coverage: packages
" gotest\n" gotest
" 6cov -g `pwd` | grep -v '_test\\.go:'\n" 6cov -g $$(pwd) | grep -v '_test\.go:'
"\n"
"%.$O: %.go\n" %.$O: %.go
" $(GC) -I{ObjDir} $*.go\n" $(GC) -I{ObjDir} $*.go
"\n"
"%.$O: %.c\n" %.$O: %.c
" $(CC) $*.c\n" $(CC) $*.c
"\n"
"%.$O: %.s\n" %.$O: %.s
" $(AS) $*.s\n" $(AS) $*.s
"\n"
"{.repeated section Phases}\n" {.repeated section Phases}
"O{Phase}=\\\n" O{Phase}=\
"{.repeated section ArCmds}\n" {.repeated section ArCmds}
"{.repeated section Files}\n" {.repeated section Files}
" {Name|basename}.$O\\\n" {Name|basename}.$O\
"{.end}\n" {.end}
"{.end}\n" {.end}
"\n"
"{.end}\n" {.end}
"\n"
"phases:{.repeated section Phases} a{Phase}{.end}\n" phases:{.repeated section Phases} a{Phase}{.end}
"{.repeated section Packages}\n" {.repeated section Packages}
"{ObjDir}$D/{Name}.a: phases\n" {ObjDir}$D/{Name}.a: phases
"{.end}\n" {.end}
"\n"
"{.repeated section Phases}\n" {.repeated section Phases}
"a{Phase}: $(O{Phase})\n" a{Phase}: $(O{Phase})
"{.repeated section ArCmds}\n" {.repeated section ArCmds}
" $(AR) grc {ObjDir}$D/{.section Pkg}{Name}.a{.end}{.repeated section Files} {Name|basename}.$O{.end}\n" $(AR) grc {ObjDir}$D/{.section Pkg}{Name}.a{.end}{.repeated section Files} {Name|basename}.$O{.end}
"{.end}\n" {.end}
" rm -f $(O{Phase})\n" rm -f $(O{Phase})
"\n"
"{.end}\n" {.end}
"\n"
"newpkg: clean\n" newpkg: clean
" mkdir -p {ObjDir}$D\n" mkdir -p {ObjDir}$D
"{.repeated section Packages}\n" {.repeated section Packages}
" $(AR) grc {ObjDir}$D/{Name}.a\n" $(AR) grc {ObjDir}$D/{Name}.a
"{.end}\n" {.end}
"\n"
"$(O1): newpkg\n" $(O1): newpkg
"{.repeated section Phases}\n" {.repeated section Phases}
"$(O{Phase|+1}): a{Phase}\n" $(O{Phase|+1}): a{Phase}
"{.end}\n" {.end}
"\n"
"nuke: clean\n" nuke: clean
" rm -f{.repeated section Packages} $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/{Name}.a{.end}\n" rm -f{.repeated section Packages} $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/{Name}.a{.end}
"\n"
"packages:{.repeated section Packages} {ObjDir}$D/{Name}.a{.end}\n" packages:{.repeated section Packages} {ObjDir}$D/{Name}.a{.end}
"\n"
"install: packages\n" install: packages
" test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D\n" test -d $(GOROOT)/pkg && mkdir -p $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D
"{.repeated section Packages}\n" {.repeated section Packages}
" cp {ObjDir}$D/{Name}.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/{Name}.a\n" cp {ObjDir}$D/{Name}.a $(GOROOT)/pkg/$(GOOS)_$(GOARCH)$D/{Name}.a
"{.end}\n" {.end}
`
func argsFmt(w io.Writer, x interface{}, format string) { func argsFmt(w io.Writer, x interface{}, format string) {
args := x.([]string); args := x.([]string);