1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00
sortix--sortix/Makefile

576 lines
19 KiB
Makefile
Raw Normal View History

SOFTWARE_MEANT_FOR_SORTIX=1
2014-06-28 10:10:20 -04:00
include build-aux/platform.mak
include build-aux/compiler.mak
include build-aux/version.mak
2012-09-10 17:36:15 -04:00
2013-08-31 07:15:53 -04:00
MODULES=\
doc \
libc \
libm \
dispd \
2015-03-07 07:34:43 -05:00
libmount \
2013-08-31 07:15:53 -04:00
bench \
2014-04-21 16:37:44 -04:00
carray \
2020-09-27 16:15:20 -04:00
checksum \
2015-07-23 20:23:03 -04:00
disked \
2021-08-22 06:08:44 -04:00
dnsconfig \
2014-08-23 15:26:38 -04:00
editor \
2013-08-31 07:15:53 -04:00
ext \
games \
2017-03-19 12:00:08 -04:00
hostname \
2014-10-04 11:34:51 -04:00
init \
2014-05-05 18:17:11 -04:00
kblayout \
2014-04-21 12:44:24 -04:00
kblayout-compiler \
2015-12-24 21:24:51 -05:00
login \
2013-08-31 07:15:53 -04:00
mkinitrd \
2014-02-20 09:48:20 -05:00
regress \
2018-03-30 17:44:08 -04:00
rw \
2015-09-19 21:33:04 -04:00
sf \
2014-12-04 11:39:41 -05:00
sh \
sysinstall \
2014-05-13 16:46:23 -04:00
tix \
2013-03-16 17:40:02 -04:00
trianglix \
2015-09-25 08:57:11 -04:00
update-initrd \
2013-08-31 07:15:53 -04:00
utils \
kernel
ifndef SYSROOT
2012-09-10 17:36:15 -04:00
SYSROOT:=$(shell pwd)/sysroot
endif
ifndef SYSROOT_OVERLAY
SYSROOT_OVERLAY:=$(shell pwd)/sysroot-overlay
2011-08-05 08:25:00 -04:00
endif
SORTIX_BUILDS_DIR?=builds
2013-10-30 07:09:57 -04:00
SORTIX_PORTS_DIR?=ports
SORTIX_RELEASE_DIR?=release
2013-10-30 07:09:57 -04:00
SORTIX_REPOSITORY_DIR?=repository
2015-07-27 19:46:01 -04:00
SORTIX_ISO_COMPRESSION?=xz
SORTIX_INCLUDE_SOURCE_GIT_REPO?=$(shell test -d .git && echo "file://`pwd`")
SORTIX_INCLUDE_SOURCE_GIT_REPO:=$(SORTIX_INCLUDE_SOURCE_GIT_REPO)
SORTIX_INCLUDE_SOURCE_GIT_ORIGIN?=
SORTIX_INCLUDE_SOURCE_GIT_CLONE_OPTIONS?=--single-branch
SORTIX_INCLUDE_SOURCE_GIT_BRANCHES?=master
ifneq ($(and $(shell which git 2>/dev/null),$(SORTIX_INCLUDE_SOURCE_GIT_REPO)),)
SORTIX_INCLUDE_SOURCE?=git
else
SORTIX_INCLUDE_SOURCE?=yes
endif
2014-06-28 10:10:20 -04:00
include build-aux/dirs.mak
2021-07-17 11:34:41 -04:00
BUILD_NAME:=sortix-$(RELEASE)-$(MACHINE)
2011-08-05 08:25:00 -04:00
2015-12-27 20:11:17 -05:00
LIVE_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).live.initrd
OVERLAY_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).overlay.initrd
SRC_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).src.initrd
SYSTEM_INITRD:=$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).system.initrd
.PHONY: all
all: sysroot
2014-10-01 13:01:28 -04:00
.PHONY: sysmerge
sysmerge: sysroot
sysmerge "$(SYSROOT)"
2021-01-18 18:04:56 -05:00
.PHONY: sysmerge-full
sysmerge-full: sysroot
sysmerge --full "$(SYSROOT)"
.PHONY: sysmerge-full-wait
sysmerge-full-wait: sysroot
sysmerge --full --wait "$(SYSROOT)"
.PHONY: sysmerge-wait
sysmerge-wait: sysroot
sysmerge --wait "$(SYSROOT)"
2014-06-28 10:10:20 -04:00
2015-01-19 11:58:07 -05:00
.PHONY: clean-build-tools
clean-build-tools:
$(MAKE) -C carray clean
2014-04-21 12:44:24 -04:00
$(MAKE) -C kblayout-compiler clean
2015-01-19 11:58:07 -05:00
$(MAKE) -C mkinitrd clean
2015-09-19 21:33:04 -04:00
$(MAKE) -C sf clean
2015-01-19 11:58:07 -05:00
$(MAKE) -C tix clean
.PHONY: build-tools
build-tools:
2014-04-21 16:37:44 -04:00
$(MAKE) -C carray
2014-04-21 12:44:24 -04:00
$(MAKE) -C kblayout-compiler
$(MAKE) -C mkinitrd
2015-09-19 21:33:04 -04:00
$(MAKE) -C sf
2013-03-26 07:40:43 -04:00
$(MAKE) -C tix
.PHONY: install-build-tools
install-build-tools:
2014-04-21 16:37:44 -04:00
$(MAKE) -C carray install
2014-04-21 12:44:24 -04:00
$(MAKE) -C kblayout-compiler install
$(MAKE) -C mkinitrd install
2015-09-19 21:33:04 -04:00
$(MAKE) -C sf install
2013-03-26 07:40:43 -04:00
$(MAKE) -C tix install
2012-09-10 17:36:15 -04:00
.PHONY: sysroot-fsh
2012-09-10 17:36:15 -04:00
sysroot-fsh:
mkdir -p "$(SYSROOT)"
mkdir -p "$(SYSROOT)/bin"
mkdir -p "$(SYSROOT)/boot"
2015-07-25 08:04:04 -04:00
mkdir -p "$(SYSROOT)/dev"
mkdir -p "$(SYSROOT)/etc"
mkdir -p "$(SYSROOT)/etc/skel"
mkdir -p "$(SYSROOT)/home"
mkdir -p "$(SYSROOT)/include"
mkdir -p "$(SYSROOT)/lib"
mkdir -p "$(SYSROOT)/libexec"
mkdir -p "$(SYSROOT)/mnt"
2015-02-15 06:54:44 -05:00
mkdir -p "$(SYSROOT)/sbin"
mkdir -p "$(SYSROOT)/share"
mkdir -p "$(SYSROOT)/src"
2015-07-25 08:04:04 -04:00
mkdir -p "$(SYSROOT)/tix"
mkdir -p "$(SYSROOT)/tix/tixinfo"
2015-07-25 08:04:04 -04:00
mkdir -p "$(SYSROOT)/tix/manifest"
mkdir -p "$(SYSROOT)/tmp" -m 1777
2014-06-28 10:13:20 -04:00
mkdir -p "$(SYSROOT)/var"
mkdir -p "$(SYSROOT)/var/cache"
2020-12-27 17:07:33 -05:00
mkdir -p "$(SYSROOT)/var/empty" -m 555
mkdir -p "$(SYSROOT)/var/log"
mkdir -p "$(SYSROOT)/var/run"
2015-12-17 09:35:13 -05:00
ln -sfT . "$(SYSROOT)/usr"
.PHONY: sysroot-base-headers
sysroot-base-headers: sysroot-fsh
export SYSROOT="$(SYSROOT)" && \
(for D in libc libm kernel; do ($(MAKE) -C $$D install-headers DESTDIR="$(SYSROOT)") || exit $$?; done)
.PHONY: sysroot-system
sysroot-system: sysroot-fsh sysroot-base-headers
2015-07-25 08:04:04 -04:00
rm -f "$(SYSROOT)/tix/manifest/system"
echo / >> "$(SYSROOT)/tix/manifest/system"
echo /bin >> "$(SYSROOT)/tix/manifest/system"
echo /boot >> "$(SYSROOT)/tix/manifest/system"
echo /dev >> "$(SYSROOT)/tix/manifest/system"
echo /etc >> "$(SYSROOT)/tix/manifest/system"
echo /etc/skel >> "$(SYSROOT)/tix/manifest/system"
echo /home >> "$(SYSROOT)/tix/manifest/system"
echo /include >> "$(SYSROOT)/tix/manifest/system"
echo /lib >> "$(SYSROOT)/tix/manifest/system"
echo /libexec >> "$(SYSROOT)/tix/manifest/system"
echo /mnt >> "$(SYSROOT)/tix/manifest/system"
echo /sbin >> "$(SYSROOT)/tix/manifest/system"
echo /share >> "$(SYSROOT)/tix/manifest/system"
echo /src >> "$(SYSROOT)/tix/manifest/system"
echo /tix >> "$(SYSROOT)/tix/manifest/system"
echo /tix/tixinfo >> "$(SYSROOT)/tix/manifest/system"
2015-07-25 08:04:04 -04:00
echo /tix/manifest >> "$(SYSROOT)/tix/manifest/system"
echo /tmp >> "$(SYSROOT)/tix/manifest/system"
echo /usr >> "$(SYSROOT)/tix/manifest/system"
echo /var >> "$(SYSROOT)/tix/manifest/system"
echo /var/cache >> "$(SYSROOT)/tix/manifest/system"
2015-07-25 08:04:04 -04:00
echo /var/empty >> "$(SYSROOT)/tix/manifest/system"
echo /var/log >> "$(SYSROOT)/tix/manifest/system"
echo /var/run >> "$(SYSROOT)/tix/manifest/system"
2016-01-04 16:46:34 -05:00
echo "$(HOST_MACHINE)" > "$(SYSROOT)/etc/machine"
echo /etc/machine >> "$(SYSROOT)/tix/manifest/system"
2015-08-12 06:33:56 -04:00
(echo 'NAME="Sortix"' && \
echo 'VERSION="$(VERSION)"' && \
echo 'ID=sortix' && \
echo 'VERSION_ID="$(VERSION)"' && \
echo 'PRETTY_NAME="Sortix $(VERSION)"' && \
echo 'SORTIX_ABI=1.1' && \
2015-08-12 06:33:56 -04:00
true) > "$(SYSROOT)/etc/sortix-release"
echo /etc/sortix-release >> "$(SYSROOT)/tix/manifest/system"
ln -sf sortix-release "$(SYSROOT)/etc/os-release"
echo /etc/os-release >> "$(SYSROOT)/tix/manifest/system"
2015-07-25 08:04:04 -04:00
find share | sed -e 's,^,/,' >> "$(SYSROOT)/tix/manifest/system"
2015-10-05 18:32:45 -04:00
cp -RT share "$(SYSROOT)/share"
export SYSROOT="$(SYSROOT)" && \
2015-07-25 08:04:04 -04:00
(for D in $(MODULES); \
do ($(MAKE) -C $$D && \
rm -rf "$(SYSROOT).destdir" && \
mkdir -p "$(SYSROOT).destdir" && \
$(MAKE) -C $$D install DESTDIR="$(SYSROOT).destdir" && \
(cd "$(SYSROOT).destdir" && find .) | sed -e 's/\.//' -e 's/^$$/\//' | \
grep -E '^.+$$' >> "$(SYSROOT)/tix/manifest/system" && \
cp -RT "$(SYSROOT).destdir" "$(SYSROOT)" && \
rm -rf "$(SYSROOT).destdir") \
|| exit $$?; done)
LC_ALL=C sort -u "$(SYSROOT)/tix/manifest/system" > "$(SYSROOT)/tix/manifest/system.new"
mv "$(SYSROOT)/tix/manifest/system.new" "$(SYSROOT)/tix/manifest/system"
.PHONY: sysroot-source
sysroot-source: sysroot-fsh
ifeq ($(SORTIX_INCLUDE_SOURCE),git)
rm -rf "$(SYSROOT)/src"
git clone --no-hardlinks $(SORTIX_INCLUDE_SOURCE_GIT_CLONE_OPTIONS) -- "$(SORTIX_INCLUDE_SOURCE_GIT_REPO)" "$(SYSROOT)/src"
-cd "$(SYSROOT)/src" && for BRANCH in $(SORTIX_INCLUDE_SOURCE_GIT_BRANCHES); do \
git fetch origin $$BRANCH && \
2016-02-07 17:59:26 -05:00
(git branch -f $$BRANCH FETCH_HEAD || true) ; \
done
ifneq ($(SORTIX_INCLUDE_SOURCE_GIT_ORIGIN),)
cd "$(SYSROOT)/src" && git remote set-url origin $(SORTIX_INCLUDE_SOURCE_GIT_ORIGIN)
else
-cd "$(SYSROOT)/src" && git remote rm origin
endif
else ifneq ($(SORTIX_INCLUDE_SOURCE),no)
2014-06-28 10:10:20 -04:00
cp .gitignore -t "$(SYSROOT)/src"
cp LICENSE -t "$(SYSROOT)/src"
2014-06-28 10:10:20 -04:00
cp Makefile -t "$(SYSROOT)/src"
cp README -t "$(SYSROOT)/src"
2014-06-28 10:10:20 -04:00
cp -RT build-aux "$(SYSROOT)/src/build-aux"
2016-02-07 17:59:26 -05:00
cp -RT share "$(SYSROOT)/src/share"
2014-09-22 11:35:54 -04:00
(for D in $(MODULES); do (cp -R $$D -t "$(SYSROOT)/src" && $(MAKE) -C "$(SYSROOT)/src/$$D" clean) || exit $$?; done)
endif
2015-07-25 08:04:04 -04:00
(cd "$(SYSROOT)" && find .) | sed 's/\.//' | \
grep -E '^/src(/.*)?$$' | \
LC_ALL=C sort > "$(SYSROOT)/tix/manifest/src"
2013-10-30 07:09:57 -04:00
.PHONY: sysroot-ports
sysroot-ports: sysroot-fsh sysroot-base-headers sysroot-system sysroot-source
@SORTIX_PORTS_DIR="$(SORTIX_PORTS_DIR)" \
SORTIX_REPOSITORY_DIR="$(SORTIX_REPOSITORY_DIR)" \
SYSROOT="$(SYSROOT)" \
HOST="$(HOST)" \
MAKE="$(MAKE)" \
2014-06-28 10:10:20 -04:00
MAKEFLAGS="$(MAKEFLAGS)" \
build-aux/build-ports.sh
2013-10-30 07:09:57 -04:00
.PHONY: sysroot
2015-12-27 20:11:17 -05:00
sysroot: sysroot-system sysroot-source sysroot-ports
2013-10-30 07:09:57 -04:00
$(SORTIX_REPOSITORY_DIR):
mkdir -p $@
$(SORTIX_REPOSITORY_DIR)/$(HOST): $(SORTIX_REPOSITORY_DIR)
mkdir -p $@
.PHONY: clean-core
clean-core:
2014-06-28 10:10:20 -04:00
(for D in $(MODULES); do $(MAKE) clean -C $$D || exit $$?; done)
2013-10-30 07:09:57 -04:00
.PHONY: clean-ports
clean-ports:
@SORTIX_PORTS_DIR="$(SORTIX_PORTS_DIR)" \
HOST="$(HOST)" \
MAKE="$(MAKE)" \
2014-06-28 10:10:20 -04:00
MAKEFLAGS="$(MAKEFLAGS)" \
build-aux/clean-ports.sh
2013-10-30 07:09:57 -04:00
.PHONY: clean-builds
2012-09-10 17:36:15 -04:00
clean-builds:
rm -rf "$(SORTIX_BUILDS_DIR)"
2011-08-05 08:25:00 -04:00
rm -f sortix.iso
.PHONY: clean-release
clean-release:
rm -rf "$(SORTIX_RELEASE_DIR)"
2011-08-05 08:25:00 -04:00
2013-10-30 07:09:57 -04:00
.PHONY: clean-repository
clean-repository:
rm -rf "$(SORTIX_REPOSITORY_DIR)"
.PHONY: clean-sysroot
2012-09-10 17:36:15 -04:00
clean-sysroot:
rm -rf "$(SYSROOT)"
2015-07-25 08:04:04 -04:00
rm -rf "$(SYSROOT)".destdir
2012-09-10 17:36:15 -04:00
.PHONY: clean
2013-10-30 07:09:57 -04:00
clean: clean-core clean-ports
2012-09-10 17:36:15 -04:00
.PHONY: mostlyclean
2013-10-30 07:09:57 -04:00
mostlyclean: clean-core clean-ports clean-builds clean-release clean-sysroot
.PHONY: distclean
2013-10-30 07:09:57 -04:00
distclean: clean-core clean-ports clean-builds clean-release clean-repository clean-sysroot
.PHONY: most-things
2015-12-27 20:11:17 -05:00
most-things: sysroot iso
.PHONY: everything
2015-07-27 19:46:01 -04:00
everything: most-things
2012-09-10 17:36:15 -04:00
# Targets that build multiple architectures.
.PHONY: sysroot-base-headers-all-archs
sysroot-base-headers-all-archs:
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) sysroot-base-headers HOST=i686-sortix
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) sysroot-base-headers HOST=x86_64-sortix
.PHONY: all-archs
2012-09-10 17:36:15 -04:00
all-archs:
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) all HOST=i686-sortix
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) all HOST=x86_64-sortix
.PHONY: most-things-all-archs
most-things-all-archs:
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) most-things HOST=i686-sortix
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) most-things HOST=x86_64-sortix
.PHONY: everything-all-archs
everything-all-archs:
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) everything HOST=i686-sortix
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) everything HOST=x86_64-sortix
.PHONY: release-all-archs
release-all-archs:
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) release HOST=i686-sortix
2015-04-25 17:11:46 -04:00
$(MAKE) clean clean-sysroot
$(MAKE) release HOST=x86_64-sortix
2011-08-05 08:25:00 -04:00
# Initial ramdisk
2015-12-27 20:11:17 -05:00
$(LIVE_INITRD): sysroot
mkdir -p `dirname $(LIVE_INITRD)`
rm -rf $(LIVE_INITRD).d
mkdir -p $(LIVE_INITRD).d
mkdir -p $(LIVE_INITRD).d/etc
mkdir -p $(LIVE_INITRD).d/etc/init
echo single-user > $(LIVE_INITRD).d/etc/init/target
echo "root::0:0:root:/root:sh" > $(LIVE_INITRD).d/etc/passwd
echo "root::0:root" > $(LIVE_INITRD).d/etc/group
mkdir -p $(LIVE_INITRD).d/home
mkdir -p $(LIVE_INITRD).d/root -m 700
cp -RT "$(SYSROOT)/etc/skel" $(LIVE_INITRD).d/root
cp doc/welcome $(LIVE_INITRD).d/root
2016-04-10 09:19:12 -04:00
tix-collection $(LIVE_INITRD).d create --platform=$(HOST) --prefix= --generation=2
2015-12-27 20:11:17 -05:00
mkinitrd --format=sortix-initrd-2 $(LIVE_INITRD).d -o $(LIVE_INITRD)
rm -rf $(LIVE_INITRD).d
.PHONY: $(OVERLAY_INITRD)
$(OVERLAY_INITRD): sysroot
test ! -d "$(SYSROOT_OVERLAY)" || \
mkinitrd --format=sortix-initrd-2 "$(SYSROOT_OVERLAY)" -o $(OVERLAY_INITRD)
$(SRC_INITRD): sysroot
mkinitrd --format=sortix-initrd-2 --manifest="$(SYSROOT)/tix/manifest/src" "$(SYSROOT)" -o $(SRC_INITRD)
$(SYSTEM_INITRD): sysroot
mkinitrd --format=sortix-initrd-2 --manifest="$(SYSROOT)/tix/manifest/system" "$(SYSROOT)" -o $(SYSTEM_INITRD)
2011-08-05 08:25:00 -04:00
# Packaging
$(SORTIX_BUILDS_DIR):
mkdir -p $(SORTIX_BUILDS_DIR)
2011-08-05 08:25:00 -04:00
# Bootable images
2015-12-27 20:11:17 -05:00
$(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso: sysroot $(LIVE_INITRD) $(OVERLAY_INITRD) $(SRC_INITRD) $(SYSTEM_INITRD) $(SORTIX_BUILDS_DIR)
rm -rf $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
mkdir -p $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
2015-07-27 19:46:01 -04:00
mkdir -p $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot
2015-12-27 20:11:17 -05:00
mkdir -p $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/repository
SORTIX_PORTS_DIR="$(SORTIX_PORTS_DIR)" \
SORTIX_REPOSITORY_DIR="$(SORTIX_REPOSITORY_DIR)" \
SYSROOT="$(SYSROOT)" \
HOST="$(HOST)" \
build-aux/iso-repository.sh $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/repository
2015-07-27 19:46:01 -04:00
ifeq ($(SORTIX_ISO_COMPRESSION),xz)
xz -c "$(SYSROOT)/boot/sortix.bin" > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/sortix.bin.xz
2015-12-27 20:11:17 -05:00
xz -c $(LIVE_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/live.initrd.xz
test ! -e "$(OVERLAY_INITRD)" || \
xz -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.initrd.xz
xz -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.initrd.xz
xz -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.initrd.xz
2015-07-27 19:46:01 -04:00
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
grub-mkrescue --compress=xz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
else ifeq ($(SORTIX_ISO_COMPRESSION),gzip)
gzip -c "$(SYSROOT)/boot/sortix.bin" > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/sortix.bin.gz
2015-12-27 20:11:17 -05:00
gzip -c $(LIVE_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/live.initrd.gz
test ! -e "$(OVERLAY_INITRD)" || \
gzip -c $(OVERLAY_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.initrd.gz
gzip -c $(SRC_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.initrd.gz
gzip -c $(SYSTEM_INITRD) > $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.initrd.gz
2015-07-27 19:46:01 -04:00
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
grub-mkrescue --compress=gz -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
else # none
cp "$(SYSROOT)/boot/sortix.bin" $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/sortix.bin
2015-12-27 20:11:17 -05:00
cp $(LIVE_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/live.initrd
test ! -e "$(OVERLAY_INITRD)" || \
cp $(OVERLAY_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/overlay.initrd
cp $(SRC_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/src.initrd
cp $(SYSTEM_INITRD) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso/boot/system.initrd
2015-07-27 19:46:01 -04:00
build-aux/iso-grub-cfg.sh --platform $(HOST) --version $(VERSION) $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
grub-mkrescue -o $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
2015-07-27 19:46:01 -04:00
endif
rm -rf $(SORTIX_BUILDS_DIR)/$(BUILD_NAME)-iso
.PHONY: iso
iso: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso
sortix.iso: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso
2014-06-28 10:10:20 -04:00
cp $< $@
# Release
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE):
mkdir -p $@
2011-08-05 08:25:00 -04:00
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/builds: $(SORTIX_RELEASE_DIR)/$(RELEASE)
mkdir -p $@
2012-09-10 17:36:15 -04:00
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/builds/$(BUILD_NAME).iso: $(SORTIX_BUILDS_DIR)/$(BUILD_NAME).iso $(SORTIX_RELEASE_DIR)/$(RELEASE)/builds
cp $< $@
ifneq ($(MACHINE),)
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE): $(SORTIX_RELEASE_DIR)/$(RELEASE)
mkdir -p $@
endif
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot: $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)
mkdir -p $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/sortix.bin.xz: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
xz -c "$(SYSROOT)/boot/sortix.bin" > $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/live.initrd.xz: $(LIVE_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
xz -c $< > $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/overlay.initrd.xz: $(OVERLAY_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
test ! -e $< || xz -c $< > $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.initrd.xz: $(SRC_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
xz -c $< > $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/system.initrd.xz: $(SYSTEM_INITRD) $(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot
xz -c $< > $@
.PHONY: release-boot
release-boot: \
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/sortix.bin.xz \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/live.initrd.xz \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/overlay.initrd.xz \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/src.initrd.xz \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/$(MACHINE)/boot/system.initrd.xz \
2015-07-27 19:46:01 -04:00
.PHONY: release-iso
2021-07-17 11:34:41 -04:00
release-iso: $(SORTIX_RELEASE_DIR)/$(RELEASE)/builds/$(BUILD_NAME).iso
.PHONY: release-builds
release-builds: release-boot release-iso
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts: $(SORTIX_RELEASE_DIR)/$(RELEASE)
mkdir -p $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-add: tix/tix-iso-add $(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts
cp $< $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-bootconfig: tix/tix-iso-bootconfig $(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts
cp $< $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-liveconfig: tix/tix-iso-liveconfig $(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts
cp $< $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/man:
2021-04-12 16:23:59 -04:00
mkdir -p $@
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/man/ports.list: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/man
for section in 1 2 3 4 5 6 7 8 9; do mkdir -p $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/man$$section; done
2021-04-12 16:23:59 -04:00
for port in system `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo"`; do \
for manpage in `grep -E "^/share/man/man[1-9]/.*\.[1-9]$$" "$(SYSROOT)/tix/manifest/$$port" | \
LC_ALL=C sort | \
2021-07-17 11:34:41 -04:00
tee $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/$$port.list | \
2021-04-12 16:23:59 -04:00
grep -Eo 'man[1-9]/[^/]*\.[0-9]$$'`; do \
2021-07-17 11:34:41 -04:00
cp -f "$(SYSROOT)/share/man/$$manpage" $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/$$manpage && \
chmod 644 $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/$$manpage; \
2021-04-12 16:23:59 -04:00
done; \
done
2021-07-17 11:34:41 -04:00
LC_ALL=C ls "$(SYSROOT)/tix/tixinfo" > $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/ports.list
2021-04-12 16:23:59 -04:00
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST):
mkdir -p $@
.PHONY: release-repository
2021-07-17 11:34:41 -04:00
release-repository: sysroot $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST)
for port in `LC_ALL=C ls "$(SYSROOT)/tix/tixinfo"`; do \
2021-07-17 11:34:41 -04:00
cp $(SORTIX_REPOSITORY_DIR)/$(HOST)/$$port.tix.tar.xz $(SORTIX_RELEASE_DIR)/$(RELEASE)/repository/$(HOST); \
done
.PHONY: release-scripts
release-scripts: \
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-add \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-bootconfig \
$(SORTIX_RELEASE_DIR)/$(RELEASE)/scripts/tix-iso-liveconfig \
2021-07-17 11:34:41 -04:00
$(SORTIX_RELEASE_DIR)/$(RELEASE)/README: README $(SORTIX_RELEASE_DIR)/$(RELEASE)
cp $< $@
2021-04-12 16:23:59 -04:00
.PHONY: release-man
2021-07-17 11:34:41 -04:00
release-man: $(SORTIX_RELEASE_DIR)/$(RELEASE)/man/ports.list
2021-04-12 16:23:59 -04:00
.PHONY: release-readme
2021-07-17 11:34:41 -04:00
release-readme: $(SORTIX_RELEASE_DIR)/$(RELEASE)/README
.PHONY: release-arch
release-arch: release-builds release-readme release-repository
.PHONY: release-shared
2021-04-12 16:23:59 -04:00
release-shared: release-man release-readme release-scripts
.PHONY: release
release: release-arch release-shared
2021-07-17 11:34:41 -04:00
cd $(SORTIX_RELEASE_DIR)/$(RELEASE) && \
2021-04-12 16:58:21 -04:00
find . -type f '!' -name sha256sum -exec sha256sum '{}' ';' | \
sed -E 's,^([^ ]* )\./,\1,' | \
LC_ALL=C sort -k 2 > sha256sum
2011-08-05 08:25:00 -04:00
2021-10-09 16:46:47 -04:00
# Presubmit checks
presubmit:
$(MAKE) verify-coding-style
$(MAKE) verify-manual
$(MAKE) verify-build-tools
# TODO: The gcc port doesn't ship with cross-compilers out of the box.
ifeq ($(BUILD_IS_SORTIX),1)
$(MAKE) verify-build
else
$(MAKE) verify-build HOST=i686-sortix
$(MAKE) verify-build HOST=x86_64-sortix
endif
$(MAKE) verify-headers
@echo ok
verify-coding-style:
build-aux/verify-coding-style.sh
verify-manual:
build-aux/verify-manual.sh
verify-build-tools:
$(MAKE) clean-build-tools
$(MAKE) OPTLEVEL='-O2 -g -Werror -Werror=strict-prototypes' build-tools
verify-build:
$(MAKE) mostlyclean
$(MAKE) OPTLEVEL='-O2 -g -Werror -Werror=strict-prototypes' PACKAGES=''
verify-headers:
# TODO: The gcc port doesn't ship with cross-compilers out of the box.
ifeq ($(BUILD_IS_SORTIX),1)
build-aux/verify-headers.sh $(HOST) # Inherit jobserver: $(MAKE)
else
build-aux/verify-headers.sh # Inherit jobserver: $(MAKE)
endif
2011-08-05 08:25:00 -04:00
# Virtualization
.PHONY: run-virtualbox
2011-08-05 08:25:00 -04:00
run-virtualbox: sortix.iso
virtualbox --startvm sortix
.PHONY: run-virtualbox-debug
2011-08-05 08:25:00 -04:00
run-virtualbox-debug: sortix.iso
virtualbox --debug --start-running --startvm sortix
# Statistics
.PHONY: linecount
linecount:
2017-10-25 07:21:00 -04:00
wc -l `git ls-files | grep -Ev '^libm/man/.*$$'` | LC_ALL=C sort