A sample Makefile to build multi package Go projects
- Edit
- Delete
- Tags
- Autopost
Notes
- For packages (those including
$(GOROOT)/src/make.pkg
) they must be called with theinstall
target so they resulting .a is copied into the Go distribution root, so it is visible to the linker when building other packages. - For commands (those including
$(GOROOT)/src/make.cmd
) calling theinstall
target will copy the resulting binary command into the$GOROOT/bin
directory, which may not be what you want. - The top level
clean
target calls the nuke target in all packages (see note 1) to ensure that the linker will not see stale versions of the compiled package. Simply calling theclean
target in a package will not remove the version that is visible to the linker.