@@ -62,6 +62,9 @@ CONTAINER_RUN := $(CONTAINER_CMD) "$(IMAGE)"
6262
6363GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
6464
65+ EXTRA_LDFLAGS ?=
66+ LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} $(EXTRA_LDFLAGS ) '
67+
6568MANPAGES_MD = $(wildcard docs/* .md)
6669MANPAGES ?= $(MANPAGES_MD:%.md=% )
6770
8588 @echo
8689 @echo " * 'install' - Install binaries and documents to system locations"
8790 @echo " * 'binary' - Build skopeo with a container"
88- @echo " * 'binary-local ' - Build skopeo locally"
91+ @echo " * 'bin/skopeo ' - Build skopeo locally"
8992 @echo " * 'test-unit' - Execute unit tests"
9093 @echo " * 'test-integration' - Execute integration tests"
9194 @echo " * 'validate' - Verify whether there is no conflict and all Go source files have been formatted, linted and vetted"
@@ -98,19 +101,18 @@ help:
98101binary : cmd/skopeo
99102 ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile.build -t skopeobuildimage .
100103 ${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd ) :/src/github.com/containers/skopeo \
101- skopeobuildimage make binary-local $(if $(DEBUG ) ,DEBUG=$(DEBUG ) ) BUILDTAGS=' $(BUILDTAGS)'
104+ skopeobuildimage make bin/skopeo $(if $(DEBUG ) ,DEBUG=$(DEBUG ) ) BUILDTAGS=' $(BUILDTAGS)'
102105
103- binary-static : cmd/skopeo
104- ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -f Dockerfile.build -t skopeobuildimage .
105- ${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd ) :/src/github.com/containers/skopeo \
106- skopeobuildimage make binary-local-static $(if $(DEBUG ) ,DEBUG=$(DEBUG ) ) BUILDTAGS=' $(BUILDTAGS)'
106+ # Update nix/nixpkgs.json its latest master commit
107+ .PHONY : nixpkgs
108+ nixpkgs :
109+ @nix run -f channel:nixpkgs-unstable nix-prefetch-git -c nix-prefetch-git \
110+ --no-deepClone https://github.com/nixos/nixpkgs > nix/nixpkgs.json
107111
108112# Build w/o using containers
109- binary-local :
110- $(GPGME_ENV ) $(GO ) build $(MOD_VENDOR ) ${GO_DYN_FLAGS} -ldflags " -X main.gitCommit=${GIT_COMMIT} " -gcflags " $( GOGCFLAGS) " -tags " $( BUILDTAGS) " -o skopeo ./cmd/skopeo
111-
112- binary-local-static :
113- $(GPGME_ENV ) $(GO ) build $(MOD_VENDOR ) -ldflags " -extldflags \" -static\" -X main.gitCommit=${GIT_COMMIT} " -gcflags " $( GOGCFLAGS) " -tags " $( BUILDTAGS) " -o skopeo ./cmd/skopeo
113+ .PHONY : bin/skopeo
114+ bin/skopeo :
115+ $(GPGME_ENV ) $(GO ) build $(MOD_VENDOR ) ${GO_DYN_FLAGS} ${LDFLAGS} -gcflags " $( GOGCFLAGS) " -tags " $( BUILDTAGS) " -o $@ ./cmd/skopeo
114116
115117build-container :
116118 ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -t " $( IMAGE) " .
0 commit comments