ref: 9e7b8848343bdb7e2a44c5273dd7766353fdac2e
parent: d53908d15cd69c4a34def3865062f6746b9bb4a9
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Jan 18 16:47:04 EST 2020
libc: Fix multi-conf generation Depending of libc.lst is not a good idea because it is modified by every Makefile. It is much better to depend only of libc.a.
--- a/src/libc/Makefile
+++ b/src/libc/Makefile
@@ -15,10 +15,8 @@
all: $(LIBC)
-$(LIBC): $(LIBCLST)
- mklib -o $@ `cat $(LIBCLST)`
-
-$(LIBCLST): $(DIRS)
+$(LIBC): $(DIRS)
+ mklib -o $@ `cat $(LIBCLST)`;\
$(DIRS): rm-lst
+@cd $@ && $(MAKE)
--- a/src/libc/arch/amd64/Makefile
+++ b/src/libc/arch/amd64/Makefile
@@ -8,7 +8,7 @@
all: $(LIBC) $(SYS)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
$(SYS): FORCE
--- a/src/libc/arch/amd64/darwin/Makefile
+++ b/src/libc/arch/amd64/darwin/Makefile
@@ -30,7 +30,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.$O: ../crt-posix.s
--- a/src/libc/arch/amd64/dragonfly/Makefile
+++ b/src/libc/arch/amd64/dragonfly/Makefile
@@ -31,7 +31,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.$O: ../crt-posix.s
--- a/src/libc/arch/amd64/linux/Makefile
+++ b/src/libc/arch/amd64/linux/Makefile
@@ -32,7 +32,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.$O: ../crt-posix.s
--- a/src/libc/arch/amd64/netbsd/Makefile
+++ b/src/libc/arch/amd64/netbsd/Makefile
@@ -31,7 +31,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.$O: ../crt-posix.s ../../crt-netbsd.s
--- a/src/libc/arch/amd64/openbsd/Makefile
+++ b/src/libc/arch/amd64/openbsd/Makefile
@@ -29,7 +29,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.$O: ../crt-posix.s ../../crt-openbsd.s
--- a/src/libc/arch/arm32/Makefile
+++ b/src/libc/arch/arm32/Makefile
@@ -8,7 +8,7 @@
all: $(LIBC) $(SYS)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
$(SYS): FORCE
--- a/src/libc/arch/arm32/linux/Makefile
+++ b/src/libc/arch/arm32/linux/Makefile
@@ -31,7 +31,7 @@
all: $(LIBC) $(CRT)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
crt.o: ../crt-posix.s
--- a/src/libc/arch/arm64/Makefile
+++ b/src/libc/arch/arm64/Makefile
@@ -8,7 +8,7 @@
all: $(LIBC) $(SYS)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
$(SYS): FORCE
--- a/src/libc/arch/arm64/linux/Makefile
+++ b/src/libc/arch/arm64/linux/Makefile
@@ -3,38 +3,42 @@
include $(PROJECTDIR)/scripts/rules.mk
include ../../../rules.mk
-OBJS = _Exit.o \
- _close.o \
- _brk.o \
- _getpid.o \
- _kill.o \
- _lseek.o \
- _openat.o \
- _read.o \
- _write.o \
- _getheap.o \
- _cerrno.o \
- _open.o \
- _sigaction.o \
- _tzone.o \
- getenv.o \
- raise.o \
- signal.o \
- time.o \
- _sys_errlist.o \
- crt.o \
+GENOBJS =\
+ _Exit.$O\
+ _close.$O\
+ _brk.$O\
+ _getpid.$O\
+ _kill.$O\
+ _lseek.$O\
+ _openat.$O\
+ _read.$O\
+ _write.$O\
+ _sigaction.$O\
-all: syscall
- $(MAKE) objs
+GENSRC = $(GENOBJS:.$O=.s)
-objs: $(OBJS)
+OBJS =\
+ $(GENOBJS)\
+ getenv.$O\
+ raise.$O\
+ signal.$O\
+ time.$O\
+ _tzone.$O\
+ _open.$O\
+ _getheap.$O\
+ _cerrno.$O\
+ _sys_errlist.$O\
-crt.o: ../crt-posix.s
+all: $(LIBC) $(CRT)
-syscall: syscall.lst
- gensys.sh syscall.lst
- touch syscall
+$(LIBC): $(OBJS)
+ $(MKLST)
+crt.$O: ../crt-posix.s
+
+%(GENSRC): syscall.lst
+ gensys.sh $(@:.s=)
+
clean:
- rm -f `awk '/[0-9]* _/ {print $$2".s"}' syscall.lst`
+ rm -f $(GENSRC)
rm -f syscall _sys_errlist.c
--- a/src/libc/arch/i386/Makefile
+++ b/src/libc/arch/i386/Makefile
@@ -8,7 +8,7 @@
all: $(LIBC) $(SYS)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
$(SYS): FORCE
--- a/src/libc/arch/i386/linux/Makefile
+++ b/src/libc/arch/i386/linux/Makefile
@@ -30,7 +30,7 @@
$(LIBCLST): $(OBJS)
$(MKLST)
-crt.o: ../crt-posix.s
+crt.$O: ../crt-posix.s
$(GENSRC): syscall.lst
gensys.sh $(@:.s=)
--- a/src/libc/assert/Makefile
+++ b/src/libc/assert/Makefile
@@ -9,7 +9,7 @@
all: $(LIBC)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
dep: inc-dep
--- a/src/libc/locale/Makefile
+++ b/src/libc/locale/Makefile
@@ -9,7 +9,7 @@
all: $(LIBC)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
dep: inc-dep
--- a/src/libc/rules.mk
+++ b/src/libc/rules.mk
@@ -22,8 +22,6 @@
_sys_errlist.c: $(SYSERRNO)
../../mkerrstr $(SYSERRNO)
-$(LIBC): $(LIBCLST)
-
$(CRT): crt.$O
cp crt.$O $@
--- a/src/libc/stdio/Makefile
+++ b/src/libc/stdio/Makefile
@@ -46,7 +46,7 @@
all: $(LIBC)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
dep: inc-dep
--- a/src/libc/stdlib/Makefile
+++ b/src/libc/stdlib/Makefile
@@ -28,7 +28,7 @@
all: $(LIBC)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
dep: inc-dep
--- a/src/libc/string/Makefile
+++ b/src/libc/string/Makefile
@@ -30,7 +30,7 @@
all: $(LIBC)
-$(LIBCLST): $(OBJS)
+$(LIBC): $(OBJS)
$(MKLST)
dep: inc-dep