2021-02-18 19:41:59 -05:00
|
|
|
# Makefile - hhl - /usr/src
|
|
|
|
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
|
|
|
|
#
|
|
|
|
include src-config.mk
|
|
|
|
include src-files.mk
|
|
|
|
uid = $(shell id -u)
|
|
|
|
|
|
|
|
include_dir = /usr/include/mk
|
|
|
|
make_includes += $(wildcard $(include_dir)/*.mk)
|
|
|
|
|
|
|
|
pkgdbdir = $(build)/var/db/pkg/base
|
|
|
|
plists = $(pkgdbdir)/plist $(pkgdbdir)/etc.plist
|
|
|
|
|
|
|
|
dirs = dev proc sys run
|
|
|
|
ifeq ($(arch),x86_64)
|
|
|
|
dirs += lib64
|
|
|
|
endif
|
|
|
|
alldirs = bin boot dev etc home lib lib64 media mnt \
|
|
|
|
opt proc root run sbin srv sys tmp usr var
|
|
|
|
|
|
|
|
all: buildworld
|
|
|
|
|
|
|
|
toolchain-tgz: toolchain-hhl-${os_version}-${arch}.tgz
|
|
|
|
|
|
|
|
toolchain-tbz: toolchain-hhl-${os_version}-${arch}.tbz
|
|
|
|
|
|
|
|
toolchain-txz: toolchain-hhl-${os_version}-${arch}.txz
|
|
|
|
|
|
|
|
rootfs-tgz: rootfs-hhl-${os_version}-${arch}.tgz
|
|
|
|
|
|
|
|
rootfs-tbz: rootfs-hhl-${os_version}-${arch}.tbz
|
|
|
|
|
|
|
|
rootfs-txz: rootfs-hhl-${os_version}-${arch}.txz
|
|
|
|
|
|
|
|
toolchain-hhl-${os_version}-${arch}.tgz: /toolchain/.built smalltools
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -czf ../$@ toolchain
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
toolchain-hhl-${os_version}-${arch}.tbz: /toolchain/.built smalltools
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -cjf ../$@ toolchain
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
toolchain-hhl-${os_version}-${arch}.txz: /toolchain/.built smalltools
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -cJf ../$@ toolchain
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
smalltools: /toolchain/.built
|
|
|
|
$(MAKE) -C toolchain reduce-size
|
|
|
|
|
|
|
|
buildtools: /toolchain/.built
|
|
|
|
$(info $(grn)=== Temporary toolchain build ===$(reset))
|
|
|
|
|
2021-02-26 12:46:11 -05:00
|
|
|
/toolchain/.built: config.mk | $(dirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
$(info $(grn)=== Building temporary toolchain ===$(reset))
|
|
|
|
$(MAKE) -C toolchain
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
toolsclean:
|
|
|
|
$(MAKE) -C toolchain clean
|
|
|
|
|
|
|
|
src-files.mk:
|
|
|
|
echo src-files = \\ > $@.in
|
|
|
|
git ls-files | sort | while read l ; do echo $${l} \\ ; done | \
|
|
|
|
sed '$$ s:\\::' >> $@.in
|
|
|
|
mv $@.in $@
|
|
|
|
|
|
|
|
buildworld: $(build)/.built $(plists)
|
|
|
|
$(info $(grn)=== World build complete ===$(reset))
|
|
|
|
|
|
|
|
strip: $(build)/.stripped
|
|
|
|
|
|
|
|
$(build)/.stripped:
|
2021-02-26 12:46:11 -05:00
|
|
|
for dir in $(stripdirs) ; \
|
|
|
|
do $(arch)-strip --strip-debug $${dir}/* > \
|
2021-02-18 19:41:59 -05:00
|
|
|
/dev/null 2>&1 || true ; done
|
|
|
|
touch $@
|
|
|
|
|
2021-02-26 12:46:11 -05:00
|
|
|
$(build)/.built: /toolchain/.built $(build)/.skeleton.built
|
2021-02-18 19:41:59 -05:00
|
|
|
$(MAKE) -C world
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(build)/.skeleton.built: | $(dirs)
|
|
|
|
install -d -m 0750 build/root
|
|
|
|
install -dv -m 1777 build/tmp build/var/tmp
|
|
|
|
[ -h build/var/run ] || ln -sv /run build/var/run
|
|
|
|
[ -h build/var/lock ] || ln -sv /run/lock build/var/lock
|
|
|
|
[ -c $(build)/dev/console ] || su -c "mknod -m 600 $(build)/dev/console c 5 1"
|
|
|
|
[ -c $(build)/dev/null ] || su -c "mknod -m 666 $(build)/dev/null c 1 3"
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(plists): $(build)/.built
|
|
|
|
$(info $(grn)=== Creating plist ===$(reset))
|
|
|
|
pkgname=base $(MAKE) -C $(build) -f $(include_dir)/create-plist.mk install
|
|
|
|
|
|
|
|
$(dirs):
|
|
|
|
install -d ${build}/$@
|
|
|
|
|
|
|
|
remove-toolchain:
|
|
|
|
$(MAKE) -C toolchain remove
|
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tgz: $(plists) $(build)/.stripped
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -czf ../$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tbz: $(plists) $(build)/.stripped
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -cjf ../$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).txz: $(plists) $(build)/.stripped
|
2021-02-26 12:46:11 -05:00
|
|
|
cd build && paxtar -M uidgid -cJf ../$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
clean:
|
|
|
|
$(MAKE) -C world clean
|
|
|
|
$(MAKE) -C toolchain clean
|
|
|
|
rm -rf build/*
|
|
|
|
rm -rf build/.built
|
|
|
|
rm -rf build/.skeleton.built
|
|
|
|
|
|
|
|
.PHONY: toolchain-archive buildtools smalltools toolsclean buildworld $(dirs) strip
|