diff --git a/Makefile b/Makefile index 8c2bfa9ae94c..09d8da8962d8 100644 --- a/Makefile +++ b/Makefile @@ -338,6 +338,12 @@ otelcontribcol: cd ./cmd/otelcontribcol && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/otelcontribcol_$(GOOS)_$(GOARCH)$(EXTENSION) \ -tags $(GO_BUILD_TAGS) . +# Build the Collector executable without the symbol table, debug information, and the DWARF symbol table. +.PHONY: otelcontribcollite +otelcontribcollite: + cd ./cmd/otelcontribcol && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/otelcontribcol_$(GOOS)_$(GOARCH)$(EXTENSION) \ + -tags $(GO_BUILD_TAGS) -ldflags $(GO_BUILD_LDFLAGS) . + .PHONY: genoteltestbedcol genoteltestbedcol: $(BUILDER) $(BUILDER) --skip-compilation --config cmd/oteltestbedcol/builder-config.yaml --output-path cmd/oteltestbedcol @@ -349,12 +355,22 @@ oteltestbedcol: cd ./cmd/oteltestbedcol && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/oteltestbedcol_$(GOOS)_$(GOARCH)$(EXTENSION) \ -tags $(GO_BUILD_TAGS) . +.PHONY: oteltestbedcollite +oteltestbedcollite: + cd ./cmd/oteltestbedcol && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/oteltestbedcol_$(GOOS)_$(GOARCH)$(EXTENSION) \ + -tags $(GO_BUILD_TAGS) -ldflags $(GO_BUILD_LDFLAGS) . + # Build the telemetrygen executable. .PHONY: telemetrygen telemetrygen: cd ./cmd/telemetrygen && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/telemetrygen_$(GOOS)_$(GOARCH)$(EXTENSION) \ -tags $(GO_BUILD_TAGS) . +.PHONY: telemetrygenlite +telemetrygenlite: + cd ./cmd/telemetrygen && GO111MODULE=on CGO_ENABLED=0 $(GOCMD) build -trimpath -o ../../bin/telemetrygen_$(GOOS)_$(GOARCH)$(EXTENSION) \ + -tags $(GO_BUILD_TAGS) -ldflags $(GO_BUILD_LDFLAGS) . + # helper function to update the core packages in builder-config.yaml # input parameters are # $(1) = path/to/versions.yaml (where it greps the relevant packages) diff --git a/Makefile.Common b/Makefile.Common index 53584bf57e14..e2eee6f55e72 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -25,6 +25,8 @@ SRC_PARENT_DIR := $(shell dirname $(SRC_ROOT)) # build tags required by any component should be defined as an independent variables and later added to GO_BUILD_TAGS below GO_BUILD_TAGS="" +# These ldflags allow the build tool to omit the symbol table, debug information, and the DWARF symbol table to downscale binary size. +GO_BUILD_LDFLAGS="-s -w" GOTEST_TIMEOUT?= 600s GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT) -parallel 4 --tags=$(GO_BUILD_TAGS) GOTEST_INTEGRATION_OPT?= -race -timeout 360s -parallel 4