Skip to content
Snippets Groups Projects
Makefile 2.25 KiB
-include build/base.Makefile
-include build/docker.Makefile
-include build/audio.Makefile


help::
	@echo "$(APP_NAME) targets:"
	@echo "    init.app        	- init application environment"
	@echo "    init.dev        	- init development environment"
	@echo "    lint            	- verify code style"
	@echo "    spell           	- check spelling of text"
	@echo "    test            	- run test suite"
	@echo "    log             	- tail log file"
	@echo "    tns             	- connect to telnet server"
	@echo "    run             	- start app"
	@echo "    run.debug       	- start app in debug mode"
	@echo "    docker.init     	- create docker volume for engine socket"
	$(call docker_help)
	$(call audio_help)


# Settings

AURA_ENGINE_CORE_SOCKET := "aura_engine_socket"
AURA_ENGINE_CORE_CONFIG := ${CURDIR}/config/engine-core.docker.ini
AURA_AUDIO_STORE_SOURCE := ${CURDIR}/audio/source
AURA_AUDIO_STORE_PLAYLIST := ${CURDIR}/audio/playlist
AURA_AUDIO_STORE_FALLBACK := ${CURDIR}/audio/fallback
AURA_LOGS := ${CURDIR}/logs
TIMEZONE := "Europe/Vienna"

DOCKER_RUN = @docker run \
		--name $(APP_NAME) \
		--network="host" \
		--mount type=tmpfs,destination=/tmp \
		--device /dev/snd \
		--group-add audio \
		-e TZ=$(TIMEZONE) \
		-v "$(AURA_ENGINE_CORE_SOCKET)":"/srv/socket" \
		-v "$(AURA_ENGINE_CORE_CONFIG)":"/etc/aura/engine-core.ini":ro \
		-v "$(AURA_AUDIO_STORE_SOURCE)":"/var/audio/source":ro \
		-v "$(AURA_AUDIO_STORE_PLAYLIST)":"/var/audio/playlist":ro \
		-v "$(AURA_AUDIO_STORE_FALLBACK)":"/var/audio/fallback":ro \
		-p 1234:1234 \
		-u $(UID):$(GID) \
		$(DOCKER_ENTRY_POINT) \
		autoradio/$(APP_NAME)

# Targets

lint::
	liquidsoap --check src/engine.liq

spell::
	codespell $(wildcard *.md) docs src tests config contrib

init.app::
	cp config/sample.engine-core.ini engine-core.ini
	mkdir -p audio/fallback
	mkdir -p audio/playlist
	mkdir -p audio/source

init.dev:: init.app
	sudo apt install -y codespell

test::
	(cd tests && liquidsoap engine_test_suite.liq)

log::
	tail -f logs/$(APP_NAME).log

tns::
	telnet 0.0.0.0 1234

run::
	(cd src && liquidsoap ./engine.liq)

run.debug::
	(cd src && liquidsoap --verbose --debug ./engine.liq)

docker.init::
	@echo "Creating Docker Volume for Engine Socket at '$(AURA_ENGINE_CORE_SOCKET)'"
	docker volume create aura_engine_socket