Skip to content

Commit 6c1c2cc

Browse files
author
Alessio Treglia
authored
Makefile: simplify and clean-up (#7453)
The simd target is removed in favor of build/install targets: - build runs go build ./... with all appropriate flags and args. - install runs go install ./... with all approriate flags and args. localnet-start now depends on build-linux [1]. [1] This should hopefully put a smile on @alexanderbez's face! Remove unused install scripts and snapcraft build files.
1 parent cdf9bd2 commit 6c1c2cc

8 files changed

+18
-238
lines changed

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ WORKDIR /go/src/github.com/cosmos/cosmos-sdk
2323
COPY . .
2424

2525
# install simapp, remove packages
26-
RUN make simd-linux
26+
RUN make build-linux
2727

2828

2929
# Final image

Makefile

+16-26
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,17 @@ include contrib/devtools/Makefile
9797
### Build ###
9898
###############################################################################
9999

100-
build: go.sum
101-
go build -mod=readonly ./...
100+
BUILD_TARGETS := build install
102101

103-
simd:
104-
mkdir -p $(BUILDDIR)
105-
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR) ./simapp/simd
102+
build: BUILD_ARGS=-o $(BUILDDIR)/
103+
build-linux:
104+
GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false $(MAKE) build
106105

107-
simd-linux: go.sum
108-
$(MAKE) simd GOOS=linux GOARCH=amd64 LEDGER_ENABLED=false
106+
$(BUILD_TARGETS): go.sum $(BUILDDIR)/
107+
go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
108+
109+
$(BUILDDIR)/:
110+
mkdir -p $(BUILDDIR)/
109111

110112
build-simd-all: go.sum
111113
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/rbuilder 2>/dev/null),$(info found image cosmossdk/rbuilder),docker pull cosmossdk/rbuilder:latest)
@@ -119,7 +121,7 @@ build-simd-all: go.sum
119121
--name latest-build cosmossdk/rbuilder:latest
120122
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
121123

122-
build-simd-linux: go.sum
124+
build-simd-linux: go.sum $(BUILDDIR)/
123125
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/rbuilder 2>/dev/null),$(info found image cosmossdk/rbuilder),docker pull cosmossdk/rbuilder:latest)
124126
docker rm latest-build || true
125127
docker run --volume=$(CURDIR):/sources:ro \
@@ -130,13 +132,12 @@ build-simd-linux: go.sum
130132
--env LEDGER_ENABLED=false \
131133
--name latest-build cosmossdk/rbuilder:latest
132134
docker cp -a latest-build:/home/builder/artifacts/ $(CURDIR)/
133-
mkdir -p $(BUILDDIR)
134135
cp artifacts/simd-*-linux-amd64 $(BUILDDIR)/simd
135136

136137
cosmovisor:
137138
$(MAKE) -C cosmovisor cosmovisor
138139

139-
.PHONY: build simd simd-linux build-simd-all build-simd-linux cosmovisor
140+
.PHONY: build build-linux build-simd-all build-simd-linux cosmovisor
140141

141142
mocks: $(MOCKS_DIR)
142143
mockgen -source=client/account_retriever.go -package mocks -destination tests/mocks/account_retriever.go
@@ -152,13 +153,7 @@ mocks: $(MOCKS_DIR)
152153
$(MOCKS_DIR):
153154
mkdir -p $(MOCKS_DIR)
154155

155-
distclean: clean
156-
rm -rf \
157-
gitian-build-darwin/ \
158-
gitian-build-linux/ \
159-
gitian-build-windows/ \
160-
.gitian-builder-cache/
161-
156+
distclean: clean tools-clean
162157
clean:
163158
rm -rf \
164159
$(BUILDDIR)/ \
@@ -171,15 +166,10 @@ clean:
171166
### Tools & Dependencies ###
172167
###############################################################################
173168

174-
go-mod-cache: go.sum
175-
@echo "--> Download go modules to local cache"
176-
@go mod download
177-
.PHONY: go-mod-cache
178-
179169
go.sum: go.mod
180-
@echo "--> Ensure dependencies have not been modified"
181-
@go mod verify
182-
@go mod tidy
170+
echo "Ensure dependencies have not been modified ..." >&2
171+
go mod verify
172+
go mod tidy
183173

184174
###############################################################################
185175
### Documentation ###
@@ -459,7 +449,7 @@ proto-update-deps:
459449
###############################################################################
460450

461451
# Run a 4-node testnet locally
462-
localnet-start: $(BUILDDIR)/simd localnet-stop
452+
localnet-start: build-linux localnet-stop
463453
$(if $(shell docker inspect -f '{{ .Id }}' cosmossdk/simd-env 2>/dev/null),$(info found image cosmossdk/simd-env),$(MAKE) -C contrib/images simd-env)
464454
if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm \
465455
--user $(shell id -u):$(shell id -g) \

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for os in ${TARGET_OS} ; do
2424
for arch in ${archs} ; do
2525
make clean
2626
GOOS="${os}" GOARCH="${arch}" GOROOT_FINAL="$(go env GOROOT)" \
27-
make ${APP} \
27+
make build \
2828
LDFLAGS=-buildid=${VERSION} \
2929
VERSION=${VERSION} \
3030
COMMIT=${COMMIT} \

scripts/install/install_sdk_arm.sh

-37
This file was deleted.

scripts/install/install_sdk_bsd.sh

-52
This file was deleted.

scripts/install/install_sdk_ubuntu.sh

-40
This file was deleted.

snapcraft.yaml

-46
This file was deleted.

snapcraft.yaml.in

-35
This file was deleted.

0 commit comments

Comments
 (0)