Skip to content
Snippets Groups Projects
Select Git revision
  • db5cd9e41ec6f65ad0fa8c0e31c0d50770b13b7c
  • master default protected
  • L2SS-1957-remove-pcon-control
  • control-single-hba-and-lba
  • stabilise-landing-page
  • all-stations-lofar2
  • L2SS-2357-fix-ruff
  • v0.39.7-backports
  • Move-sdptr-to-v1.5.0
  • fix-build-ubuntu
  • tokens-in-env-files
  • fix-build
  • L2SS-2214-deploy-cdb
  • fix-missing-init
  • add-power-hardware-apply
  • L2SS-2129-Add-Subrack-Routine
  • Also-listen-internal-to-rpc
  • fix-build-dind
  • L2SS-2153--Improve-Error-Handling
  • L2SS-2153-Add-Grpc-Gateway-support
  • L2SS-1970-apsct-lol
  • v0.52.2-rc3 protected
  • v0.52.2-rc2 protected
  • v0.52.2-rc1 protected
  • v0.52.1.1 protected
  • v0.52.1 protected
  • v0.52.1-rc1 protected
  • v0.51.9-6 protected
  • v0.51.9-5 protected
  • v0.51.9-4 protected
  • v0.51.9-3 protected
  • v0.51.9-2 protected
  • v0.51.9-1 protected
  • v0.51.9 protected
  • v0.51.8 protected
  • v0.39.15-wsrttwo protected
  • v0.39.15-wsrt protected
  • v0.39.14-wsrt protected
  • v0.51.6 protected
  • v0.51.5-1 protected
  • v0.51.5 protected
41 results

Makefile

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Makefile 7.90 KiB
    # Set dir of Makefile to a variable to use later
    MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
    BASEDIR := $(notdir $(patsubst %/,%,$(dir $(MAKEPATH))))
    
    DOCKER_COMPOSE_ENV_FILE := $(abspath .env)
    COMPOSE_FILES := $(wildcard *.yml)
    COMPOSE_FILE_ARGS := --env-file $(DOCKER_COMPOSE_ENV_FILE) $(foreach yml,$(COMPOSE_FILES),-f $(yml))
    
    ATTACH_COMPOSE_FILE_ARGS := $(foreach yml,$(filter-out tango.yml,$(COMPOSE_FILES)),-f $(yml))
    
    # The default Docker network mode is tangonet.  The "host" network
    # mode will make the tangodb and archiverdb ports clash,
    # But we allow to overwrite it.
    NETWORK_MODE ?= tangonet
    
    # Host name through which others can reach our control interfaces.
    # Needs to be resolvable from the containers and clients.
    ifneq (,$(wildcard /run/WSL))
        # Microsoft Windows Subsystem for Linux
        HOSTNAME ?= host.docker.internal
    else
        HOSTNAME ?= $(shell hostname -f)
    endif
    
    # Host name to which to send our container logs. Needs to be resolvable from
    # the host.
    LOG_HOSTNAME ?= localhost
    
    # If the first make argument is "start" or "stop"...
    ifeq (start,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
    else ifeq (stop,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
    else ifeq (restart,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
    else ifeq (build,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
    else ifeq (build-nocache,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
    else ifeq (attach,$(firstword $(MAKECMDGOALS)))
        SERVICE_TARGET = true
        ifndef NETWORK_MODE
            $(error NETWORK_MODE must specify the network to attach to, e.g., make NETWORK_MODE=tangonet-powersupply ...)
        endif
    
        ifndef TANGO_HOST
            $(error TANGO_HOST must specify the Tango database device, e.g., make TANGO_HOST=powersupply-databaseds:10000 ...)
        endif
    endif
    
    ifdef SERVICE_TARGET
        # .. then use the rest as arguments for the make target
        SERVICE := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
        # ...and turn them into do-nothing targets
        $(eval $(SERVICE):;@:)
    endif
    
    #
    # Never use the network=host mode when running CI jobs, and add extra
    # distinguishing identifiers to the network name and container names to
    # prevent collisions with jobs from the same project running at the same
    # time.
    #
    ifneq ($(CI_JOB_ID),)
        NETWORK_MODE := tangonet-$(CI_JOB_ID)
        CONTAINER_NAME_PREFIX := $(CI_JOB_ID)-
    else
        CONTAINER_NAME_PREFIX :=
        $(info Network mode cannot be host for the archiver! It won't work unless you set the env var CI_JOB_ID=local)
    endif