Skip to content

Commit

Permalink
build: wrapping all nimble build targets in make (#442)
Browse files Browse the repository at this point in the history
* build: wrapping all nimble build targets in make

all tasks which have "build" in their description will be automatically
wrapped by make

also passing DEBUG in compose so that make debug does not strip in
docker builds

* build: ignoring memory profile results file [ci skip]
  • Loading branch information
miki725 authored Nov 7, 2024
1 parent 82d36cb commit 4f25327
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ nimutils
con4m
/*.c4m
/ls
profile_results.txt
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
SHELL=bash
BINARY=chalk
CHALK_BUILD?=build
CHALK_BUILD?=release

# if CON4M_DEV exists, pass that to docker-compose
# as docker-compose does not allow conditional env vars
_DOCKER_ARGS=
ifneq "$(shell echo $${CON4M_DEV+missing})" ""
_DOCKER_ARGS=-e CON4M_DEV=true
endif
_DOCKER=docker compose run --rm $(_DOCKER_ARGS) chalk
DOCKER?=$(_DOCKER)

Expand All @@ -26,6 +21,8 @@ SOURCES+=src/docs/CHANGELOG.md
VERSION=$(shell cat src/configs/base_keyspecs.c4m \
| grep -E "chalk_version\s+:=" | cut -d'"' -f2 | head -n1)

BUILDS=$(shell cat *.nimble | grep -E '^task.*build' | cut -d, -f1 | awk '{print $$2}')

# in case nimble bin is not in PATH - e.g. vanilla shell
export PATH:=$(HOME)/.nimble/bin:$(PATH)

Expand All @@ -44,12 +41,10 @@ $(BINARY).bck: $(SOURCES)
cp $@ $(BINARY)
ls -la $(BINARY) $@

.PHONY: debug release
debug: CHALK_BUILD=build --define:debug
debug: DEBUG=true
release: CHALK_BUILD=build
debug release:
$(eval export CHALK_BUILD DEBUG)
$(BUILDS):
$(eval export CHALK_BUILD=$@)
$(eval export DEBUG)
-rm -f $(BINARY) $(BINARY).bck
$(MAKE) $(BINARY)

Expand Down
5 changes: 3 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ services:
- $PWD:$PWD
- $PWD/../nimutils:$PWD/../nimutils
- $PWD/../con4m:$PWD/../con4m
# environment:
# CON4M_DEV is conditionally set in Makefile
environment:
DEBUG: ${DEBUG:-}
CHALK_PASSWORD: ${CHALK_PASSWORD:-}

# --------------------------------------------------------------------------
# SERVER
Expand Down

0 comments on commit 4f25327

Please sign in to comment.