forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request docker#1991 from dmp42/01-carry-on-build-tweaks
Add simpler make targets and fix Windows build
- Loading branch information
Showing
5 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
build-clean: | ||
@rm -Rf $(PREFIX)/bin/* | ||
|
||
extension = $(patsubst windows,.exe,$(filter windows,$(1))) | ||
|
||
# Cross builder helper | ||
define gocross | ||
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build -o $(PREFIX)/bin/$(1)-$(2)/docker-$(patsubst cmd/%.go,%,$3) \ | ||
-a $(VERBOSE_GO) -tags "static_build netgo $(BUILDTAGS)" -installsuffix netgo -ldflags "$(GO_LDFLAGS) \ | ||
-extldflags -static" $(GO_GCFLAGS) $(3); | ||
GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
-o $(PREFIX)/bin/$(1)-$(2)/docker-$(patsubst cmd/%.go,%,$3)$(call extension,$(GOOS)) \ | ||
-a $(VERBOSE_GO) -tags "static_build netgo $(BUILDTAGS)" -installsuffix netgo \ | ||
-ldflags "$(GO_LDFLAGS) -extldflags -static" $(GO_GCFLAGS) $(3); | ||
endef | ||
|
||
# XXX building with -a fails in debug (with -N -l) ???? | ||
$(PREFIX)/bin/docker-%: ./cmd/%.go $(shell find . -type f -name '*.go') | ||
$(GO) build -o $@ $(VERBOSE_GO) -tags "$(BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) $< | ||
|
||
# Native build | ||
build-simple: $(patsubst ./cmd/%.go,$(PREFIX)/bin/docker-%,$(filter-out %_test.go, $(wildcard ./cmd/*.go))) | ||
# Independent targets for every bin | ||
$(PREFIX)/bin/docker-%: ./cmd/%.go $(shell find . -type f -name '*.go') | ||
$(GO) build -o $@$(call extension,$(GOOS)) $(VERBOSE_GO) -tags "$(BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) $< | ||
|
||
# Cross compilation targets | ||
# Cross-compilation targets | ||
build-x-%: ./cmd/%.go $(shell find . -type f -name '*.go') | ||
@$(foreach GOARCH,$(TARGET_ARCH),$(foreach GOOS,$(TARGET_OS),$(call gocross,$(GOOS),$(GOARCH),$<))) | ||
|
||
# Cross-build | ||
# Build just machine | ||
build-machine: $(PREFIX)/bin/docker-machine | ||
|
||
# Build all plugins | ||
build-plugins: $(patsubst ./cmd/%.go,$(PREFIX)/bin/docker-%,$(filter-out %_test.go, $(wildcard ./cmd/machine-driver-*.go))) | ||
|
||
# Overall cross-build | ||
build-x: $(patsubst ./cmd/%.go,build-x-%,$(filter-out %_test.go, $(wildcard ./cmd/*.go))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters