Skip to content

Commit

Permalink
Build: disable CGO
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Aug 30, 2023
1 parent 518d8a1 commit e3ab4d5
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,11 @@ deps-go:
build: build-frontend build-backend
build-frontend:
yarn build

build-backend:
mage -v build:backend
build-debug:
env GOOS=linux go build -gcflags="all=-N -l" -o ./dist/gpx_zabbix-plugin_linux_amd64 ./pkg

# Build for specific platform
build-backend-windows: extension = .exe
build-backend-%-arm64:
$(eval filename = gpx_zabbix-plugin_$*_arm64$(extension))
env GOOS=$* GOARCH=arm64 go build -o ./dist/$(filename) ./pkg
build-backend-%:
$(eval filename = gpx_zabbix-plugin_$*_amd64$(extension))
env GOOS=$* GOARCH=amd64 go build -o ./dist/$(filename) ./pkg
mage -v build:debug

run-frontend:
yarn install --pure-lockfile
Expand All @@ -42,21 +34,23 @@ dist: dist-frontend dist-backend
dist-frontend:
yarn build

dist-backend: dist-backend-linux dist-backend-darwin dist-backend-freebsd dist-backend-windows dist-arm
dist-backend: dist-backend-mage dist-backend-freebsd dist-arm-freebsd-arm64
dist-backend-mage:
mage -v buildAll
dist-backend-windows: extension = .exe
dist-backend-%:
$(eval filename = gpx_zabbix-plugin_$*_amd64$(extension))
env GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg
env CGO_ENABLED=0 GOOS=$* GOARCH=amd64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg

# ARM
dist-arm: dist-arm-linux-arm-v6 dist-arm-linux-arm64 dist-arm-darwin-arm64 dist-arm-freebsd-arm64
dist-arm-linux-arm-v6:
env GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
dist-arm-linux-arm-v7:
env GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
env CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags="-s -w" -o ./dist/gpx_zabbix-plugin_linux_arm ./pkg
dist-arm-%-arm64:
$(eval filename = gpx_zabbix-plugin_$*_arm64$(extension))
env GOOS=$* GOARCH=arm64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg
env CGO_ENABLED=0 GOOS=$* GOARCH=arm64 go build -ldflags="-s -w" -o ./dist/$(filename) ./pkg

.PHONY: test
test: test-frontend test-backend
Expand Down

0 comments on commit e3ab4d5

Please sign in to comment.