From: Yves Junqueira
Date: Mon, 22 Nov 2010 23:42:04 +0000 (+1100)
Subject: Documentation: how to write Makefiles for commands.
X-Git-Tag: weekly.2010-11-23~2
X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=52c23f300972fefdb7cbc57eadbc524afeea0cf5;p=gostls13.git
Documentation: how to write Makefiles for commands.
Fixes #1282.
R=adg
CC=golang-dev
https://golang.org/cl/3152041
---
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.
+Building programs
+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
+Make.cmd
instead of Make.pkg
:
+
+
+include $(GOROOT)/src/Make.inc
+
+TARG=helloworld
+GOFILES=\
+ helloworld.go\
+
+include $(GOROOT)/src/Make.cmd
+
+
+Running gomake build
will compile helloworld.go
+and produce an executable named helloworld
in the current
+directory.
+
+
+
+Running gomake install
will build helloworld
if
+necessary and copy it to the $GOBIN
directory
+($GOROOT/bin/
is the default).
+
+
Testing