-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
32 lines (26 loc) · 979 Bytes
/
Makefile
File metadata and controls
32 lines (26 loc) · 979 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
.PHONY: build test install
# User package list (default location)
USER_PKGS_FILE ?= $(HOME)/.prisoncode/packages.txt
USER_PKGS := $(shell grep -v '^\#' $(USER_PKGS_FILE) 2>/dev/null)
# Compute SHA‑256 hash of the packages file (empty string if missing)
PKGS_HASH := $(shell if [ -f $(HOME)/.prisoncode/packages.txt ]; then \
shasum -a 256 $(HOME)/.prisoncode/packages.txt | awk '{print $$1}'; \
else echo ""; fi)
# Build the Docker image (replaces build.sh)
build:
@docker build \
--build-arg USER_PKGS="$(USER_PKGS)" \
--build-arg PKGS_HASH="$(PKGS_HASH)" \
--build-arg REPO_PATH="$(PWD)" \
-t prisoncode:latest .
test:
@sh scripts/selftest-prisoncode-validations.sh
INSTALL_DEPS := build
ifneq ($(SKIP_TESTS),1)
INSTALL_DEPS := test build
endif
# Install the wrapper script to $HOME/bin and make it executable
install: $(INSTALL_DEPS)
@mkdir -p "$(HOME)/bin"
@cp prisoncode "$(HOME)/bin/"
@chmod +x "$(HOME)/bin/prisoncode"