Skip to content

Instantly share code, notes, and snippets.

@robbles
robbles / Makefile
Created December 22, 2015 01:54
Simple Makefile example for reference
# Find all files matching "src/*.go" and replace "src/%.go" with "bin/%"
OUTPUTS := $(patsubst src/%.go,bin/%,$(wildcard src/*.go))
# Reference all files to be built in a single rule
all: $(OUTPUTS)
# Rule for compiling a single output file in bin/
bin/%: src/%.go
# $* is replaced with the value of the wildcard in the rule (%)
go build -o bin/$* src/$*.go