github.com/datadog/cilium@v1.6.12/Makefile.defs (about)

     1  SHELL := /bin/bash
     2  .SHELLFLAGS := -eu -o pipefail -c
     3  
     4  ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
     5  RELATIVE_DIR := $(shell echo $(realpath .) | sed "s;$(ROOT_DIR)[/]*;;")
     6  include $(ROOT_DIR)/Makefile.quiet
     7  
     8  PREFIX?=/usr
     9  BINDIR?=$(PREFIX)/bin
    10  CNIBINDIR?=/opt/cni/bin
    11  CNICONFDIR?=/etc/cni/net.d
    12  LIBDIR?=$(PREFIX)/lib
    13  RUNDIR?=/var/run
    14  CONFDIR?=/etc
    15  
    16  ifeq ($(GO),)
    17  	GO = go
    18  endif
    19  INSTALL = $(QUIET)install
    20  
    21  CGO_DISABLED = CGO_ENABLED=0
    22  VERSION = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION)
    23  VERSION_MAJOR = $(shell cat $(dir $(lastword $(MAKEFILE_LIST)))/VERSION | cut -d. -f1)
    24  # Use git only if in a Git repo
    25  ifneq ($(wildcard $(dir $(lastword $(MAKEFILE_LIST)))/.git),)
    26  	GIT_VERSION = $(shell git show -s --format='format:%h %aI')
    27  else
    28  	GIT_VERSION = $(shell cat $(ROOT_DIR)/GIT_VERSION)
    29  endif
    30  BUILD = $(VERSION) $(GIT_VERSION) $(shell go version)
    31  GOLDFLAGS = -X "github.com/cilium/cilium/pkg/version.Version=$(BUILD)"
    32  
    33  CILIUM_ENVOY_SHA=$(shell grep -o "FROM.*cilium/cilium-envoy:[0-9a-fA-F]*" $(ROOT_DIR)/Dockerfile | cut -d : -f 2)
    34  GOLDFLAGS += -X "github.com/cilium/cilium/pkg/envoy.RequiredEnvoyVersionSHA=$(CILIUM_ENVOY_SHA)"
    35  GOLDFLAGS += -X "github.com/cilium/cilium/pkg/datapath/loader.DatapathSHA=$(GO_BINDATA_SHA1SUM)"
    36  
    37  # Set DOCKER_IMAGE_TAG with "latest" by default
    38  ifeq ($(DOCKER_IMAGE_TAG),)
    39      DOCKER_IMAGE_TAG="latest"
    40  endif
    41  
    42  GOBUILD = -ldflags '$(GOLDFLAGS)' $(EXTRA_GOBUILD_FLAGS)
    43  
    44  # Uncomment to enable race detection
    45  #GOBUILD += -race
    46  
    47  # Uncomment to enable deadlock detection
    48  #GOBUILD += -tags lockdebug
    49  
    50  ifneq ($(LOCKDEBUG),)
    51      GOBUILD += -tags lockdebug
    52  endif
    53  
    54  # Container engine
    55  CONTAINER_ENGINE?=docker
    56  CONTAINER_ENGINE_FULL=$(QUIET)$(CONTAINER_ENGINE)