Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix top_builddir & other Make Variables #17

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions build-aux/vars/go_vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,21 @@ TEST_DEPENDENCIES ?= $(shell find . -type f -name '*.go') $(MOCK_DIRS) | $(build
GO_DEPENDENCIES ?= go.sum

TEST_TIMEOUT ?= 30s

## Explicitly export GoLang vars down to go commands
# General-purpose variables
export GO111MODULE GCCGO GOARCH GOBIN GOCACHE GOMODCACHE GODEBUG GOENV GOFLAGS \
GOINSECURE GOOS GOPATH GOPROXY GOPRIVATE GONOPROXY GONOSUMDB GOROOT \
GOSUMDB GOTMPDIR GOVCS GOWORK
# Cgo variables
export AR CC CGO_ENABLED CGO_CFLAGS CGO_CFLAGS_ALLOW CGO_CFLAGS_DISALLOW \
CGO_CPPFLAGS CGO_CPPFLAGS_ALLOW CGO_CPPFLAGS_DISALLOW CGO_CXXFLAGS \
CGO_CXXFLAGS_ALLOW CGO_CXXFLAGS_DISALLOW CGO_FFLAGS CGO_FFLAGS_ALLOW \
CGO_FFLAGS_DISALLOW CGO_LDFLAGS CGO_LDFLAGS_ALLOW CGO_LDFLAGS_DISALLOW \
CXX FC PKG_CONFIG
# Architecture-specific variables
export GOARM GO386 GOAMD64 GOMIPS GOMIPS64 GOPPC64 GOWASM

# Special-purpose variables
export GCCGOTOOLDIR GOEXPERIMENT GOROOT_FINAL GO_EXTLINK_ENABLED \
GIT_ALLOW_PROTOCOL
6 changes: 4 additions & 2 deletions build-aux/vars/main_vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ IMAGE ?= $(REGISTRY)/$(REPO_NAME)
GIT_COMMIT = $(shell git rev-parse HEAD)
IMAGE_TAG ?= :$(shell echo $(GIT_COMMIT) | cut -c1-12 | tr -d '\n \t')
# TODO: Update this image & migrate build from TravisCI to GitHub Actions
BUILD_IMAGE ?= $(REGISTRY)/trinitronx/build-tools:alpine-3.6-b78ed5e # Build tools image for container-build target
# Build tools image for container-build target
BUILD_IMAGE ?= $(REGISTRY)/trinitronx/build-tools:alpine-3.6-b78ed5e

DOCKER_CONFIG ?= $(build_stamps_dir)/docker
# Delete old docker config tout de suite. (modification time > 720 min expiry)
Expand All @@ -39,7 +40,8 @@ DOCKER_FLAGS ?=
CONTAINER_NAME ?= $(REPO_NAME)-$(DEPLOY_TAG)
CONTAINER_SOURCE_PATH ?= /opt/app
UNIQUE_DEPLOY_TAG ?= $(shell TZ=UTC date +'%Y%m%dT%H%M%S')-$(shell git rev-parse --short HEAD)
PUSH_LATEST ?= true # Tag Docker image with :latest if variable is 'true'. Default: true
# Tag Docker image with :latest if variable is 'true'. Default: true
PUSH_LATEST ?= true
CONTAINER_SOURCE_FLAGS ?= -v $(CURDIR)/:$(CONTAINER_SOURCE_PATH) -w $(CONTAINER_SOURCE_PATH)

# Commands to run before `container-%` target recipes run (executes inside the container).
Expand Down
5 changes: 3 additions & 2 deletions main.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_dir := $(notdir $(patsubst %/,%,$(dir $(realpath $(mkfile_path)/../))))
# Autoconf-style vars
top_builddir := $(basename $(patsubst %/,%,$(dir $(mkfile_path))))
top_srcdir ?= $(top_builddir)/src # Override this if your project differs
top_builddir := $(patsubst %/,%,$(basename $(patsubst %/,%,$(dir $(mkfile_path)))))
# Override this if your project differs
top_srcdir ?= $(top_builddir)
build_aux := $(top_builddir)/.uncommon-build/build-aux

# Include platform detection & main vars
Expand Down