aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Junqueira <yves.junqueira@gmail.com>2010-11-23 10:42:04 +1100
committerAndrew Gerrand <adg@golang.org>2010-11-23 10:42:04 +1100
commit52c23f300972fefdb7cbc57eadbc524afeea0cf5 (patch)
treecf8a114b8d0457feb34b1f61e99e8a525914fc02
parent95c341fc78b885b265314a678fa6643522ce37f5 (diff)
downloadgo-52c23f300972fefdb7cbc57eadbc524afeea0cf5.tar.gz
go-52c23f300972fefdb7cbc57eadbc524afeea0cf5.zip
Documentation: how to write Makefiles for commands.
Fixes #1282. R=adg CC=golang-dev https://golang.org/cl/3152041
-rw-r--r--doc/code.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/code.html b/doc/code.html
index 8e72d5ace2..a5783ce740 100644
--- a/doc/code.html
+++ b/doc/code.html
@@ -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>