Skip to content

Commit

Permalink
Makefile: fix static compilation
Browse files Browse the repository at this point in the history
The old setup didn't actually statically compile umoci, so we have to
add CGO_ENABLED=0 in order to make the damn thing static. Also,
installing dependencies is a bad idea.

Signed-off-by: Aleksa Sarai <asarai@suse.com>
  • Loading branch information
cyphar committed Dec 19, 2016
1 parent 1cce27c commit d14a08c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO

GO_SRC = $(shell find . -name \*.go)
umoci: $(GO_SRC)
$(GO) build -i -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o $@ $(PROJECT)/cmd/umoci
$(GO) build -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o $@ $(PROJECT)/cmd/umoci

umoci.static: $(GO_SRC)
$(GO) build -i -ldflags "-extldflags '-static' -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o $@ $(PROJECT)/cmd/umoci
CGO_ENABLED=0 $(GO) build -ldflags "-extldflags '-static' -X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -tags "$(BUILDTAGS)" -o $@ $(PROJECT)/cmd/umoci

.PHONY: update-deps
update-deps:
Expand All @@ -43,7 +43,8 @@ update-deps:

.PHONY: clean
clean:
rm -f umoci
rm -f umoci umoci.static
rm -f $(MANPAGES)

validate: umociimage
docker run --rm -it -v $(PWD):/go/src/$(PROJECT) $(UMOCI_IMAGE) make local-validate
Expand Down

0 comments on commit d14a08c

Please sign in to comment.