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

Documentation: how to write Makefiles for commands.

Fixes #1282.

R=adg
CC=golang-dev
https://golang.org/cl/3152041
This commit is contained in:
Yves Junqueira 2010-11-23 10:42:04 +11:00 committed by Andrew Gerrand
parent 95c341fc78
commit 52c23f3009

View File

@ -177,6 +177,32 @@ Writing clean, idiomatic Go code is beyond the scope of this document.
that topic.
</p>
<h2 id="Building_programs">Building programs</h2>
<p>To build a Go program with gomake, create a Makefile alongside your program's
source files. It should be similar to the example above, but include
<code>Make.cmd</code> instead of <code>Make.pkg</code>:
<pre>
include $(GOROOT)/src/Make.inc
TARG=helloworld
GOFILES=\
helloworld.go\
include $(GOROOT)/src/Make.cmd
</pre>
<p>Running <code>gomake build</code> will compile <code>helloworld.go</code>
and produce an executable named <code>helloworld</code> in the current
directory.
</p>
<p>
Running <code>gomake install</code> will build <code>helloworld</code> if
necessary and copy it to the <code>$GOBIN</code> directory
(<code>$GOROOT/bin/</code> is the default).
</p>
<h2 id="Testing">Testing</h2>
<p>