remove release-dirs make target (#10350)

- only `mkdir`the dist dirs when they are absent
- add the dist dirs as prereqs so targets like `make release-sources`
  can run standalone

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
This commit is contained in:
silverwind 2020-02-19 04:10:25 +01:00 committed by GitHub
parent dc822d5291
commit 17445bbbfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
DIST := dist DIST := dist
DIST_DIRS := $(DIST)/binaries $(DIST)/release
IMPORT := code.gitea.io/gitea IMPORT := code.gitea.io/gitea
export GO111MODULE=off export GO111MODULE=off
@ -446,14 +447,13 @@ $(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@ GO111MODULE=on $(GO) build -mod=vendor $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
.PHONY: release .PHONY: release
release: generate release-dirs release-windows release-linux release-darwin release-copy release-compress release-sources release-check release: generate release-windows release-linux release-darwin release-copy release-compress release-sources release-check
.PHONY: release-dirs $(DIST_DIRS):
release-dirs: mkdir -p $(DIST_DIRS)
mkdir -p $(DIST)/binaries $(DIST)/release
.PHONY: release-windows .PHONY: release-windows
release-windows: release-windows: | $(DIST_DIRS)
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u src.techknowlogick.com/xgo; \ $(GO) get -u src.techknowlogick.com/xgo; \
fi fi
@ -463,7 +463,7 @@ ifeq ($(CI),drone)
endif endif
.PHONY: release-linux .PHONY: release-linux
release-linux: release-linux: | $(DIST_DIRS)
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u src.techknowlogick.com/xgo; \ $(GO) get -u src.techknowlogick.com/xgo; \
fi fi
@ -473,7 +473,7 @@ ifeq ($(CI),drone)
endif endif
.PHONY: release-darwin .PHONY: release-darwin
release-darwin: release-darwin: | $(DIST_DIRS)
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u src.techknowlogick.com/xgo; \ $(GO) get -u src.techknowlogick.com/xgo; \
fi fi
@ -483,22 +483,22 @@ ifeq ($(CI),drone)
endif endif
.PHONY: release-copy .PHONY: release-copy
release-copy: release-copy: | $(DIST_DIRS)
cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done; cd $(DIST); for file in `find /build -type f -name "*"`; do cp $${file} ./release/; done;
.PHONY: release-check .PHONY: release-check
release-check: release-check: | $(DIST_DIRS)
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done; cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "checksumming $${file}" && $(SHASUM) `echo $${file} | sed 's/^..//'` > $${file}.sha256; done;
.PHONY: release-compress .PHONY: release-compress
release-compress: release-compress: | $(DIST_DIRS)
@hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash gxz > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/ulikunitz/xz/cmd/gxz; \ $(GO) get -u github.com/ulikunitz/xz/cmd/gxz; \
fi fi
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done; cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done;
.PHONY: release-sources .PHONY: release-sources
release-sources: release-sources: | $(DIST_DIRS)
tar cvzf $(DIST)/release/gitea-src-$(VERSION).tar.gz --exclude $(DIST) --exclude .git --exclude $(MAKE_EVIDENCE_DIR) . tar cvzf $(DIST)/release/gitea-src-$(VERSION).tar.gz --exclude $(DIST) --exclude .git --exclude $(MAKE_EVIDENCE_DIR) .
node_modules: package-lock.json node_modules: package-lock.json