Commit 52c23f30 authored by Yves Junqueira's avatar Yves Junqueira Committed by Andrew Gerrand

Documentation: how to write Makefiles for commands.

Fixes #1282.

R=adg
CC=golang-dev
https://golang.org/cl/3152041
parent 95c341fc
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment