SUBDIRS := client core server SRCS := $(wildcard *.go $(foreach fd, $(SUBDIRS), $(fd)/*.go)) TARGETS := overpush overpushd all: proto $(TARGETS) go build ./... .PHONY: overpushd overpushd: $(SRCS) cmd/overpushd/main.go go build ./cmd/overpushd .PHONY: overpush overpush: $(SRCS) cmd/overpush/main.go go build ./cmd/overpush .PHONY: proto proto: ( cd proto && make ) print-%: ; @echo '$(subst ','\'',$*=$($*))'