Skip to content

Commit 35ff801

Browse files
committed
make build should build if any go file is touched
Signed-off-by: David Gageot <david@gageot.net>
1 parent 72d2fb6 commit 35ff801

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

mk/build.mk

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
extension = $(patsubst windows,.exe,$(filter windows,$(1)))
22

33
define gocross
4-
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \
5-
-o $(PREFIX)/bin/docker-$(patsubst cmd/%.go,%,$3)_$(1)-$(2)$(call extension,$(GOOS)) \
4+
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 \
5+
$(GO) build \
6+
-o $(PREFIX)/bin/docker-machine_$(1)-$(2)$(call extension,$(GOOS)) \
67
-a $(VERBOSE_GO) -tags "static_build netgo $(BUILDTAGS)" -installsuffix netgo \
7-
-ldflags "$(GO_LDFLAGS) -extldflags -static" $(GO_GCFLAGS) $(3);
8+
-ldflags "$(GO_LDFLAGS) -extldflags -static" $(GO_GCFLAGS) ./cmd/machine.go;
89
endef
910

1011
build-clean:
1112
rm -Rf $(PREFIX)/bin/*
1213

13-
build-x: ./cmd/machine.go
14-
$(foreach GOARCH,$(TARGET_ARCH),$(foreach GOOS,$(TARGET_OS),$(call gocross,$(GOOS),$(GOARCH),$<)))
14+
build-x: $(shell find . -type f -name '*.go')
15+
$(foreach GOARCH,$(TARGET_ARCH),$(foreach GOOS,$(TARGET_OS),$(call gocross,$(GOOS),$(GOARCH))))
1516

16-
$(PREFIX)/bin/docker-machine$(call extension,$(GOOS)): ./cmd/machine.go
17+
$(PREFIX)/bin/docker-machine$(call extension,$(GOOS)): $(shell find . -type f -name '*.go')
1718
$(GO) build \
1819
-o $@ \
1920
$(VERBOSE_GO) -tags "$(BUILDTAGS)" \
20-
-ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) $<
21+
-ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) ./cmd/machine.go
2122

22-
build: $(PREFIX)/bin/docker-machine
23+
build: $(PREFIX)/bin/docker-machine$(call extension,$(GOOS))

0 commit comments

Comments
 (0)