ref: c53fa30afa573aa16715f46a379cf8e8d5d5e8a6
parent: 5ab530921869757d383d44ab7918d7080489587f
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Mar 8 05:34:16 EST 2017
[libc] Add support for multisystem We need the system because with only the abi is not enough for library.
--- a/config.mk
+++ b/config.mk
@@ -5,6 +5,7 @@
ARCHS = z80 i386-sysv amd64-sysv qbe
# default architecure used in nested makefiles
ARCH = qbe
+SYS = linux
DRIVER = posix
# Can be c89 or c99
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -2,6 +2,7 @@
.POSIX:
include ../../config.mk
+include sys/$(ARCH)-$(SYS)/system.mk
LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
strrchr.o strcat.o strncmp.o strncpy.o strncat.o strcoll.o \
@@ -14,11 +15,17 @@
printf.o fprintf.o vfprintf.o \
realloc.o calloc.o malloc.o
+OBJ = $(LIBCOBJ) $(SYSOBJ)
+
all: libc.a
-libc.a: $(LIBCOBJ)
+$(SYSOJB):
+ cd sys/$(ARCH)-$(SYS) && make all
+
+libc.a: $(OBJ)
$(AR) $(ARFLAGS) $@ $?
ranlib $@
clean:
rm -f *.o libc.a
+ cd sys/$(ARCH)-$(SYS) && make clean
--- a/libc/src/sys/amd64-linux/Makefile
+++ b/libc/src/sys/amd64-linux/Makefile
@@ -9,12 +9,15 @@
ASM_GEN = $(OBJ_GEN:.o=.s)
OBJ = $(OBJ_GEN)
-all: $(OBJ)
+all: $(OBJ) system.mk
.s.o:
$(AS) $< -o $@
-$(SRC):
+system.mk: Makefile
+ echo '$$(SYSOBJ)' = $(OBJ) > system.mk
+
+$(ASM_GEN): syscall.lst
awk -f syscall.awk < syscall.lst
clean:
--- /dev/null
+++ b/libc/src/sys/amd64-linux/system.mk
@@ -1,0 +1,1 @@
+$(SYSOBJ) = _read.o _write.o _open.o _close.o _lseek.o _brk.o _rt_sigaction.o _getpid.o _Exit.o _kill.o _sbrk.o