mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-23 21:46:18 +00:00
Use OS specific build directories (#600)
* feat: use os specific build directories * fix typo
This commit is contained in:
parent
b539820c88
commit
ad33296d98
23
Makefile
23
Makefile
@ -3,7 +3,18 @@
|
|||||||
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
||||||
COMMIT := $(shell git log -1 --format='%H')
|
COMMIT := $(shell git log -1 --format='%H')
|
||||||
LEDGER_ENABLED ?= true
|
LEDGER_ENABLED ?= true
|
||||||
|
ifeq ($(DETECTED_OS),)
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
DETECTED_OS := windows
|
||||||
|
else
|
||||||
|
UNAME_S = $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
DETECTED_OS := mac
|
||||||
|
else
|
||||||
|
DETECTED_OS := linux
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
export GO111MODULE = on
|
export GO111MODULE = on
|
||||||
|
|
||||||
# process build tags
|
# process build tags
|
||||||
@ -65,15 +76,15 @@ all: install
|
|||||||
|
|
||||||
build: go.sum
|
build: go.sum
|
||||||
ifeq ($(OS), Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/kvd.exe ./cmd/kvd
|
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvd.exe ./cmd/kvd
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/kvcli.exe ./cmd/kvcli
|
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvcli.exe ./cmd/kvcli
|
||||||
else
|
else
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/kvd ./cmd/kvd
|
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvd ./cmd/kvd
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/kvcli ./cmd/kvcli
|
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvcli ./cmd/kvcli
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build-linux: go.sum
|
build-linux: go.sum
|
||||||
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build
|
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 DETECTED_OS=linux $(MAKE) build
|
||||||
|
|
||||||
install: go.sum
|
install: go.sum
|
||||||
go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd
|
go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd
|
||||||
|
@ -10,7 +10,7 @@ services:
|
|||||||
- ID=0
|
- ID=0
|
||||||
- LOG=${LOG:-kvd.log}
|
- LOG=${LOG:-kvd.log}
|
||||||
volumes:
|
volumes:
|
||||||
- ./build:/kvd:Z
|
- ./build/linux:/kvd:Z
|
||||||
networks:
|
networks:
|
||||||
localnet:
|
localnet:
|
||||||
ipv4_address: 192.168.10.2
|
ipv4_address: 192.168.10.2
|
||||||
@ -24,7 +24,7 @@ services:
|
|||||||
- ID=1
|
- ID=1
|
||||||
- LOG=${LOG:-kvd.log}
|
- LOG=${LOG:-kvd.log}
|
||||||
volumes:
|
volumes:
|
||||||
- ./build:/kvd:Z
|
- ./build/linux:/kvd:Z
|
||||||
networks:
|
networks:
|
||||||
localnet:
|
localnet:
|
||||||
ipv4_address: 192.168.10.3
|
ipv4_address: 192.168.10.3
|
||||||
@ -38,7 +38,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "26661-26662:26656-26657"
|
- "26661-26662:26656-26657"
|
||||||
volumes:
|
volumes:
|
||||||
- ./build:/kvd:Z
|
- ./build/linux:/kvd:Z
|
||||||
networks:
|
networks:
|
||||||
localnet:
|
localnet:
|
||||||
ipv4_address: 192.168.10.4
|
ipv4_address: 192.168.10.4
|
||||||
@ -52,7 +52,7 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "26663-26664:26656-26657"
|
- "26663-26664:26656-26657"
|
||||||
volumes:
|
volumes:
|
||||||
- ./build:/kvd:Z
|
- ./build/linux:/kvd:Z
|
||||||
networks:
|
networks:
|
||||||
localnet:
|
localnet:
|
||||||
ipv4_address: 192.168.10.5
|
ipv4_address: 192.168.10.5
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
BINARY=/kvd/${BINARY:-kvd}
|
BINARY=/kvd/linux/${BINARY:-kvd}
|
||||||
|
echo "binary: ${BINARY}"
|
||||||
ID=${ID:-0}
|
ID=${ID:-0}
|
||||||
LOG=${LOG:-kvd.log}
|
LOG=${LOG:-kvd.log}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user