~sschwarzer/sudoku-solver

985350ad7b678176984d7aa35a18da21f4399b8c — Stefan Schwarzer 10 months ago 8777397
Use `raco-exe-multitarget` for compilation

Replace the multi-target compilation code in the makefile with an
invocaton of `raco exe-multitarget`.
2 files changed, 11 insertions(+), 38 deletions(-)

M Makefile
M info.rkt
M Makefile => Makefile +10 -37
@@ 1,48 1,21 @@
VERSION=$(shell cat VERSION)

TARGET ?= x86_64-linux
NICE_TARGET ?= ${TARGET}
VM ?= cs
# Both options are allowed for Posix and Windows.
TARGET_OPTS ?= --orig-exe --embed-dlls
# `raco exe` appends `.exe` for Windows automatically.
EXE_NAME := sudoku-solver-${VERSION}-${NICE_TARGET}
EXE_PATH := build/${NICE_TARGET}/${EXE_NAME}

# Build standalone binary.
.PHONY : build
build: patch
	mkdir -p "build/${NICE_TARGET}"
	# Ignore uninstalled package.
	-raco cross --target "${TARGET}" --vm ${VM} pkg remove sudoku-solver
	# Implicitly install dependencies.
	raco cross --target "${TARGET}" --vm ${VM} -j 4 pkg install --deps search-auto
	raco cross --target "${TARGET}" --vm ${VM} -j 4 exe ${TARGET_OPTS} \
		-o "${EXE_PATH}" games/sudoku-solver.rkt

.PHONY : build-x86_64-linux
build-x86_64-linux: build

.PHONY : build-x86_64-win32
build-x86_64-win32:
	TARGET=x86_64-win32 NICE_TARGET=x86_64-windows make build

.PHONY : build-x86_64-macosx
build-x86_64-macosx:
	TARGET=x86_64-macosx make build

.PHONY : build-aarch64-macosx
build-aarch64-macosx:
	TARGET=aarch64-macosx make build
# Create standalone binaries for different platforms.
.PHONY : build-binaries
build-binaries:
	raco exe-multitarget \
		--targets x86_64-linux,x86_64-win32,x86_64-macosx,aarch64-macosx \
		--version "${VERSION}" \
		--build-directory-template "build" \
		--launcher-name-template "{launcher-name}-{version}-{nice-target}" \
		games/sudoku-solver.rkt

.PHONY : build-source
build-source:
	git archive -o build/sudoku-solver-${VERSION}.zip HEAD

# Create standalone binaries for different platforms.
.PHONY : build-all
build-all: build-x86_64-linux build-x86_64-win32 build-x86_64-macosx \
	build-aarch64-macosx build-source
build-all: build-binaries build-source

.PHONY : patch
patch:

M info.rkt => info.rkt +1 -1
@@ 2,7 2,7 @@

(define collection 'multi)
(define deps '("base" "data-lib"))
(define build-deps '("rackunit-lib" "al2-test-runner"))
(define build-deps '("rackunit-lib" "al2-test-runner" "raco-exe-multitarget"))
(define pkg-desc "Backtracking command-line solver for Sudoku puzzles")
(define version "0.15.0")
(define pkg-authors '(sschwarzer))