1e85e6fb7e
$(basedir)/Makefile - fix paths for toolchain archive creation
146 lines
3.6 KiB
Makefile
146 lines
3.6 KiB
Makefile
# Makefile - hhl - /src
|
|
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
|
|
#
|
|
include src-config.mk
|
|
uid = $(shell id -u)
|
|
|
|
include_dir = /src/include/mk
|
|
make_includes += $(wildcard $(include_dir)/*.mk)
|
|
|
|
pkgdbdir = $(build)/var/db/pkg/base
|
|
plists += $(pkgdbdir)/plist
|
|
plists += $(pkgdbdir)/etc.plist
|
|
|
|
dirs += dev
|
|
dirs += proc
|
|
dirs += run
|
|
dirs += sys
|
|
|
|
ifeq ($(arch),x86_64)
|
|
dirs += lib64
|
|
endif
|
|
alldirs += $(dirs)
|
|
alldirs += bin
|
|
alldirs += boot
|
|
alldirs += etc
|
|
alldirs += home
|
|
alldirs += lib
|
|
alldirs += media
|
|
alldirs += mnt
|
|
alldirs += opt
|
|
alldirs += root
|
|
alldirs += sbin
|
|
alldirs += srv
|
|
alldirs += tmp
|
|
alldirs += usr
|
|
alldirs += var
|
|
|
|
all: buildworld
|
|
|
|
.PHONY: all
|
|
|
|
buildtools: $(tooldir)/.built
|
|
$(info $(grn)=== Temporary toolchain build ===$(reset))
|
|
|
|
.PHONY: buildtools
|
|
|
|
$(tooldir)/.built: config.mk | $(dirs)
|
|
$(info $(grn)=== Building temporary toolchain ===$(reset))
|
|
$(MAKE) -C toolchain
|
|
touch $@
|
|
|
|
smalltools: $(tooldir)/.built
|
|
$(MAKE) -C toolchain reduce-size
|
|
|
|
.PHONY: smalltools
|
|
|
|
toolsclean:
|
|
$(MAKE) -C toolchain clean
|
|
|
|
.PHONY: toolsclean
|
|
|
|
buildworld: $(build)/.built $(plists)
|
|
$(info $(grn)=== World build complete ===$(reset))
|
|
|
|
.PHONY: buildworld
|
|
|
|
strip: $(build)/.stripped
|
|
|
|
.PHONY: strip
|
|
|
|
$(build)/.stripped:
|
|
for dir in $(stripdirs) ; \
|
|
do $(arch)-strip --strip-debug $${dir}/* > \
|
|
/dev/null 2>&1 || true ; done
|
|
touch $@
|
|
|
|
$(build)/.built: $(tooldir)/.built $(build)/.skeleton.built
|
|
$(MAKE) -C world
|
|
find $(build)/lib $(build)/usr/lib $(build)/usr/lib64 -name '*.la' -delete
|
|
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)/$@
|
|
|
|
.PHONY: remove-toolchain
|
|
|
|
toolchain-tgz: toolchain-hhl-$(os_version)-$(arch).tgz
|
|
|
|
toolchain-tbz: toolchain-hhl-$(os_version)-$(arch).tbz
|
|
|
|
toolchain-txz: toolchain-hhl-$(os_version)-$(arch).txz
|
|
|
|
.PHONY: toolchain-tgz toolchain-tbz toolchain-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
|
|
|
|
.PHONY: rootfs-tgz rootfs-tbz rootfs-txz
|
|
|
|
toolchain-hhl-$(os_version)-$(arch).tgz: $(tooldir)/.built smalltools
|
|
cd build && paxtar -M uidgid -czf $(basedir)/$@ toolchain-$(arch)
|
|
|
|
toolchain-hhl-$(os_version)-$(arch).tbz: $(tooldir)/.built smalltools
|
|
cd build && paxtar -M uidgid -cjf $(basedir)/$@ toolchain-$(arch)
|
|
|
|
toolchain-hhl-$(os_version)-$(arch).txz: $(tooldir)/.built smalltools
|
|
cd build && paxtar -M uidgid -cJf $(basedir)/$@ toolchain-$(arch)
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tgz: $(plists) $(build)/.stripped
|
|
cd $(build) && paxtar -M uidgid -czf $(basedir)/$@ $(alldirs)
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tbz: $(plists) $(build)/.stripped
|
|
cd $(build) && paxtar -M uidgid -cjf $(basedir)/$@ $(alldirs)
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).txz: $(plists) $(build)/.stripped
|
|
cd $(build) && paxtar -M uidgid -cJf $(basedir)/$@ $(alldirs)
|
|
|
|
remove-toolchain:
|
|
$(MAKE) -C toolchain remove
|
|
|
|
clean:
|
|
$(MAKE) -C world clean
|
|
$(MAKE) -C toolchain clean
|
|
rm -rf build/*
|
|
rm -rf build/.built
|
|
rm -rf build/.skeleton.built
|
|
rm -rf build/.stripped
|
|
|
|
.PHONY: clean
|