Hitchhiker Linux source tree
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

156 lines
3.8 KiB

# 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
$(info $(grn)=== World build complete ===$(reset))
.PHONY: buildworld
$(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 $@
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)/.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
#su -c "mknod -m 600 $(build)/dev/console c 5 1 && mknod -m 666 $(build)/dev/null c 1 3"
touch $@
$(plists): $(build)/.built $(build)/.kernel.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/src-*
rm -rf build/obj-*
distclean:
$(MAKE) -C world clean
$(MAKE) -C toolchain clean
rm -rf build/*
.PHONY: clean