ref: f93bd34d5a4a61ffb5bd6f5bc0150e92e61918f4
parent: 505471768e8e83bfe42d1884dcd7ab038f06a6cc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Aug 24 15:40:36 EDT 2018
[lib/crt] Improve crt Makefiles and add NetBSD crt
--- a/lib/crt/Makefile
+++ b/lib/crt/Makefile
@@ -3,31 +3,12 @@
PROJECTDIR = ../..
include $(PROJECTDIR)/rules.mk
-#TARGETS = $(LIBDIR)/amd64-sysv-linux/crt.o \
-# $(LIBDIR)/amd64-sysv-openbsd/crt.o \
-# $(LIBDIR)/i386-sysv-linux/crt.o \
-# $(LIBDIR)/i386-sysv-openbsd/crt.o \
-# $(LIBDIR)/z80-scc-none/z80-scc-none/crt.o
+DIRS = amd64-sysv-linux amd64-sysv-openbsd amd64-sysv-netbsd
-TARGETS = $(LIBDIR)/amd64-sysv-linux/crt.o
+all: $(DIRS)
-all: $(TARGETS)
+$(DIRS): FORCE
+ @cd $@ && $(MAKE)
-$(LIBDIR)/amd64-sysv-linux/crt.o: amd64-sysv-linux/crt.o
- cp amd64-sysv-linux/crt.o $@
-
-$(LIBDIR)/amd64-sysv-openbsd/crt.o: amd64-sysv-openbsd/crt.o
- cp amd64-sysv-openbsd/crt.o $@
-
-$(LIBDIR)/i386-sysv-linux/crt.o: i386-sysv-linux/crt.o
- cp i386-sysv-linux/crt.o $@
-
-$(LIBDIR)/i386-sysv-openbsd/crt.o: i386-sysv-openbsd/crt.o
- cp i386-sysv-openbsd/crt.o $@
-
-$(LIBDIR)/z80-scc-none/crt.o: z80-scc-none/crt.o
- cp z80-scc-none/crt.o $@
-
clean:
- rm -f */*.o
- rm -f $(TARGETS)
+ $(FORALL)
--- /dev/null
+++ b/lib/crt/amd64-sysv-linux/Makefile
@@ -1,0 +1,9 @@
+.POSIX:
+
+PROJECTDIR = ../../..
+include $(PROJECTDIR)/rules.mk
+
+CRT = $(LIBDIR)/amd64-sysv-linux/crt.o
+TARGETS = $(CRT)
+
+include ../common.mk
--- /dev/null
+++ b/lib/crt/amd64-sysv-netbsd/Makefile
@@ -1,0 +1,9 @@
+.POSIX:
+
+PROJECTDIR = ../../..
+include $(PROJECTDIR)/rules.mk
+
+CRT = $(LIBDIR)/amd64-sysv-netbsd/crt.o
+TARGETS = $(CRT)
+
+include ../common.mk
--- /dev/null
+++ b/lib/crt/amd64-sysv-netbsd/crt.s
@@ -1,0 +1,18 @@
+ .file "crt.s"
+
+ .section ".note.netbsd.ident", "a"
+ .p2align 2
+ .long 8
+ .long 4
+ .long 1
+ .ascii "NetBSD\0"
+ .p2align 2
+ .long 200000000
+
+ .text
+ .align 8
+ .global _start
+_start:
+ call main
+ movl %eax, %edi
+ jp exit
--- /dev/null
+++ b/lib/crt/amd64-sysv-openbsd/Makefile
@@ -1,0 +1,9 @@
+.POSIX:
+
+PROJECTDIR = ../../..
+include $(PROJECTDIR)/rules.mk
+
+CRT = $(LIBDIR)/amd64-sysv-openbsd/crt.o
+TARGETS = $(CRT)
+
+include ../common.mk
--- /dev/null
+++ b/lib/crt/common.mk
@@ -1,0 +1,8 @@
+all: $(TARGETS)
+
+$(CRT): crt.o
+ cp crt.o $@
+
+clean:
+ rm -f *.o
+ rm -f $(TARGETS)
--- /dev/null
+++ b/rootdir/lib/scc/amd64-sysv-netbsd/README
@@ -1,0 +1,1 @@
+This is a placeholder for VCS