Restructured paths

1. build is in build/$(arch)
2. tooldir is in build/toolchain-$(arch)
3. global_srcdir is in build/src-{world,toolchain}
4. global_objdir is in build/obj-{world,toolchain}
This commit is contained in:
Nathan Fisher 2021-03-02 15:13:26 -05:00
parent 61db92519f
commit a5d0778d53
19 changed files with 233 additions and 231 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ src-files.mk
awkgram.tab.c awkgram.tab.c
awkgram.tab.h awkgram.tab.h
proctab.c proctab.c
*.so
*.so.*
libbz2.so.*

122
Makefile
View File

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

View File

@ -16,9 +16,9 @@ include hhl.colors.mk
endif endif
ifeq ($(filter armv7l aarch64, $(arch)), $(arch)) ifeq ($(filter armv7l aarch64, $(arch)), $(arch))
tgt = ${arch}-unknown-linux-gnueabi tgt = $(arch)-unknown-linux-gnueabi
else else
tgt = ${arch}-unknown-linux-gnu tgt = $(arch)-unknown-linux-gnu
endif endif
ifeq ($(filter armv7l aarch64, $(bld_arch)), $(bld_arch)) ifeq ($(filter armv7l aarch64, $(bld_arch)), $(bld_arch))
@ -50,16 +50,19 @@ man8dir = ${mandir}/man8
distdir = ${basedir}/distfiles distdir = ${basedir}/distfiles
toolchain = ${basedir}/toolchain toolchain = ${basedir}/toolchain
world = ${basedir}/world world = ${basedir}/world
build = ${basedir}/build build = ${basedir}/build/$(arch)
distfullname ?= ${distname}-${${distname}_version} distfullname ?= ${distname}-${${distname}_version}
objdirname ?= ${distfullname} objdirname ?= obj
distext ?= xz distext ?= xz
distfile ?= ${distfullname}.tar.${distext} distfile ?= ${distfullname}.tar.${distext}
distlocal ?= ${distdir}/${distfile} distlocal ?= ${distdir}/${distfile}
wkgdir = $(shell pwd) wkgdir = $(shell pwd)
srcdir ?= ${global_srcdir}/${distfullname} srcdir ?= $(global_srcdir)/$(distfullname)
objdir ?= $(global_objdir)/$(distfullname)
tooldir = $(basedir)/build/toolchain-$(arch)
export LC_ALL = POSIX export LC_ALL = POSIX
export PATH = $(tooldir)/bin:$(tooldir)/sbin:/usr/bin:/usr/sbin:/bin:/sbin
_dhcpcd ?= 1 _dhcpcd ?= 1
_wireless ?= 1 _wireless ?= 1
@ -67,47 +70,43 @@ _wireless ?= 1
use_configure ?= 1 use_configure ?= 1
no_objdir ?= 0 no_objdir ?= 0
ifeq (${use_configure},1) ifeq ($(use_configure),1)
config_tgt ?= ${objdir}/Makefile config_tgt ?= $(objdir)/Makefile
config_deps += ${srcdir}/.dirstamp config_deps += $(srcdir)/.dirstamp
config_opts ?= --prefix=${install_prefix} config_opts ?= --prefix=$(install_prefix)
config_cmd ?= cd ${objdir} && ${srcdir}/configure ${config_opts} config_cmd ?= cd $(objdir) && $(srcdir)/configure $(config_opts)
build_deps ?= ${config_tgt} build_deps ?= $(config_tgt)
else else
build_deps ?= ${config_deps} build_deps ?= $(config_deps)
build_deps += ${srcdir}/.dirstamp build_deps += $(srcdir)/.dirstamp
endif endif
build_cmd ?= $(MAKE) ${makeflags} -C ${objdir} build_cmd ?= $(MAKE) $(makeflags) -C $(objdir)
install_deps ?= ${objdir}/.built install_deps ?= $(objdir)/.built
install_cmd ?= $(MAKE) ${makeflags} -C ${objdir} install install_cmd ?= $(MAKE) $(makeflags) -C $(objdir) install
all_deps ?= ${objdir}/.built all_deps ?= $(objdir)/.built
ifndef internal ifeq ($(no_objdir),1)
stamps ?= ${config_tgt} ${objdir}/.built ${objdir}/.installed objdir = $(srcdir)
endif
ifeq (${no_objdir},1)
objdir = ${srcdir}
else else
pre_dirs += ${objdir} pre_dirs += $(objdir)
endif endif
ifdef patches ifdef patches
config_deps += ${patches} ${srcdir}/.patched config_deps += $(patches) $(srcdir)/.patched
endif endif
stripdirs += ${build}/lib stripdirs += $(build)/lib
stripdirs += ${build}/usr/lib stripdirs += $(build)/usr/lib
stripdirs += ${build}/bin stripdirs += $(build)/bin
stripdirs += ${build}/sbin stripdirs += $(build)/sbin
stripdirs += ${build}/bin stripdirs += $(build)/bin
stripdirs += ${build}/sbin stripdirs += $(build)/sbin
stripdirs += ${build}/usr/bin stripdirs += $(build)/usr/bin
stripdirs += ${build}/usr/sbin stripdirs += $(build)/usr/sbin
stripdirs += ${build}/usr/bin stripdirs += $(build)/usr/bin
stripdirs += ${build}/usr/sbin stripdirs += $(build)/usr/sbin
${basedir}/config.mk: $(basedir)/config.mk:
cp $(basedir)/config.mk.sample $(basedir)/config.mk cp $(basedir)/config.mk.sample $(basedir)/config.mk
.DEFAULT_GOAL = ${default_goal} .DEFAULT_GOAL = $(default_goal)

View File

@ -8,26 +8,30 @@ else
clean_cmd ?= rm -rf $(objdir) clean_cmd ?= rm -rf $(objdir)
endif endif
distclean_cmd ?= rm -rf ${objdir} ${srcdir} ${stamps} distclean_cmd ?= rm -rf $(objdir) $(srcdir)
ifeq (${distext},gz) ifeq ($(distext),gz)
tarflags += -xzf tarflags += -xzf
endif endif
ifeq (${distext},bz2) ifeq ($(distext),bz2)
tarflags += -xjf tarflags += -xjf
endif endif
ifeq (${distext},xz) ifeq ($(distext),xz)
tarflags += -xJf tarflags += -xJf
endif endif
install_cmd ?= $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) install install_cmd ?= $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) install
all: ${all_deps} all: $(all_deps)
install: ${objdir}/.installed .PHONY: all
install: $(objdir)/.installed
$(info $(grn)=== $(distfullname) installed ===$(reset)) $(info $(grn)=== $(distfullname) installed ===$(reset))
${objdir}/.installed: ${install_deps} .PHONY: install
$(objdir)/.installed: $(install_deps)
$(info $(grn)=== $(distfullname) built ===$(reset)) $(info $(grn)=== $(distfullname) built ===$(reset))
$(info $(grn)=== Installing for $(distfullname) ===$(reset)) $(info $(grn)=== Installing for $(distfullname) ===$(reset))
$(pre_install) $(pre_install)
@ -35,9 +39,6 @@ ${objdir}/.installed: ${install_deps}
$(post_install) $(post_install)
touch $@ touch $@
installclean:
$(MAKE) install clean
$(installdirs): $(installdirs):
install -d $@ install -d $@
@ -61,13 +62,13 @@ $(srcdir)/.patched: $(patches) $(srcdir)/.dirstamp
patch -p1 < $(wkgdir)/$${patch} ; done patch -p1 < $(wkgdir)/$${patch} ; done
touch ${srcdir}/.patched touch ${srcdir}/.patched
$(srcdir)/.dirstamp: $(distlocal) $(srcdir)/.dirstamp: $(distlocal) | $(tooldir)
$(info $(grn)=== Extracting $(distlocal) ===$(reset)) $(info $(grn)=== Extracting $(distlocal) ===$(reset))
tar $(tarflags) $(distlocal) -C $(global_srcdir) tar $(tarflags) $(distlocal) -C $(global_srcdir)
touch $@ touch $@
ifneq (${no_objdir},1) ifneq ($(no_objdir),1)
${objdir}: $(objdir):
install -d $@ install -d $@
endif endif
@ -80,28 +81,7 @@ clean:
$(clean_cmd) $(clean_cmd)
distclean: clean distclean: clean
${distclean_cmd} $(distclean_cmd)
remove-objs:
rm -rf ${objs} || true
remove-srcdir:
rm -rf ${srcdir} || true
remove-objdir:
rm -rf ${objdir} || true
remove: remove-objs remove-srcdir remove-objdir
.PHONY: \
all \
install \
installclean \
finish \
clean \
distclean \
remove-objs \
remove-objdir \
remove-srcdir \
remove
.PHONY: clean
.PHONY: distclean

View File

@ -2,18 +2,14 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
install_prefix = /toolchain install_prefix = $(tooldir)
confdir ?= ${install_prefix}/etc confdir ?= $(install_prefix)/etc
localstatedir ?= ${install_prefix}/var localstatedir ?= $(install_prefix)/var
logdir ?= ${localstatedir}/log logdir ?= $(localstatedir)/log
global_srcdir = /src/build/src
global_objdir = /src/build/obj
export PATH = /toolchain/bin:/usr/bin:/bin:/toolchain/sbin:/usr/sbin:/sbin
default_goal ?= install default_goal ?= install
include src-config.mk global_srcdir = $(basedir)/build/src-toolchain
objdir ?= ${global_objdir}/${objdirname}-toolchain global_objdir = $(basedir)/build/obj-toolchain
include src-config.mk

View File

@ -1,21 +1,16 @@
# world.mk - mk - /usr/include/mk # world.mk - mk - /usr/include/mk
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
DESTDIR ?= /src/build DESTDIR ?= $(build)
export DESTDIR export DESTDIR
global_srcdir ?= /src/build/src
global_objdir ?= /src/build/obj
#config_opts += --cache-file=$(global_objdir)/config.cache
install_cmd ?= $(MAKE) $(makeflags) DESTDIR=$(DESTDIR) -C $(objdir) install install_cmd ?= $(MAKE) $(makeflags) DESTDIR=$(DESTDIR) -C $(objdir) install
install_prefix ?= /usr install_prefix ?= /usr
confdir ?= ${DESTDIR}/etc confdir ?= $(DESTDIR)/etc
localstatedir ?= ${DESTDIR}/var localstatedir ?= $(DESTDIR)/var
logdir ?= ${DESTDIR}/var/log logdir ?= $(DESTDIR)/var/log
export PATH = /toolchain/bin:/toolchain/sbin:/usr/bin:/usr/sbin:/bin:/sbin ifeq ($(doinstall),false)
ifeq (${doinstall},false)
default_goal ?= all default_goal ?= all
endif endif
@ -25,5 +20,7 @@ else
default_goal ?= finish default_goal ?= finish
endif endif
global_srcdir = $(basedir)/build/src-world
global_objdir = $(basedir)/build/obj-world
include src-config.mk include src-config.mk
objdir ?= ${global_objdir}/${objdirname}-world

View File

@ -1,4 +1,4 @@
# Makefile - hhl - /usr/src/toolchain # Makefile - hhl - /src/toolchain
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
@ -23,7 +23,7 @@ subdirs += linux-headers
subdirs += glibc subdirs += glibc
subdirs += gcc-pass2 subdirs += gcc-pass2
installdirs += $(build)/toolchain $(build)/src $(build)/obj installdirs += $(tooldir) $(global_srcdir) $(global_objdir)
all: $(subdirs) reduce-size all: $(subdirs) reduce-size
$(info $(grn)=== Temporary toolchain built ===$(reset)) $(info $(grn)=== Temporary toolchain built ===$(reset))
@ -43,31 +43,31 @@ distclean: clean
do $(MAKE) -C $${subdir} distclean ; done do $(MAKE) -C $${subdir} distclean ; done
strip: strip:
strip --strip-debug /toolchain/lib/* > /dev/null 2>&1 || true strip --strip-debug $(tooldir)/lib/* > /dev/null 2>&1 || true
/usr/bin/strip --strip-unneeded /toolchain/bin/*> /dev/null 2>&1 || true /usr/bin/strip --strip-unneeded $(tooldir)/bin/*> /dev/null 2>&1 || true
/usr/bin/strip --strip-unneeded /toolchain/sbin/*> /dev/null 2>&1 || true /usr/bin/strip --strip-unneeded $(tooldir)/sbin/*> /dev/null 2>&1 || true
/usr/bin/strip --strip-unneeded /toolchain/libexec/gcc/*/${gcc_version}/* || true /usr/bin/strip --strip-unneeded $(tooldir)/libexec/gcc/*/${gcc_version}/* || true
/usr/bin/strip --strip-debug /toolchain/bin/*> /dev/null 2>&1 || true /usr/bin/strip --strip-debug $(tooldir)/bin/*> /dev/null 2>&1 || true
/usr/bin/strip --strip-debug /toolchain/sbin/*> /dev/null 2>&1 || true /usr/bin/strip --strip-debug $(tooldir)/sbin/*> /dev/null 2>&1 || true
/usr/bin/strip --strip-debug /toolchain/libexec/gcc/*/${gcc_version}/* || true /usr/bin/strip --strip-debug $(tooldir)/libexec/gcc/*/$(gcc_version)/* || true
removedoc: removedoc:
rm -rf /toolchain/doc rm -rf $(tooldir)/doc
rm -rf /toolschain/info rm -rf $(tooldir)/info
rm -rf /toolchain/man rm -rf $(tooldir)/man
rm -rf /toolchain/share/doc rm -rf $(tooldir)/share/doc
rm -rf /toolschain/share/info rm -rf $(tooldir)/share/info
rm -rf /toolchain/share/man rm -rf $(tooldir)/share/man
remove-la: remove-la:
find /toolchain/lib /toolchain/libexec -name '*.la' -delete find $(tooldir)/lib $(tooldir)/libexec -name '*.la' -delete
reduce-size: strip removedoc remove-la reduce-size: strip removedoc remove-la
remove: distclean remove: distclean
for subdir in ${subdirs} ; \ for subdir in ${subdirs} ; \
do $(MAKE) -C $${subdir} remove ; done do $(MAKE) -C $${subdir} remove ; done
rm -rf /toolchain/* .built rm -rf $(tooldir)/* .built
.PHONY: \ .PHONY: \
all \ all \

View File

@ -2,22 +2,21 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
distname = binutils distname = binutils
objdirname = binutils-pass1
include toolchain.mk include toolchain.mk
config_opts += --with-sysroot=${build} config_opts += --with-sysroot=$(build)
config_opts += --target=${tgt} config_opts += --target=$(tgt)
config_opts += --disable-nls config_opts += --disable-nls
config_opts += --disable-werror config_opts += --disable-werror
ifeq (${arch}, x86_64) ifeq ($(arch), x86_64)
install: | /toolchain/lib64 install: | $(tooldir)/lib64
else ifeq (${arch}, riscv64) else ifeq ($(arch), riscv64)
install: | /toolchain/lib64 install: | $(tooldir)/lib64
endif endif
include targets.mk include targets.mk
/toolchain/lib64: $(tooldir)/lib64:
install -d /toolchain/lib install -d $(tooldir)/lib
ln -s lib /toolchain/lib64 ln -s lib $(toolcdir)/lib64

View File

@ -7,12 +7,12 @@ include ../../config.mk
ifeq ($(filter x86_64 aarch64 riscv64, $(arch)), $(arch)) ifeq ($(filter x86_64 aarch64 riscv64, $(arch)), $(arch))
patches += gcc-lib64.patch patches += gcc-lib64.patch
endif endif
objdirname = gcc-pass1 objdir = $(global_objdir)/gcc-pass1
include toolchain.mk include toolchain.mk
srcdirs += ${srcdir}/mpfr srcdirs += $(srcdir)/mpfr
srcdirs += ${srcdir}/gmp srcdirs += $(srcdir)/gmp
srcdirs += ${srcdir}/mpc srcdirs += $(srcdir)/mpc
config_opts += --target=$(tgt) config_opts += --target=$(tgt)
config_opts += --with-glibc-version=2.11 config_opts += --with-glibc-version=2.11
@ -36,18 +36,18 @@ include targets.mk
$(config_tgt): | $(srcdirs) $(config_tgt): | $(srcdirs)
${srcdir}/mpfr: | ${srcdir} $(srcdir)/mpfr: | $(srcdir)
$(MAKE) -C ${distdir} mpfr $(MAKE) -C $(distdir) mpfr
tar -xJf ${distdir}/mpfr-${mpfr_version}.tar.xz -C ${srcdir} tar -xJf $(distdir)/mpfr-$(mpfr_version).tar.xz -C $(srcdir)
mv ${srcdir}/mpfr-${mpfr_version} ${srcdir}/mpfr mv $(srcdir)/mpfr-$(mpfr_version) $(srcdir)/mpfr
${srcdir}/gmp: | ${srcdir} $(srcdir)/gmp: | $(srcdir)
$(MAKE) -C ${distdir} gmp $(MAKE) -C $(distdir) gmp
tar -xJf ${distdir}/gmp-${gmp_version}.tar.xz -C ${srcdir} tar -xJf $(distdir)/gmp-$(gmp_version).tar.xz -C $(srcdir)
mv ${srcdir}/gmp-${gmp_version} ${srcdir}/gmp mv $(srcdir)/gmp-$(gmp_version) $(srcdir)/gmp
${srcdir}/mpc: | ${srcdir} $(srcdir)/mpc: | $(srcdir)
$(MAKE) -C ${distdir} mpc $(MAKE) -C $(distdir) mpc
tar -xzf ${distdir}/mpc-${mpc_version}.tar.gz -C ${srcdir} tar -xzf $(distdir)/mpc-$(mpc_version).tar.gz -C $(srcdir)
mv ${srcdir}/mpc-${mpc_version} ${srcdir}/mpc mv $(srcdir)/mpc-$(mpc_version) $(srcdir)/mpc

View File

@ -2,8 +2,8 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
distname = gcc distname = gcc
objdirname = gcc-pass2
include toolchain.mk include toolchain.mk
objdir = $(global_objdir)/gcc-pass2
config_opts += --target=$(tgt) config_opts += --target=$(tgt)
config_opts += --with-sysroot=$(build) config_opts += --with-sysroot=$(build)
config_opts += --enable-languages=c,c++ config_opts += --enable-languages=c,c++

View File

@ -16,14 +16,14 @@ config_opts += --disable-werror
config_opts += --enable-stack-protector=strong config_opts += --enable-stack-protector=strong
config_opts += libc_cv_slibdir=/lib config_opts += libc_cv_slibdir=/lib
ifeq (${arch},x86_64) ifeq ($(arch),x86_64)
define makelinks define makelinks
ln -sfv ../lib/ld-linux-x86-64.so.2 $(DESTDIR)/lib64 ln -sfv ../lib/ld-linux-x86-64.so.2 $(DESTDIR)/lib64
ln -sfv ../lib/ld-linux-x86-64.so.2 $(DESTDIR)/lib64/ld-lsb-x86-64.so.3 ln -sfv ../lib/ld-linux-x86-64.so.2 $(DESTDIR)/lib64/ld-lsb-x86-64.so.3
endef endef
else ifeq (${arch},armv7l) else ifeq ($(arch),armv7l)
makelinks = ln -sfv ld-2.31.so $(DESTDIR)/lib/ld-linux.so.3 makelinks = ln -sfv ld-2.31.so $(DESTDIR)/lib/ld-linux.so.3
else ifeq (${arch},riscv64) else ifeq ($(arch),riscv64)
makelinks = ln -sfv ../lib/ld-linux-riscv64-lp64d.so.1 $(DESTDIR)/lib64 makelinks = ln -sfv ../lib/ld-linux-riscv64-lp64d.so.1 $(DESTDIR)/lib64
endif endif
@ -36,18 +36,22 @@ define makelocales
$$(echo $${l} | cut -f 2 -d '.') $${l} --prefix=$(DESTDIR) ; done $$(echo $${l} | cut -f 2 -d '.') $${l} --prefix=$(DESTDIR) ; done
endef endef
else else
makelocales = $(MAKE) DESTDIR=$(DESTDIR) -C ${objdir} localedata/install-locales makelocales = $(MAKE) DESTDIR=$(DESTDIR) -C $(objdir) localedata/install-locales
endif endif
define post_install define post_install
${makelinks} ${makelinks}
install -d $(DESTDIR)/var/cache/nscd install -d $(DESTDIR)/var/cache/nscd
install -m0644 ${srcdir}/nscd/nscd.conf $(DESTDIR)/etc install -m0644 $(srcdir)/nscd/nscd.conf $(DESTDIR)/etc
install -m0644 ${wkgdir}/etc/nsswitch.conf $(DESTDIR)/etc install -m0644 $(wkgdir)/etc/nsswitch.conf $(DESTDIR)/etc
install -m0644 ${wkgdir}/etc/ld.so.conf $(DESTDIR)/etc install -m0644 $(wkgdir)/etc/ld.so.conf $(DESTDIR)/etc
${makelocales} $(makelocales)
endef endef
include targets.mk include targets.mk
$(srcdir)/.dirstamp: | $(global_srcdir)
$(global_srcdir):
install -d $@

View File

@ -2,9 +2,9 @@
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
distname = linux distname = linux
config_tgt = ${objdir}/.configured config_tgt = $(objdir)/.configured
include toolchain.mk include toolchain.mk
config_cmd = $(MAKE) -C ${srcdir} mrproper config_cmd = $(MAKE) -C $(srcdir) mrproper
ifeq ($(arch), armv7l) ifeq ($(arch), armv7l)
export ARCH=arm export ARCH=arm
else ifeq ($(arch), aarch64) else ifeq ($(arch), aarch64)
@ -14,14 +14,14 @@ export ARCH=riscv
else ifeq ($(arch), risv32) else ifeq ($(arch), risv32)
export ARCH=riscv export ARCH=riscv
endif endif
build_cmd = KBUILD_OUTPUT=${objdir} $(MAKE) -C ${srcdir} headers build_cmd = KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) headers
define post_build define post_build
find ${objdir}/usr/include -name '.*' -delete find $(objdir)/usr/include -name '.*' -delete
rm -rf ${objdir}/usr/include/Makefile || true rm -rf $(objdir)/usr/include/Makefile || true
install -d $(build)/usr/include install -d $(build)/usr/include
endef endef
install_cmd = cp -r ${objdir}/usr/include/* $(build)/usr/include install_cmd = cp -r $(objdir)/usr/include/* $(build)/usr/include
clean_cmd = KBUILD_OUTPUT=${objdir} $(MAKE) -C ${srcdir} clean clean_cmd = KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) clean
distclean_cmd = KBUILD_OUTPUT=${objdir} $(MAKE) -C ${srcdir} distclean distclean_cmd = KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) distclean
include targets.mk include targets.mk

View File

@ -3,7 +3,7 @@
# #
include ../../config.mk include ../../config.mk
progname = paxtar progname = paxtar
bindir = /toolchain/bin bindir = $(tooldir)/bin
src = $(basedir)/world/bin/pax/src src = $(basedir)/world/bin/pax/src
cflags += -O2 cflags += -O2
@ -13,10 +13,9 @@ cflags += -fstack-protector-strong
cflags += -Wall cflags += -Wall
cflags += -fwrapv cflags += -fwrapv
objdir ?= ${global_objdir}/${progname} srcs += $(wildcard $(src)/*.c)
srcs += $(wildcard ${src}/*.c) objs += $(patsubst $(src)/%.c,$(objdir)/%.o,$(srcs))
objs += $(patsubst ${src}/%.c,${objdir}/%.o,${srcs}) hdrs += $(wildcard $(src)/*.h)
hdrs += $(wildcard ${src}/*.h)
include world.mk include world.mk
install: $(bindir)/$(progname) install: $(bindir)/$(progname)

View File

@ -5,17 +5,17 @@ distname = perl
export BUILD_ZLIB = False export BUILD_ZLIB = False
export BUILD_BZIP2 = 0 export BUILD_BZIP2 = 0
include toolchain.mk
config_opts = -des config_opts = -des
config_opts += -Dmksymlinks config_opts += -Dmksymlinks
config_opts += -Dprefix=/toolchain config_opts += -Dprefix=$(tooldir)
config_opts += -Dvendorprefix=/usr config_opts += -Dvendorprefix=/usr
config_opts += -Dman1dir=/toolchain/share/man/man1 config_opts += -Dman1dir=$(tooldir)/share/man/man1
config_opts += -Dman3dir=/toolchain/share/man/man3 config_opts += -Dman3dir=$(tooldir)/share/man/man3
config_opts += -Duseshrplib config_opts += -Duseshrplib
config_opts += -Dusethreads config_opts += -Dusethreads
include toolchain.mk
config_cmd = cd $(objdir) && $(srcdir)/Configure $(config_opts) config_cmd = cd $(objdir) && $(srcdir)/Configure $(config_opts)
include targets.mk include targets.mk

View File

@ -100,16 +100,11 @@ subdirs += libnl
subdirs += wpa_supplicant subdirs += wpa_supplicant
endif endif
installdirs = $(build)/src $(build)/obj
all: $(subdirs) all: $(subdirs)
$(subdirs): | $(installdirs) $(subdirs):
$(MAKE) -C $@ $(MAKE) -C $@
$(installdirs):
install -d $@
clean: clean:
for subdir in $(subdirs) ; \ for subdir in $(subdirs) ; \
do $(MAKE) -C $${subdir} clean ; done do $(MAKE) -C $${subdir} clean ; done
@ -118,4 +113,4 @@ distclean: clean
for subdir in $(subdirs) ; \ for subdir in $(subdirs) ; \
do $(MAKE) -C $${subdir} distclean ; done do $(MAKE) -C $${subdir} distclean ; done
.PHONY: ${subdirs} all clean distclean .PHONY: $(subdirs) all clean distclean

Binary file not shown.

View File

@ -1,4 +1,4 @@
# Makefile - hhl - /usr/src/world/mandoc # Makefile - hhl - /src/world/mandoc
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com> # Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
# #
distname = mandoc distname = mandoc

View File

@ -2,7 +2,7 @@ BUILD_TARGETS =
INSTALL_TARGETS = INSTALL_TARGETS =
CC = $(tgt_cc) CC = $(tgt_cc)
CFLAGS = -g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter CFLAGS = -g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter
CFLAGS += --sysroot=/src/build CFLAGS += --sysroot=$(DESTDIR)
LDADD = -lz LDADD = -lz
LDFLAGS = LDFLAGS =
STATIC = -static STATIC = -static

View File

@ -7,7 +7,7 @@ no_objdir = 1
use_configure = 0 use_configure = 0
include world.mk include world.mk
export CC = $(tgt)-gcc export CC = $(tgt)-gcc
export CFLAGS = --sysroot=/src/build -Wall -O2 export CFLAGS = --sysroot=$(build) -Wall -O2
install_cmd = $(MAKE) prefix=/usr DESTDIR=$(DESTDIR) -C $(srcdir) install install_cmd = $(MAKE) prefix=/usr DESTDIR=$(DESTDIR) -C $(srcdir) install
define post_install define post_install