ref: 07af36a891fae600532b83aa2b677a8a6041b756
parent: aa783d1f4f3828158b8678e2ba327d91aafca816
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Oct 7 14:56:22 EDT 2021
build: Split proto files Until this moment it was hard to install architectures different than amd64. Having them in the proto file generated errors when they were not compiled, forcing to compile all the architectures always. This is a problem in this stage because we need external toolchains for the libc, incrementing the list of external dependencies. This modification splits the common part and the part that depends of the toolchain used. It only adds the proto for amd64, that is the most common architecture used by the scc developers, but it provides scripts to make easy to update any proto file needed.
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@
PROJECTDIR = .
include $(PROJECTDIR)/scripts/rules.mk
-PREFIX= /usr/local
+PREFIX= $(HOME)
NODEP = 1
all:
@@ -17,7 +17,18 @@
+@PREFIX=$(PREFIX) $(MAKE) `$(SCRIPTDIR)/config` toolchain
+@$(MAKE) `$(SCRIPTDIR)/config` `uname -m`
-x86_64 amd64: FORCE
+install:
+ $(SCRIPTDIR)/install $(PREFIX)
+ +@$(MAKE) install-`uname -m`
+
+uninstall:
+ $(SCRIPTDIR)/uninstall $(PREFIX)
+ +@$(MAKE) uninstall-`uname -m`
+
+#############################################################
+# x86_64 rules
+
+x86_64 amd64:
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-linux libc libcrt
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-openbsd libc libcrt
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-netbsd libc libcrt
@@ -24,37 +35,70 @@
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-dragonfly libc libcrt
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-darwin libc libcrt
-i386: FORCE
+install-x86_64 install-amd64: amd64
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.amd64 $(PREFIX)
+
+uninstall-x86_64 uninstall-amd64:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.amd64 $(PREFIX)
+
+#############################################################
+# i386 rules
+
+i386:
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=i386-linux libc libcrt
-ppc: FORCE
+install-i386: i386
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.i386 $(PREFIX)
+
+uninstall-i386:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.i386 $(PREFIX)
+
+#############################################################
+# ppc rules
+
+ppc:
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=ppc-linux libc libcrt
-arm: FORCE
+install-ppc: ppc
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.ppc $(PREFIX)
+
+uninstall-ppc:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.ppc $(PREFIX)
+
+#############################################################
+# arm rules
+
+arm:
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm-linux libc libcrt
-arm64: FORCE
+install-arm: arm
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm $(PREFIX)
+
+uninstall-arm:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm $(PREFIX)
+
+#############################################################
+# arm64 rules
+
+arm64:
+@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm64-linux libc libcrt
-toolchain: dirs src
+install-arm64: arm64
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm64 $(PREFIX)
+uninstall-arm64:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm64 $(PREFIX)
+
+toolchain: dirs src
libc: dirs src/libc
libcrt: dirs src/libcrt
-
src: include/scc/scc
+tests: all
dirs: $(SCRIPTDIR)/libc-proto
xargs mkdir -p < $(SCRIPTDIR)/libc-proto
touch dirs
-install: all
- $(SCRIPTDIR)/install $(PREFIX)
-
-uninstall:
- $(SCRIPTDIR)/uninstall $(PREFIX)
-
clean:
xargs rm -rf < $(SCRIPTDIR)/libc-proto
rm -f dirs
-
-tests: all
--- a/scripts/install
+++ b/scripts/install
@@ -34,4 +34,4 @@
esac
chmod $perm $prefix/$name
-done < ${proto:-scripts/proto}
+done < ${proto:-scripts/proto.all}
--- /dev/null
+++ b/scripts/mkproto
@@ -1,0 +1,18 @@
+#!/bin/sh
+
+for dir
+do
+ find $dir |
+ while read i
+ do
+ if test -d $i
+ then
+ echo d 755 $i
+ elif test -x $i
+ then
+ echo f 755 $i
+ else
+ echo f 644 $i
+ fi
+ done
+done
--- a/scripts/proto
+++ /dev/null
@@ -1,170 +1,0 @@
-d 755 lib
-d 755 lib/scc
-f 644 lib/scc/libmach.a
-f 644 lib/scc/libscc.a
-d 755 lib/scc/amd64-dragonfly
-f 644 lib/scc/amd64-dragonfly/libc.a
-f 644 lib/scc/amd64-dragonfly/crt.o
-f 644 lib/scc/amd64-dragonfly/libcrt.a
-d 755 lib/scc/amd64-darwin
-f 644 lib/scc/amd64-darwin/libc.a
-f 644 lib/scc/amd64-darwin/crt.o
-f 644 lib/scc/amd64-darwin/libcrt.a
-d 755 lib/scc/amd64-openbsd
-f 644 lib/scc/amd64-openbsd/libc.a
-f 644 lib/scc/amd64-openbsd/crt.o
-f 644 lib/scc/amd64-openbsd/libcrt.a
-d 755 lib/scc/amd64-netbsd
-f 644 lib/scc/amd64-netbsd/libc.a
-f 644 lib/scc/amd64-netbsd/crt.o
-f 644 lib/scc/amd64-netbsd/libcrt.a
-d 755 lib/scc/amd64-linux
-f 644 lib/scc/amd64-linux/libc.a
-f 644 lib/scc/amd64-linux/crt.o
-f 644 lib/scc/amd64-linux/libcrt.a
-d 755 bin
-f 755 bin/ld
-f 755 bin/cpp
-f 755 bin/cc
-f 755 bin/nm
-f 755 bin/objdump
-f 755 bin/addr2line
-f 755 bin/objcopy
-f 755 bin/strip
-f 755 bin/ranlib
-f 755 bin/size
-f 755 bin/ar
-d 755 include
-f 644 include/string.h
-f 644 include/wchar.h
-f 644 include/float.h
-d 755 include/scc
-d 755 include/scc/scc
-f 644 include/scc/scc/ar.h
-d 755 include/scc/scc/coff32
-f 644 include/scc/scc/coff32/linenum.h
-f 644 include/scc/scc/coff32/scnhdr.h
-f 644 include/scc/scc/coff32/filehdr.h
-f 644 include/scc/scc/coff32/aouthdr.h
-f 644 include/scc/scc/coff32/reloc.h
-f 644 include/scc/scc/coff32/syms.h
-f 644 include/scc/scc/scc.h
-f 644 include/scc/scc/mach.h
-f 644 include/limits.h
-f 644 include/wctype.h
-f 644 include/ctype.h
-f 644 include/assert.h
-f 644 include/stdarg.h
-f 644 include/stdlib.h
-f 644 include/signal.h
-f 644 include/math.h
-f 644 include/errno.h
-f 644 include/stdio.h
-f 644 include/stdbool.h
-f 644 include/locale.h
-f 644 include/stddef.h
-f 644 include/setjmp.h
-f 644 include/time.h
-f 644 include/stdint.h
-d 755 include/bits
-d 755 include/bits/darwin
-d 755 include/bits/darwin/sys
-f 644 include/bits/darwin/sys/cdefs.h
-f 644 include/bits/darwin/sys/signal.h
-f 644 include/bits/darwin/sys/errno.h
-f 644 include/bits/darwin/sys.h
-d 755 include/bits/linux
-d 755 include/bits/linux/sys
-f 644 include/bits/linux/sys/cdefs.h
-f 644 include/bits/linux/sys/signal.h
-f 644 include/bits/linux/sys/errno.h
-f 644 include/bits/linux/sys.h
-d 755 include/bits/openbsd
-d 755 include/bits/openbsd/sys
-f 644 include/bits/openbsd/sys/cdefs.h
-f 644 include/bits/openbsd/sys/signal.h
-f 644 include/bits/openbsd/sys/errno.h
-f 644 include/bits/openbsd/sys.h
-d 755 include/bits/dragonfly
-d 755 include/bits/dragonfly/sys
-f 644 include/bits/dragonfly/sys/cdefs.h
-f 644 include/bits/dragonfly/sys/signal.h
-f 644 include/bits/dragonfly/sys/errno.h
-f 644 include/bits/dragonfly/sys.h
-d 755 include/bits/arm
-d 755 include/bits/arm/arch
-f 644 include/bits/arm/arch/cdefs.h
-f 644 include/bits/arm/arch/string.h
-f 644 include/bits/arm/arch/limits.h
-f 644 include/bits/arm/arch/stdlib.h
-f 644 include/bits/arm/arch/stdio.h
-f 644 include/bits/arm/arch/setjmp.h
-f 644 include/bits/arm/arch/time.h
-f 644 include/bits/arm/arch/stdint.h
-d 755 include/bits/ppc
-d 755 include/bits/ppc/arch
-f 644 include/bits/ppc/arch/cdefs.h
-f 644 include/bits/ppc/arch/string.h
-f 644 include/bits/ppc/arch/limits.h
-f 644 include/bits/ppc/arch/stdlib.h
-f 644 include/bits/ppc/arch/stdio.h
-f 644 include/bits/ppc/arch/setjmp.h
-f 644 include/bits/ppc/arch/time.h
-f 644 include/bits/ppc/arch/stdint.h
-d 755 include/bits/z80
-d 755 include/bits/z80/arch
-f 644 include/bits/z80/arch/cdefs.h
-f 644 include/bits/z80/arch/string.h
-f 644 include/bits/z80/arch/limits.h
-f 644 include/bits/z80/arch/stdlib.h
-f 644 include/bits/z80/arch/stdio.h
-f 644 include/bits/z80/arch/time.h
-f 644 include/bits/z80/arch/stdint.h
-d 755 include/bits/arm64
-d 755 include/bits/arm64/arch
-f 644 include/bits/arm64/arch/cdefs.h
-f 644 include/bits/arm64/arch/string.h
-f 644 include/bits/arm64/arch/limits.h
-f 644 include/bits/arm64/arch/stdlib.h
-f 644 include/bits/arm64/arch/stdio.h
-f 644 include/bits/arm64/arch/setjmp.h
-f 644 include/bits/arm64/arch/time.h
-f 644 include/bits/arm64/arch/stdint.h
-d 755 include/bits/amd64
-d 755 include/bits/amd64/arch
-f 644 include/bits/amd64/arch/cdefs.h
-f 644 include/bits/amd64/arch/string.h
-f 644 include/bits/amd64/arch/limits.h
-f 644 include/bits/amd64/arch/stdlib.h
-f 644 include/bits/amd64/arch/stdio.h
-f 644 include/bits/amd64/arch/setjmp.h
-f 644 include/bits/amd64/arch/time.h
-f 644 include/bits/amd64/arch/stdint.h
-d 755 include/bits/netbsd
-d 755 include/bits/netbsd/sys
-f 644 include/bits/netbsd/sys/cdefs.h
-f 644 include/bits/netbsd/sys/signal.h
-f 644 include/bits/netbsd/sys/errno.h
-f 644 include/bits/netbsd/sys.h
-d 755 include/bits/i386
-d 755 include/bits/i386/arch
-f 644 include/bits/i386/arch/cdefs.h
-f 644 include/bits/i386/arch/string.h
-f 644 include/bits/i386/arch/limits.h
-f 644 include/bits/i386/arch/stdlib.h
-f 644 include/bits/i386/arch/stdio.h
-f 644 include/bits/i386/arch/time.h
-f 644 include/bits/i386/arch/stdint.h
-d 755 libexec
-d 755 libexec/scc
-f 755 libexec/scc/as-i386
-f 755 libexec/scc/as-i286
-f 755 libexec/scc/cc2-qbe_amd64-sysv
-f 755 libexec/scc/cc1
-f 755 libexec/scc/as-powerpc64
-f 755 libexec/scc/cc2-i386-sysv
-f 755 libexec/scc/as-powerpc
-f 755 libexec/scc/as-amd64
-f 755 libexec/scc/cc2-amd64-sysv
-f 755 libexec/scc/cc2-z80-scc
-f 755 libexec/scc/as-z80
--- /dev/null
+++ b/scripts/proto.all
@@ -1,0 +1,171 @@
+d 755 bin
+f 755 bin/ld
+f 755 bin/cpp
+f 755 bin/cc
+f 755 bin/nm
+f 755 bin/objdump
+f 755 bin/addr2line
+f 755 bin/objcopy
+f 755 bin/strip
+f 755 bin/ranlib
+f 755 bin/size
+f 755 bin/ar
+d 755 libexec
+d 755 libexec/scc
+f 755 libexec/scc/as-i386
+f 755 libexec/scc/as-i286
+f 755 libexec/scc/cc2-qbe_amd64-sysv
+f 755 libexec/scc/as-powerpc64
+f 755 libexec/scc/cc2-i386-sysv
+f 755 libexec/scc/cc1
+f 755 libexec/scc/as-powerpc
+f 755 libexec/scc/cc2-qbe_arm64-sysv
+f 755 libexec/scc/as-amd64
+f 755 libexec/scc/cc2-amd64-sysv
+f 755 libexec/scc/cc2-z80-scc
+f 755 libexec/scc/as-z80
+d 755 include
+f 644 include/string.h
+f 644 include/wchar.h
+f 644 include/float.h
+f 644 include/iso646.h
+f 644 include/limits.h
+f 644 include/wctype.h
+f 644 include/ctype.h
+f 644 include/assert.h
+f 644 include/stdarg.h
+f 644 include/stdlib.h
+f 644 include/signal.h
+f 644 include/math.h
+f 644 include/errno.h
+f 644 include/stdio.h
+f 644 include/stdbool.h
+f 644 include/inttypes.h
+f 644 include/locale.h
+f 644 include/stddef.h
+f 644 include/setjmp.h
+f 644 include/time.h
+f 644 include/stdint.h
+d 755 include/bits
+d 755 include/bits/arm
+d 755 include/bits/arm/arch
+f 644 include/bits/arm/arch/string.h
+f 644 include/bits/arm/arch/limits.h
+f 644 include/bits/arm/arch/stdlib.h
+f 644 include/bits/arm/arch/setjmp.h
+f 644 include/bits/arm/arch/cdefs.h
+d 755 include/bits/darwin
+d 755 include/bits/darwin/sys
+f 644 include/bits/darwin/sys/stdlib.h
+f 644 include/bits/darwin/sys/signal.h
+f 644 include/bits/darwin/sys/errno.h
+f 644 include/bits/darwin/sys/stdio.h
+f 644 include/bits/darwin/sys/cdefs.h
+d 755 include/bits/darwin/amd64
+d 755 include/bits/darwin/amd64/arch
+f 644 include/bits/darwin/amd64/arch/sigaction.h
+f 644 include/bits/darwin/amd64/arch/time.h
+f 644 include/bits/darwin/amd64/arch/stdint.h
+f 644 include/bits/darwin/sys.h
+d 755 include/bits/linux
+d 755 include/bits/linux/arm
+d 755 include/bits/linux/arm/arch
+f 644 include/bits/linux/arm/arch/time.h
+f 644 include/bits/linux/arm/arch/stdint.h
+d 755 include/bits/linux/sys
+f 644 include/bits/linux/sys/stdlib.h
+f 644 include/bits/linux/sys/signal.h
+f 644 include/bits/linux/sys/errno.h
+f 644 include/bits/linux/sys/stdio.h
+f 644 include/bits/linux/sys/cdefs.h
+d 755 include/bits/linux/ppc
+d 755 include/bits/linux/ppc/arch
+f 644 include/bits/linux/ppc/arch/time.h
+f 644 include/bits/linux/ppc/arch/stdint.h
+d 755 include/bits/linux/arm64
+d 755 include/bits/linux/arm64/arch
+f 644 include/bits/linux/arm64/arch/time.h
+f 644 include/bits/linux/arm64/arch/stdint.h
+d 755 include/bits/linux/amd64
+d 755 include/bits/linux/amd64/arch
+f 644 include/bits/linux/amd64/arch/inttypes.h
+f 644 include/bits/linux/amd64/arch/sigaction.h
+f 644 include/bits/linux/amd64/arch/time.h
+f 644 include/bits/linux/amd64/arch/stdint.h
+f 644 include/bits/linux/sys.h
+d 755 include/bits/openbsd
+d 755 include/bits/openbsd/sys
+f 644 include/bits/openbsd/sys/stdlib.h
+f 644 include/bits/openbsd/sys/signal.h
+f 644 include/bits/openbsd/sys/errno.h
+f 644 include/bits/openbsd/sys/stdio.h
+f 644 include/bits/openbsd/sys/cdefs.h
+d 755 include/bits/openbsd/amd64
+d 755 include/bits/openbsd/amd64/arch
+f 644 include/bits/openbsd/amd64/arch/sigaction.h
+f 644 include/bits/openbsd/amd64/arch/time.h
+f 644 include/bits/openbsd/amd64/arch/stdint.h
+f 644 include/bits/openbsd/sys.h
+d 755 include/bits/dragonfly
+d 755 include/bits/dragonfly/sys
+f 644 include/bits/dragonfly/sys/stdlib.h
+f 644 include/bits/dragonfly/sys/signal.h
+f 644 include/bits/dragonfly/sys/errno.h
+f 644 include/bits/dragonfly/sys/stdio.h
+f 644 include/bits/dragonfly/sys/cdefs.h
+d 755 include/bits/dragonfly/amd64
+d 755 include/bits/dragonfly/amd64/arch
+f 644 include/bits/dragonfly/amd64/arch/sigaction.h
+f 644 include/bits/dragonfly/amd64/arch/time.h
+f 644 include/bits/dragonfly/amd64/arch/stdint.h
+f 644 include/bits/dragonfly/sys.h
+d 755 include/bits/ppc
+d 755 include/bits/ppc/arch
+f 644 include/bits/ppc/arch/string.h
+f 644 include/bits/ppc/arch/limits.h
+f 644 include/bits/ppc/arch/stdlib.h
+f 644 include/bits/ppc/arch/setjmp.h
+f 644 include/bits/ppc/arch/cdefs.h
+d 755 include/bits/z80
+d 755 include/bits/z80/arch
+f 644 include/bits/z80/arch/string.h
+f 644 include/bits/z80/arch/limits.h
+f 644 include/bits/z80/arch/stdlib.h
+f 644 include/bits/z80/arch/setjmp.h
+f 644 include/bits/z80/arch/stdint.h
+f 644 include/bits/z80/arch/cdefs.h
+d 755 include/bits/arm64
+d 755 include/bits/arm64/arch
+f 644 include/bits/arm64/arch/string.h
+f 644 include/bits/arm64/arch/limits.h
+f 644 include/bits/arm64/arch/stdlib.h
+f 644 include/bits/arm64/arch/setjmp.h
+f 644 include/bits/arm64/arch/cdefs.h
+d 755 include/bits/amd64
+d 755 include/bits/amd64/arch
+f 644 include/bits/amd64/arch/string.h
+f 644 include/bits/amd64/arch/limits.h
+f 644 include/bits/amd64/arch/stdlib.h
+f 644 include/bits/amd64/arch/setjmp.h
+f 644 include/bits/amd64/arch/cdefs.h
+d 755 include/bits/netbsd
+d 755 include/bits/netbsd/sys
+f 644 include/bits/netbsd/sys/stdlib.h
+f 644 include/bits/netbsd/sys/signal.h
+f 644 include/bits/netbsd/sys/errno.h
+f 644 include/bits/netbsd/sys/stdio.h
+f 644 include/bits/netbsd/sys/cdefs.h
+d 755 include/bits/netbsd/amd64
+d 755 include/bits/netbsd/amd64/arch
+f 644 include/bits/netbsd/amd64/arch/sigaction.h
+f 644 include/bits/netbsd/amd64/arch/time.h
+f 644 include/bits/netbsd/amd64/arch/stdint.h
+f 644 include/bits/netbsd/sys.h
+d 755 include/bits/i386
+d 755 include/bits/i386/arch
+f 644 include/bits/i386/arch/string.h
+f 644 include/bits/i386/arch/limits.h
+f 644 include/bits/i386/arch/stdlib.h
+f 644 include/bits/i386/arch/setjmp.h
+f 644 include/bits/i386/arch/stdint.h
+f 644 include/bits/i386/arch/cdefs.h
--- /dev/null
+++ b/scripts/proto.amd64
@@ -1,0 +1,22 @@
+d 755 lib
+d 755 lib/scc
+d 755 lib/scc/amd64-darwin
+f 644 lib/scc/amd64-darwin/libc.a
+f 644 lib/scc/amd64-darwin/crt.o
+f 644 lib/scc/amd64-darwin/libcrt.a
+d 755 lib/scc/amd64-dragonfly
+f 644 lib/scc/amd64-dragonfly/libc.a
+f 644 lib/scc/amd64-dragonfly/crt.o
+f 644 lib/scc/amd64-dragonfly/libcrt.a
+d 755 lib/scc/amd64-linux
+f 644 lib/scc/amd64-linux/libc.a
+f 644 lib/scc/amd64-linux/crt.o
+f 644 lib/scc/amd64-linux/libcrt.a
+d 755 lib/scc/amd64-netbsd
+f 644 lib/scc/amd64-netbsd/libc.a
+f 644 lib/scc/amd64-netbsd/crt.o
+f 644 lib/scc/amd64-netbsd/libcrt.a
+d 755 lib/scc/amd64-openbsd
+f 644 lib/scc/amd64-openbsd/libc.a
+f 644 lib/scc/amd64-openbsd/crt.o
+f 644 lib/scc/amd64-openbsd/libcrt.a
--- a/scripts/uninstall
+++ b/scripts/uninstall
@@ -17,11 +17,13 @@
done
prefix=${1?'prefix missed'}
+proto=${proto:-scripts/proto.all}
while read type perm name
do
case $type in
d)
+ echo $type $perm $name
continue
;;
f)
@@ -32,8 +34,8 @@
exit 1
;;
esac
-done < ${proto:-scripts/proto}
-
+done < $proto |
+sort -r |
while read type perm name
do
case $type in
@@ -41,4 +43,4 @@
rmdir $prefix/$name || :
;;
esac
-done < ${proto:-scripts/proto}
+done
--- /dev/null
+++ b/scripts/update-proto.all
@@ -1,0 +1,5 @@
+#!/bin/sh
+
+(scripts/mkproto bin
+ scripts/mkproto libexec
+ scripts/mkproto include | grep -v scc) > scripts/proto.all
--- /dev/null
+++ b/scripts/update-proto.arch
@@ -1,0 +1,7 @@
+#!/bin/sh
+
+arch=${1?'missed architecture parameter'}
+
+(echo d 755 lib
+ echo d 755 lib/scc
+ scripts/mkproto lib/scc/$arch-*) > scripts/proto.$arch