mobileinsight-apptainer/Makefile

31 lines
801 B
Makefile

APPTAINER ?= singularity
OVERLAY_DIR ?= ./overlay
NUM_THREADS ?= $(shell grep -c processor /proc/cpuinfo)
UID := $(shell id -u)
.DEFAULT_GOAL := mobileinsight.sif
mobileinsight.sif: mobileinsight.def
"$(APPTAINER)" build --build-arg="NUM_THREADS=$(NUM_THREADS)" "$@" "$<"
mobileinsight-spark.sif: with-spark.def mobileinsight.sif
"$(APPTAINER)" build "$@" "$<"
prepare:
@mkdir -p "$(OVERLAY_DIR)"
@lsmod | grep overlay > /dev/null || sudo modprobe overlay
run: mobileinsight.sif prepare
@$(APPTAINER) run --overlay "$(OVERLAY_DIR)" \
-B "/run/user/$(UID)" mobileinsight.sif
run-spark: mobileinsight-spark.sif prepare
@$(APPTAINER) run --overlay "$(OVERLAY_DIR)" \
-B "/run/user/$(UID)" mobileinsight-spark.sif
clean:
rm -rf *.sif $(OVERLAY_DIR)
.PHONY: prepare run run-spark clean