commit 169c3b7e5164ef1e5c56a658dd5e83552cc80b04
parent d5f4c9d32392738c76bc040db5569c4f7f443708
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 7 Nov 2022 19:19:27 +0100
build: Split top level makefile
The makefile was too large and with too many details
from the different architectures.
Diffstat:
6 files changed, 52 insertions(+), 71 deletions(-)
diff --git a/Makefile b/Makefile
@@ -8,7 +8,7 @@ DIRS =\
tests\
PROJECTDIR = .
-include $(PROJECTDIR)/scripts/rules.mk
+include scripts/rules.mk
ROOT = $(DESTDIR)$(PREFIX)
NODEP = 1
@@ -28,79 +28,10 @@ uninstall:
$(SCRIPTDIR)/uninstall $(ROOT)
+@$(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
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-dragonfly libc libcrt
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-darwin libc libcrt
-
-install-x86_64 install-amd64: amd64
- $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.amd64 $(ROOT)
-
-uninstall-x86_64 uninstall-amd64:
- $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.amd64 $(ROOT)
-
-#############################################################
-# i386 rules
-
-i386:
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=i386-linux libc libcrt
-
-install-i386: i386
- $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.i386 $(ROOT)
-
-uninstall-i386:
- $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.i386 $(ROOT)
-
-#############################################################
-# ppc rules
-
-ppc:
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=ppc-linux libc libcrt
-
-install-ppc: ppc
- $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.ppc $(ROOT)
-
-uninstall-ppc:
- $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.ppc $(ROOT)
-
-#############################################################
-# arm rules
-
-arm:
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm-linux libc libcrt
-
-install-arm: arm
- $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm $(ROOT)
-
-uninstall-arm:
- $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm $(ROOT)
-
-#############################################################
-# arm64 rules
-
-arm64:
- +@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm64-linux libc libcrt
-
-install-arm64: arm64
- $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm64 $(ROOT)
-
-uninstall-arm64:
- $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm64 $(ROOT)
-
-#############################################################
-
toolchain: src
libc: src/libc
libcrt: src/libcrt
-
-src: include/scc/scc
-
-src: dirs
+src: dirs include/scc/scc
src/libc: dirs
src/libcrt: dirs
@@ -115,3 +46,9 @@ clean:
distclean: clean
rm -f include/scc/scc/sysld.h
rm -f include/scc/scc/sysincludes.h
+
+include scripts/amd64.mk
+include scripts/arm.mk
+include scripts/arm64.mk
+include scripts/i386.mk
+include scripts/ppc.mk
diff --git a/scripts/amd64.mk b/scripts/amd64.mk
@@ -0,0 +1,12 @@
+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
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-dragonfly libc libcrt
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=amd64-darwin libc libcrt
+
+install-x86_64 install-amd64: amd64
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.amd64 $(ROOT)
+
+uninstall-x86_64 uninstall-amd64:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.amd64 $(ROOT)
diff --git a/scripts/arm.mk b/scripts/arm.mk
@@ -0,0 +1,8 @@
+arm:
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm-linux libc libcrt
+
+install-arm: arm
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm $(ROOT)
+
+uninstall-arm:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm $(ROOT)
diff --git a/scripts/arm64.mk b/scripts/arm64.mk
@@ -0,0 +1,8 @@
+arm64:
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=arm64-linux libc libcrt
+
+install-arm64: arm64
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.arm64 $(ROOT)
+
+uninstall-arm64:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.arm64 $(ROOT)
diff --git a/scripts/i386.mk b/scripts/i386.mk
@@ -0,0 +1,8 @@
+i386:
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=i386-linux libc libcrt
+
+install-i386: i386
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.i386 $(ROOT)
+
+uninstall-i386:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.i386 $(ROOT)
diff --git a/scripts/ppc.mk b/scripts/ppc.mk
@@ -0,0 +1,8 @@
+ppc:
+ +@$(MAKE) `$(SCRIPTDIR)/config` CONF=ppc-linux libc libcrt
+
+install-ppc: ppc
+ $(SCRIPTDIR)/install -p $(SCRIPTDIR)/proto.ppc $(ROOT)
+
+uninstall-ppc:
+ $(SCRIPTDIR)/uninstall -p $(SCRIPTDIR)/proto.ppc $(ROOT)