2021-03-02 15:13:26 -05:00
|
|
|
# Makefile - hhl - /src
|
2021-02-18 19:41:59 -05:00
|
|
|
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
|
|
|
|
#
|
|
|
|
include src-config.mk
|
|
|
|
uid = $(shell id -u)
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
include_dir = /src/include/mk
|
2021-02-18 19:41:59 -05:00
|
|
|
make_includes += $(wildcard $(include_dir)/*.mk)
|
|
|
|
|
|
|
|
pkgdbdir = $(build)/var/db/pkg/base
|
2021-03-02 15:13:26 -05:00
|
|
|
plists += $(pkgdbdir)/plist
|
|
|
|
plists += $(pkgdbdir)/etc.plist
|
|
|
|
|
|
|
|
dirs += dev
|
|
|
|
dirs += proc
|
|
|
|
dirs += run
|
|
|
|
dirs += sys
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
ifeq ($(arch),x86_64)
|
|
|
|
dirs += lib64
|
|
|
|
endif
|
2021-03-02 15:13:26 -05:00
|
|
|
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
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
all: buildworld
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: all
|
2021-02-18 19:41:59 -05:00
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
buildtools: $(tooldir)/.built
|
2021-02-18 19:41:59 -05:00
|
|
|
$(info $(grn)=== Temporary toolchain build ===$(reset))
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: buildtools
|
|
|
|
|
|
|
|
$(tooldir)/.built: config.mk | $(dirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
$(info $(grn)=== Building temporary toolchain ===$(reset))
|
|
|
|
$(MAKE) -C toolchain
|
|
|
|
touch $@
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
smalltools: $(tooldir)/.built
|
|
|
|
$(MAKE) -C toolchain reduce-size
|
|
|
|
|
|
|
|
.PHONY: smalltools
|
|
|
|
|
2021-02-18 19:41:59 -05:00
|
|
|
toolsclean:
|
|
|
|
$(MAKE) -C toolchain clean
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: toolsclean
|
2021-02-18 19:41:59 -05:00
|
|
|
|
2021-03-21 01:01:32 -04:00
|
|
|
buildworld: $(build)/.built
|
2021-02-18 19:41:59 -05:00
|
|
|
$(info $(grn)=== World build complete ===$(reset))
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: buildworld
|
|
|
|
|
2021-03-21 01:01:32 -04:00
|
|
|
$(build)/.built: $(tooldir)/.built $(build)/.skeleton.built
|
|
|
|
$(MAKE) -C world
|
|
|
|
find $(build)/lib $(build)/usr/lib $(build)/usr/lib64 -name '*.la' -delete
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
buildkernel: $(build)/.kernel.built
|
|
|
|
$(info $(grn)=== Kernel build complete ===$(reset))
|
|
|
|
|
|
|
|
.PHONY: buildkernel
|
|
|
|
|
|
|
|
$(build)/.kernel.built:
|
|
|
|
$(MAKE) -C kernel
|
|
|
|
touch $@
|
|
|
|
|
2021-02-18 19:41:59 -05:00
|
|
|
strip: $(build)/.stripped
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: strip
|
|
|
|
|
2021-02-18 19:41:59 -05:00
|
|
|
$(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 $@
|
|
|
|
|
|
|
|
$(build)/.skeleton.built: | $(dirs)
|
2021-03-02 15:13:26 -05:00
|
|
|
install -d -m 0750 $(build)/root
|
|
|
|
install -dv -m 1777 $(build)/tmp $(build)/var/tmp
|
2021-03-06 08:04:58 -05:00
|
|
|
[ -h $(build)/var/run ] || ln -sv /run $(build)/var/run
|
|
|
|
[ -h $(build)/var/lock ] || ln -sv /run/lock $(build)/var/lock
|
2021-03-10 13:53:36 -05:00
|
|
|
#su -c "mknod -m 600 $(build)/dev/console c 5 1 && mknod -m 666 $(build)/dev/null c 1 3"
|
2021-02-18 19:41:59 -05:00
|
|
|
touch $@
|
|
|
|
|
2021-03-21 01:01:32 -04:00
|
|
|
$(plists): $(build)/.built $(build)/.kernel.built
|
2021-02-18 19:41:59 -05:00
|
|
|
$(info $(grn)=== Creating plist ===$(reset))
|
|
|
|
pkgname=base $(MAKE) -C $(build) -f $(include_dir)/create-plist.mk install
|
|
|
|
|
|
|
|
$(dirs):
|
2021-03-02 15:13:26 -05:00
|
|
|
install -d $(build)/$@
|
2021-02-18 19:41:59 -05:00
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.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
|
2021-03-04 14:33:49 -05:00
|
|
|
cd build && paxtar -M uidgid -czf $(basedir)/$@ toolchain-$(arch)
|
2021-03-02 15:13:26 -05:00
|
|
|
|
|
|
|
toolchain-hhl-$(os_version)-$(arch).tbz: $(tooldir)/.built smalltools
|
2021-03-04 14:33:49 -05:00
|
|
|
cd build && paxtar -M uidgid -cjf $(basedir)/$@ toolchain-$(arch)
|
2021-03-02 15:13:26 -05:00
|
|
|
|
|
|
|
toolchain-hhl-$(os_version)-$(arch).txz: $(tooldir)/.built smalltools
|
2021-03-04 14:33:49 -05:00
|
|
|
cd build && paxtar -M uidgid -cJf $(basedir)/$@ toolchain-$(arch)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tgz: $(plists) $(build)/.stripped
|
2021-03-04 09:23:50 -05:00
|
|
|
cd $(build) && paxtar -M uidgid -czf $(basedir)/$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).tbz: $(plists) $(build)/.stripped
|
2021-03-04 09:23:50 -05:00
|
|
|
cd $(build) && paxtar -M uidgid -cjf $(basedir)/$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
|
|
|
rootfs-hhl-$(os_version)-$(arch).txz: $(plists) $(build)/.stripped
|
2021-03-04 09:23:50 -05:00
|
|
|
cd $(build) && paxtar -M uidgid -cJf $(basedir)/$@ $(alldirs)
|
2021-02-18 19:41:59 -05:00
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
remove-toolchain:
|
|
|
|
$(MAKE) -C toolchain remove
|
|
|
|
|
2021-02-18 19:41:59 -05:00
|
|
|
clean:
|
2021-03-10 13:53:36 -05:00
|
|
|
$(MAKE) -C world clean
|
|
|
|
$(MAKE) -C toolchain clean
|
|
|
|
rm -rf build/src-*
|
|
|
|
rm -rf build/obj-*
|
|
|
|
|
|
|
|
distclean:
|
2021-02-18 19:41:59 -05:00
|
|
|
$(MAKE) -C world clean
|
|
|
|
$(MAKE) -C toolchain clean
|
|
|
|
rm -rf build/*
|
|
|
|
|
2021-03-02 15:13:26 -05:00
|
|
|
.PHONY: clean
|