2022-02-05 14:23:32 +00:00
BUILD_DIRS = build.*
2024-03-23 20:07:30 +00:00
- i n c l u d e $( HOME ) / . R O C K N I X / o p t i o n s
2022-02-05 14:23:32 +00:00
2022-02-15 16:33:39 +00:00
all : world
2022-02-05 14:23:32 +00:00
system :
./scripts/image
release :
./scripts/image release
image :
./scripts/image mkimage
clean :
rm -rf $( BUILD_DIRS)
distclean :
rm -rf ./.ccache* ./$( BUILD_DIRS)
2023-05-27 10:55:24 +00:00
src-pkg :
tar cvJf sources.tar.xz sources .stamps
2022-02-05 14:23:32 +00:00
2023-07-15 15:28:28 +00:00
docs :
2023-07-15 15:50:50 +00:00
./tools/foreach './scripts/clean emulators && ./scripts/build emulators'
2023-06-04 00:21:09 +00:00
2024-03-18 13:24:05 +00:00
world : AMD 64 RK 3588 S 922X RK 3326 RK 3399
2022-12-04 00:47:39 +00:00
2023-06-04 10:27:00 +00:00
AMD64 :
2023-06-04 00:16:57 +00:00
unset DEVICE_ROOT
2023-04-15 09:30:02 +00:00
PROJECT = PC DEVICE = AMD64 ARCH = i686 ./scripts/build_distro
PROJECT = PC DEVICE = AMD64 ARCH = x86_64 ./scripts/build_distro
2022-02-05 14:23:32 +00:00
2023-11-08 16:48:36 +00:00
INTEL64 :
unset DEVICE_ROOT
PROJECT = PC DEVICE = INTEL64 ARCH = i686 ./scripts/build_distro
PROJECT = PC DEVICE = INTEL64 ARCH = x86_64 ./scripts/build_distro
2023-06-04 10:27:00 +00:00
RK3588 :
2023-06-04 00:16:57 +00:00
unset DEVICE_ROOT
2023-02-08 17:26:54 +00:00
PROJECT = Rockchip DEVICE = RK3588 ARCH = arm ./scripts/build_distro
PROJECT = Rockchip DEVICE = RK3588 ARCH = aarch64 ./scripts/build_distro
2023-01-08 22:49:32 +00:00
2023-06-04 10:27:00 +00:00
S922X :
2023-06-04 00:16:57 +00:00
unset DEVICE_ROOT
PROJECT = Amlogic DEVICE = S922X ARCH = arm ./scripts/build_distro
PROJECT = Amlogic DEVICE = S922X ARCH = aarch64 ./scripts/build_distro
2023-05-04 18:06:54 +00:00
2023-06-04 10:27:00 +00:00
RK3566 :
2024-03-23 20:07:30 +00:00
unset DEVICE_ROOT
2023-04-28 16:42:14 +00:00
DEVICE_ROOT = RK3566 PROJECT = Rockchip DEVICE = RK3566 ARCH = arm ./scripts/build_distro
DEVICE_ROOT = RK3566 PROJECT = Rockchip DEVICE = RK3566 ARCH = aarch64 ./scripts/build_distro
2023-02-16 22:40:39 +00:00
2023-06-04 10:27:00 +00:00
RK3326 :
2023-06-04 00:16:57 +00:00
unset DEVICE_ROOT
PROJECT = Rockchip DEVICE = RK3326 ARCH = arm ./scripts/build_distro
PROJECT = Rockchip DEVICE = RK3326 ARCH = aarch64 ./scripts/build_distro
2023-03-22 21:56:33 +00:00
2023-06-23 03:14:11 +00:00
RK3399 :
2023-06-29 20:10:01 +00:00
unset DEVICE_ROOT
2023-06-23 03:14:11 +00:00
PROJECT = Rockchip DEVICE = RK3399 ARCH = arm ./scripts/build_distro
PROJECT = Rockchip DEVICE = RK3399 ARCH = aarch64 ./scripts/build_distro
2022-02-05 14:23:32 +00:00
update :
2023-04-15 09:30:02 +00:00
PROJECT = PC DEVICE = AMD64 ARCH = x86_64 ./scripts/update_packages
2022-02-05 14:23:32 +00:00
package :
./scripts/build ${ PACKAGE }
package-clean :
./scripts/clean ${ PACKAGE }
## Docker builds - overview
# docker-* commands just wire up docker to call the normal make command via docker
2023-04-15 09:30:02 +00:00
# For example: make docker-AMD64 will use docker to call: make AMD64
2022-02-05 14:23:32 +00:00
# All variables are scoped to docker-* commands to prevent weird collisions/behavior with non-docker commands
2024-03-23 20:07:30 +00:00
docker-% : DOCKER_IMAGE := "rocknix /rocknix -build :latest "
2022-02-05 14:23:32 +00:00
2022-05-03 11:52:03 +00:00
# DOCKER_WORK_DIR is the directory in the Docker image - it is set to /work by default
2022-02-14 21:15:16 +00:00
# Anytime this directory changes, you must run `make clean` similarly to moving the distribution directory
2022-06-03 11:17:16 +00:00
docker-% : DOCKER_WORK_DIR := $( shell if [ -n "$ {DOCKER_WORK_DIR }" ]; then echo $ {DOCKER_WORK_DIR }; else echo "$ $ ( pwd ) " ; fi )
2022-02-05 14:23:32 +00:00
2024-03-18 13:24:05 +00:00
# ${HOME}/.${DISTRONAME}/options is a global options file containing developer and build settings.
docker-% : GLOBAL_SETTINGS := $( shell if [ -f "$ {HOME }/.$ {DISTRONAME }/options " ]; then echo "-v \"$ {HOME }/.$ {DISTRONAME }/options :$ {HOME }/.$ {DISTRONAME }/options \""; else echo ""; fi )
2022-02-05 14:23:32 +00:00
2023-06-02 13:30:23 +00:00
# LOCAL_SSH_KEYS_FILE is a variable that contains the location of the authorized keys file for development build use. It will be mounted into the container if it exists.
docker-% : LOCAL_SSH_KEYS_FILE := $( shell if [ -n "$ {LOCAL_SSH_KEYS_FILE }" ]; then echo "-v \"$ {LOCAL_SSH_KEYS_FILE }:$ {LOCAL_SSH_KEYS_FILE }\""; else echo ""; fi )
2022-02-05 14:23:32 +00:00
# UID is the user ID of current user - ensures docker sets file permissions properly
docker-% : UID := $( shell id -u )
# GID is the main user group of current user - ensures docker sets file permissions properly
docker-% : GID := $( shell id -g )
# PWD is 'present working directory' and passes through the full path to current dir to docker (becomes 'work')
docker-% : PWD := $( shell pwd )
# Command to use (either `docker` or `podman`)
docker-% : DOCKER_CMD := $( shell if which docker 2>/dev /null 1>/dev /null ; then echo "docker "; elif which podman 2>/dev /null 1>/dev /null ; then echo "podman "; fi )
# Podman requires some extra args (`--userns=keep-id` and `--security-opt=label=disable`). Set those args if using podman
2023-10-12 20:46:31 +00:00
# Make sure that docker isn't just an alias for podman
docker-% : PODMAN_ARGS := $( shell if echo "$ $ ( docker --version 2>/dev /null || podman --version 2>/dev /null ) " | grep podman 1>/dev /null ; then echo "--userns =keep -id --security -opt =label =disable -v /proc /mounts :/etc /mtab "; fi )
2022-02-05 14:23:32 +00:00
# Launch docker as interactive if this is an interactive shell (allows ctrl-c for manual and running non-interactive - aka: build server)
docker-% : INTERACTIVE =$( shell [ -t 0 ] && echo "-it ")
# By default pass through anything after `docker-` back into `make`
docker-% : COMMAND =make $*
# Get .env file ready
docker-% : $( shell env | grep "=" > .env )
# If the user issues a `make docker-shell` just start up bash as the shell to run commands
docker-shell : COMMAND =bash
2023-06-02 11:58:37 +00:00
# Command: builds and pushes a hybrid docker image to dockerhub
# You must login with: docker login --username <username> and provide either a password or token (from user settings -> security in dockerhub) before this will work. The build user must also be a member of the "docker" group.
2022-02-05 14:23:32 +00:00
docker-image-build :
2023-06-02 11:58:37 +00:00
$( DOCKER_CMD) buildx create --use
$( DOCKER_CMD) buildx build --tag $( DOCKER_IMAGE) --platform linux/amd64,linux/arm64 --push .
2022-02-05 14:23:32 +00:00
# Command: pulls latest docker image from dockerhub. This will *replace* locally built version.
docker-image-pull :
2023-06-02 11:58:37 +00:00
$( DOCKER_CMD) pull $( DOCKER_IMAGE)
2022-02-05 14:23:32 +00:00
# Wire up docker to call equivalent make files using % to match and $* to pass the value matched by %
docker-% :
2023-06-22 11:34:53 +00:00
BUILD_DIR = $( DOCKER_WORK_DIR) $( DOCKER_CMD) run $( PODMAN_ARGS) $( INTERACTIVE) --init --env-file .env --rm --user $( UID) :$( GID) $( GLOBAL_SETTINGS) $( LOCAL_SSH_KEYS_FILE) -v $( PWD) :$( DOCKER_WORK_DIR) -w $( DOCKER_WORK_DIR) $( DOCKER_EXTRA_OPTS) $( DOCKER_IMAGE) $( COMMAND)
2022-02-05 14:23:32 +00:00