+###----- Licensing notice ---------------------------------------------------
+###
+### This file is part of the Trivial IP Encryption (TrIPE) Android app.
+###
+### TrIPE is free software: you can redistribute it and/or modify it under
+### the terms of the GNU General Public License as published by the Free
+### Software Foundation; either version 3 of the License, or (at your
+### option) any later version.
+###
+### TrIPE is distributed in the hope that it will be useful, but WITHOUT
+### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+### for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
+
+PACKAGE = tripe-android
+VERSION := $(shell ./auto-version)
+
+.SECONDEXPANSION: #sorry
+
+###--------------------------------------------------------------------------
+### Build parameters.
+
+## Where to put the object files.
+OUTDIR = out/
+
+## Native C compiler.
+CC = gcc
+CFLAGS = -O2 -g -Wall -pedantic -Werror
+
+## Native linker.
+LD = gcc
+LDFLAGS.so = -shared
+
+## External `pkg-config' packages required.
+PKGS = mLib catacomb
+
+## Java development kit.
+JDKDIR = /usr/lib/jvm/default-java
+JDK_PLAT = linux
+JNI_INCLUDES = $(JDKDIR)/include $(JDKDIR)/include/$(JDK_PLAT)
+
+## Default arguments for the Java runtime.
+JAVADEFS =
+
+## The Java runtime, for some reason, hardcodes its default for
+## `java.io.tmpdir', inviting security problems. If the user has defined a
+## `TMPDIR', then persuade Java to use it.
+explicit-tmpdir-p = $(if $(filter-out undefined,$(origin TMPDIR)),t,nil)
+ifeq ($(explicit-tmpdir-p), t)
+ JAVADEFS += -Djava.io.tmpdir=$(TMPDIR)
+endif
+
+## Java compiler.
+JAVAC = javac $(JAVADEFS)
+JAVAFLAGS =
+
+## Scala compiler.
+##
+## Unfortunately, `fsc' is a total security disaster. On the other hand,
+## `scalac' is rather slow. If we're running with a custom `TMPDIR', and the
+## `noip' wrapper <https://git.distorted.org.uk/~mdw/preload-hacks/> is
+## available, then we can tame `fsc' enough that it's probably safe to run;
+## otherwise, it's too risky to enable by default.
+noip-available-p := $(shell noip echo t 2>/dev/null || echo nil)
+ifeq ($(noip-available-p), t)
+ NOIP = noip
+endif
+ifeq "$(explicit-tmpdir-p),$(noip-available-p)" "t,t"
+ SCALAC = $(NOIP) fsc $(JAVADEFS)
+ SCALAC_RESET = $(SCALAC) -reset
+else
+ SCALAC = scalac $(JAVADEFS)
+ SCALAC_RESET =
+endif
+SCALAFLAGS = -optimise -Xlint -Xlint:-package-object-classes \
+ -Yinline-warnings:false
+SCALA_REPL = $(NOIP) scala $(JAVADEFS)
+
+## Silent-rules is on by default.