Skip to content

Instantly share code, notes, and snippets.

@davecheney
Created March 4, 2011 00:08
Show Gist options
  • Save davecheney/853886 to your computer and use it in GitHub Desktop.
Save davecheney/853886 to your computer and use it in GitHub Desktop.
A sample top level Makefile for multi package Go projects
# A sample top level Makefile for multi package Go projects.
include $(GOROOT)/src/Make.inc
CMDS=\
command-1\
command-2\
command-3
PKGS=\
package-1\
package-2\
package-3
all: make
make: $(addsuffix .install, $(PKGS)) $(addsuffix .make, $(CMDS))
clean: $(addsuffix .nuke, $(PKGS)) $(addsuffix .clean, $(CMDS))
%.install:
$(MAKE) -C $* install
# compile all packages before any command
%.make: $(addsuffix .install, $(PKGS))
$(MAKE) -C $*
# establish dependancies between packages
package-2.install: package-1.install
package-1.install package-2.install: package-3.install
%.clean:
$(MAKE) -C $* clean
%.nuke:
$(MAKE) -C $* nuke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment