scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit eb87d4b236cfc5067ca813eee99f8ed392325ee4
parent 7d4935f67a93400ffd2d3f1ce38ad574dae53ba6
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 30 May 2021 16:43:03 +0200

build: Simplify the libc build system

The build system was too complex and needed several layers
of recursive Makefiles. This new version tries to simplify
it just using a list of objects predefined, instead of
trying to generate it dynamically.

Diffstat:
MMakefile | 14+++-----------
Adeps.mk | 0
Minclude/scc/scc/Makefile | 4+++-
Mscripts/rules.mk | 13++++++-------
Msrc/Makefile | 5++---
Msrc/cmd/Makefile | 5-----
Msrc/cmd/as/Makefile | 2--
Msrc/cmd/cc/Makefile | 5++---
Msrc/cmd/cc/cc1/Makefile | 2--
Msrc/cmd/cc/cc2/Makefile | 2--
Msrc/cmd/cc/posix/Makefile | 2--
Msrc/cmd/deps.mk | 18++++++++++--------
Msrc/cmd/ld/Makefile | 5-----
Msrc/libc/.gitignore | 2+-
Msrc/libc/Makefile | 25++++++++++---------------
Msrc/libc/arch/Makefile | 5++---
Msrc/libc/arch/amd64/Makefile | 16+---------------
Msrc/libc/arch/amd64/darwin/Makefile | 12+-----------
Dsrc/libc/arch/amd64/darwin/_tzone.c | 1-
Msrc/libc/arch/amd64/darwin/deps.mk | 5-----
Dsrc/libc/arch/amd64/darwin/getenv.c | 1-
Dsrc/libc/arch/amd64/darwin/raise.c | 1-
Dsrc/libc/arch/amd64/darwin/signal.c | 1-
Dsrc/libc/arch/amd64/darwin/time.c | 1-
Msrc/libc/arch/amd64/deps.mk | 33---------------------------------
Msrc/libc/arch/amd64/dragonfly/Makefile | 14+-------------
Dsrc/libc/arch/amd64/dragonfly/_getheap.c | 1-
Dsrc/libc/arch/amd64/dragonfly/_tzone.c | 1-
Msrc/libc/arch/amd64/dragonfly/deps.mk | 6------
Dsrc/libc/arch/amd64/dragonfly/getenv.c | 1-
Dsrc/libc/arch/amd64/dragonfly/raise.c | 1-
Dsrc/libc/arch/amd64/dragonfly/signal.c | 1-
Dsrc/libc/arch/amd64/dragonfly/time.c | 1-
Msrc/libc/arch/amd64/linux/Makefile | 14+-------------
Dsrc/libc/arch/amd64/linux/_getheap.c | 1-
Dsrc/libc/arch/amd64/linux/_tzone.c | 1-
Dsrc/libc/arch/amd64/linux/clock.c | 1-
Msrc/libc/arch/amd64/linux/deps.mk | 6------
Dsrc/libc/arch/amd64/linux/getenv.c | 1-
Dsrc/libc/arch/amd64/linux/raise.c | 1-
Dsrc/libc/arch/amd64/linux/signal.c | 1-
Dsrc/libc/arch/amd64/linux/time.c | 1-
Dsrc/libc/arch/amd64/memchr.c | 1-
Dsrc/libc/arch/amd64/memcmp.c | 1-
Dsrc/libc/arch/amd64/memmove.c | 1-
Dsrc/libc/arch/amd64/memset.c | 1-
Msrc/libc/arch/amd64/netbsd/Makefile | 14+-------------
Dsrc/libc/arch/amd64/netbsd/_getheap.c | 1-
Dsrc/libc/arch/amd64/netbsd/_sigaction.c | 14--------------
Dsrc/libc/arch/amd64/netbsd/_tzone.c | 1-
Dsrc/libc/arch/amd64/netbsd/getenv.c | 1-
Dsrc/libc/arch/amd64/netbsd/raise.c | 1-
Dsrc/libc/arch/amd64/netbsd/signal.c | 1-
Dsrc/libc/arch/amd64/netbsd/time.c | 1-
Msrc/libc/arch/amd64/openbsd/Makefile | 10+---------
Dsrc/libc/arch/amd64/openbsd/_getheap.c | 1-
Dsrc/libc/arch/amd64/openbsd/_sigaction.c | 14--------------
Asrc/libc/arch/amd64/openbsd/_sigaction2.s | 12++++++++++++
Dsrc/libc/arch/amd64/openbsd/_tzone.c | 1-
Msrc/libc/arch/amd64/openbsd/deps.mk | 6------
Dsrc/libc/arch/amd64/openbsd/getenv.c | 1-
Dsrc/libc/arch/amd64/openbsd/raise.c | 1-
Dsrc/libc/arch/amd64/openbsd/signal.c | 1-
Msrc/libc/arch/amd64/openbsd/syscall.lst | 2+-
Dsrc/libc/arch/amd64/openbsd/time.c | 1-
Msrc/libc/arch/arm/Makefile | 17+----------------
Msrc/libc/arch/arm/deps.mk | 12------------
Msrc/libc/arch/arm/linux/Makefile | 14+-------------
Dsrc/libc/arch/arm/linux/_getheap.c | 1-
Dsrc/libc/arch/arm/linux/_tzone.c | 1-
Msrc/libc/arch/arm/linux/deps.mk | 7-------
Dsrc/libc/arch/arm/linux/getenv.c | 1-
Dsrc/libc/arch/arm/linux/raise.c | 1-
Dsrc/libc/arch/arm/linux/signal.c | 1-
Dsrc/libc/arch/arm/linux/time.c | 1-
Dsrc/libc/arch/arm/memchr.c | 1-
Dsrc/libc/arch/arm/memcmp.c | 1-
Dsrc/libc/arch/arm/memcpy.c | 1-
Dsrc/libc/arch/arm/memmove.c | 1-
Dsrc/libc/arch/arm/memset.c | 1-
Msrc/libc/arch/arm64/Makefile | 17+----------------
Msrc/libc/arch/arm64/deps.mk | 12------------
Msrc/libc/arch/arm64/linux/Makefile | 12+-----------
Dsrc/libc/arch/arm64/linux/_getheap.c | 1-
Dsrc/libc/arch/arm64/linux/_open.c | 13-------------
Dsrc/libc/arch/arm64/linux/_tzone.c | 1-
Asrc/libc/arch/arm64/linux/deps.mk | 1+
Dsrc/libc/arch/arm64/linux/getenv.c | 1-
Dsrc/libc/arch/arm64/linux/raise.c | 1-
Dsrc/libc/arch/arm64/linux/signal.c | 1-
Dsrc/libc/arch/arm64/linux/time.c | 1-
Dsrc/libc/arch/arm64/memchr.c | 1-
Dsrc/libc/arch/arm64/memcmp.c | 1-
Dsrc/libc/arch/arm64/memcpy.c | 1-
Dsrc/libc/arch/arm64/memmove.c | 1-
Dsrc/libc/arch/arm64/memset.c | 1-
Rsrc/libc/arch/amd64/dragonfly/_sigaction.c -> src/libc/arch/bsd/_sigaction.c | 0
Msrc/libc/arch/i386/Makefile | 17+----------------
Msrc/libc/arch/i386/deps.mk | 8--------
Msrc/libc/arch/i386/linux/Makefile | 12++----------
Dsrc/libc/arch/i386/linux/_getheap.c | 1-
Msrc/libc/arch/i386/linux/deps.mk | 3---
Dsrc/libc/arch/i386/linux/raise.c | 1-
Dsrc/libc/arch/i386/linux/signal.c | 1-
Dsrc/libc/arch/i386/memchr.c | 1-
Dsrc/libc/arch/i386/memcmp.c | 1-
Dsrc/libc/arch/i386/memcpy.c | 1-
Dsrc/libc/arch/i386/memmove.c | 1-
Dsrc/libc/arch/i386/memset.c | 1-
Rsrc/libc/arch/arm/linux/_open.c -> src/libc/arch/posix/_open.c | 0
Msrc/libc/arch/posix/clock.c | 1-
Msrc/libc/arch/posix/clock.h | 15++-------------
Msrc/libc/arch/posix/time.c | 7+------
Msrc/libc/arch/ppc/Makefile | 17+----------------
Msrc/libc/arch/ppc/deps.mk | 6------
Msrc/libc/arch/ppc/linux/Makefile | 8+-------
Dsrc/libc/arch/ppc/linux/_getheap.c | 1-
Msrc/libc/arch/ppc/linux/deps.mk | 1-
Dsrc/libc/arch/ppc/memchr.c | 1-
Dsrc/libc/arch/ppc/memcmp.c | 1-
Dsrc/libc/arch/ppc/memcpy.c | 1-
Dsrc/libc/arch/ppc/memmove.c | 1-
Dsrc/libc/arch/ppc/memset.c | 1-
Msrc/libc/assert/Makefile | 7+------
Msrc/libc/ctype/Makefile | 7+------
Msrc/libc/locale/Makefile | 7+------
Asrc/libc/objs/amd64-darwin.mk | 4++++
Asrc/libc/objs/amd64-dragonfly.mk | 4++++
Asrc/libc/objs/amd64-linux.mk | 4++++
Asrc/libc/objs/amd64-netbsd.mk | 4++++
Asrc/libc/objs/amd64-openbsd.mk | 4++++
Asrc/libc/objs/arm-linux.mk | 4++++
Asrc/libc/objs/arm64-linux.mk | 4++++
Asrc/libc/objs/common-objs.mk | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/libc/objs/i386-linux.mk | 4++++
Asrc/libc/objs/ppc-linux.mk | 4++++
Asrc/libc/objs/z80-msxdos.mk | 4++++
Msrc/libc/rules.mk | 16+++++++---------
Msrc/libc/stdio/Makefile | 7+------
Msrc/libc/stdio/deps.mk | 1+
Msrc/libc/stdlib/Makefile | 7+------
Msrc/libc/string/Makefile | 7+------
Msrc/libc/syscall.h | 18+++++++++---------
Msrc/libc/time/Makefile | 12+++---------
Msrc/libc/time/deps.mk | 1+
Msrc/libcrt/Makefile | 12++++++++++--
Asrc/libcrt/amd64/deps.mk | 1+
Asrc/libcrt/arm/deps.mk | 1+
Asrc/libcrt/arm64/deps.mk | 1+
Asrc/libcrt/i386/deps.mk | 1+
Asrc/libcrt/ppc/deps.mk | 1+
Msrc/libmach/Makefile | 5-----
Msrc/libmach/coff32/Makefile | 2--
Msrc/libscc/Makefile | 2--
Mtests/Makefile | 12++++++++----
155 files changed, 268 insertions(+), 564 deletions(-)

diff --git a/Makefile b/Makefile @@ -10,6 +10,7 @@ PROJECTDIR = . include $(PROJECTDIR)/scripts/rules.mk PREFIX= /usr/local +NODEP = 1 all: +@$(MAKE) `$(SCRIPTDIR)/config` toolchain @@ -28,20 +29,11 @@ dirs: $(SCRIPTDIR)/libc-proto xargs mkdir -p < $(SCRIPTDIR)/libc-proto touch dirs -dep: - $(FORALL) - install: all $(SCRIPTDIR)/install $(PREFIX) -distclean: clean - $(MAKE) $(ENVIRON) - $(FORALL) - rm -f $(ENVIRON) - -clean: $(ENVIRON) - $(FORALL) +clean: xargs rm -rf < $(SCRIPTDIR)/libc-proto - rm -f dirs $(ENVIRON) + rm -f dirs tests: all diff --git a/deps.mk b/deps.mk diff --git a/include/scc/scc/Makefile b/include/scc/scc/Makefile @@ -10,6 +10,8 @@ SYSHDR =\ syslibs.h\ cstd.h\ +NODEP = 1 + all: $(SYSHDR) cstd.h: cstd-$(STD).h @@ -27,5 +29,5 @@ sysincludes.h: syslibs.h: cp syslibs.def.h $@ -distclean: +clean: rm -f $(SYSHDR) diff --git a/scripts/rules.mk b/scripts/rules.mk @@ -18,6 +18,7 @@ LIBEXEC = $(PROJECTDIR)/libexec BUILDDIR = $(PROJECTDIR)/scripts/build CRTDIR = $(PROJECTDIR)/lib/scc LIBCDIR = $(CRTDIR)/$(ARCH)-$(SYS) +MKDEP = $(SCRIPTDIR)/mkdep # library dependences helpers LIBMACH = $(LIBDIR)/scc/libmach.a @@ -95,13 +96,11 @@ GS = gs # helper macro to run over all the directories FORALL = +@set -e ;\ - pwd=$$PWD; \ - . $(ENVIRON); \ for i in $(DIRS); \ do \ cd $$i; \ $(MAKE) $@; \ - cd $$pwd; \ + cd -; \ done $(DIRS): FORCE @@ -198,10 +197,10 @@ clean-dirs: done clean-files: - rm -f *.i *.d *.o *.a *.ko *.elf $(TARGET) - rm -f *.csmes *.csexe + rm -f *.i *.d *.o *.a *.elf $(TARGET) -dep: +dep: inc-dep + $(FORALL) inc-dep: FORCE - mkdep + test -n "$(NODEP)" || $(MKDEP) diff --git a/src/Makefile b/src/Makefile @@ -12,9 +12,8 @@ DIRS =\ PROJECTDIR = .. include $(PROJECTDIR)/scripts/rules.mk +NODEP = 1 + all: cmd cmd: $(LIBS) - -dep clean: - $(FORALL) diff --git a/src/cmd/Makefile b/src/cmd/Makefile @@ -44,9 +44,4 @@ $(BINDIR)/addr2line: addr2line.o $(LIBMACH) $(LIBSCC) $(BINDIR)/ar: ar.o $(DRIVER).o $(CC) $(PROJ_LDFLAGS) ar.o $(DRIVER).o -o $@ -dep: inc-dep - -dep clean: - $(FORALL) - include deps.mk diff --git a/src/cmd/as/Makefile b/src/cmd/as/Makefile @@ -24,8 +24,6 @@ all: $(TARGET) $(TARGET): $(LIBSCC) -dep: inc-dep - clean: rm -f target/*/*.o target/*/*tbl.c diff --git a/src/cmd/cc/Makefile b/src/cmd/cc/Makefile @@ -8,7 +8,6 @@ DIRS =\ PROJECTDIR = ../../.. include $(PROJECTDIR)/scripts/rules.mk -all: $(DIRS) +NODEP = 1 -dep clean: - $(FORALL) +all: $(DIRS) diff --git a/src/cmd/cc/cc1/Makefile b/src/cmd/cc/cc1/Makefile @@ -30,6 +30,4 @@ all: $(TARGET) $(TARGET): $(LIBSCC) $(OBJS) $(CC) $(PROJ_LDFLAGS) $(OBJS) -lscc -o $@ -dep: inc-dep - include deps.mk diff --git a/src/cmd/cc/cc2/Makefile b/src/cmd/cc/cc2/Makefile @@ -29,8 +29,6 @@ error.h: cc2.h trap 'r=$?;rm -f $$$$.h;exit $r' EXIT INT QUIT ;\ awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@ -dep: inc-dep - clean: rm -f target/*/*.o error.h diff --git a/src/cmd/cc/posix/Makefile b/src/cmd/cc/posix/Makefile @@ -29,8 +29,6 @@ $(BINDIR)/cpp: cpp.sh config.h: PREFIX=$(PREFIX) ./mkconf $(SYSLST) -dep: inc-dep - clean: rm -f scc scpp *.o rm -f $(TARGETS) diff --git a/src/cmd/deps.mk b/src/cmd/deps.mk @@ -60,6 +60,12 @@ ./as/target/x86/ins.o: $(INCDIR)/scc/scc/scc.h ./as/target/x86/ins.o: ./as/target/x86/../../as.h ./as/target/x86/ins.o: ./as/target/x86/proc.h +./cc/cc1/amd64-sysv.o: $(INCDIR)/scc/scc/scc.h +./cc/cc1/amd64-sysv.o: ./cc/cc1/cc1.h +./cc/cc1/arch.o: $(INCDIR)/scc/scc/scc.h +./cc/cc1/arch.o: ./cc/cc1/cc1.h +./cc/cc1/arm64-sysv.o: $(INCDIR)/scc/scc/scc.h +./cc/cc1/arm64-sysv.o: ./cc/cc1/cc1.h ./cc/cc1/builtin.o: $(INCDIR)/scc/scc/scc.h ./cc/cc1/builtin.o: ./cc/cc1/cc1.h ./cc/cc1/code.o: $(INCDIR)/scc/scc/scc.h @@ -77,6 +83,8 @@ ./cc/cc1/expr.o: ./cc/cc1/cc1.h ./cc/cc1/fold.o: $(INCDIR)/scc/scc/scc.h ./cc/cc1/fold.o: ./cc/cc1/cc1.h +./cc/cc1/i386-sysv.o: $(INCDIR)/scc/scc/scc.h +./cc/cc1/i386-sysv.o: ./cc/cc1/cc1.h ./cc/cc1/init.o: $(INCDIR)/scc/scc/cstd.h ./cc/cc1/init.o: $(INCDIR)/scc/scc/scc.h ./cc/cc1/init.o: ./cc/cc1/cc1.h @@ -92,17 +100,11 @@ ./cc/cc1/symbol.o: $(INCDIR)/scc/scc/cstd.h ./cc/cc1/symbol.o: $(INCDIR)/scc/scc/scc.h ./cc/cc1/symbol.o: ./cc/cc1/cc1.h -./cc/cc1/target/amd64-sysv/arch.o: $(INCDIR)/scc/scc/scc.h -./cc/cc1/target/amd64-sysv/arch.o: ./cc/cc1/target/amd64-sysv/../../cc1.h -./cc/cc1/target/arm64-sysv/arch.o: $(INCDIR)/scc/scc/scc.h -./cc/cc1/target/arm64-sysv/arch.o: ./cc/cc1/target/arm64-sysv/../../cc1.h -./cc/cc1/target/i386-sysv/arch.o: $(INCDIR)/scc/scc/scc.h -./cc/cc1/target/i386-sysv/arch.o: ./cc/cc1/target/i386-sysv/../../cc1.h -./cc/cc1/target/z80-scc/arch.o: $(INCDIR)/scc/scc/scc.h -./cc/cc1/target/z80-scc/arch.o: ./cc/cc1/target/z80-scc/../../cc1.h ./cc/cc1/types.o: $(INCDIR)/scc/scc/cstd.h ./cc/cc1/types.o: $(INCDIR)/scc/scc/scc.h ./cc/cc1/types.o: ./cc/cc1/cc1.h +./cc/cc1/z80-scc.o: $(INCDIR)/scc/scc/scc.h +./cc/cc1/z80-scc.o: ./cc/cc1/cc1.h ./cc/cc2/code.o: $(INCDIR)/scc/scc/scc.h ./cc/cc2/code.o: ./cc/cc2/cc2.h ./cc/cc2/main.o: $(INCDIR)/scc/scc/arg.h diff --git a/src/cmd/ld/Makefile b/src/cmd/ld/Makefile @@ -19,9 +19,4 @@ all: $(TARGET) $(TARGET): $(OBJS) $(LIBMACH) $(LIBSCC) $(CC) $(PROJ_LDFLAGS) $(OBJS) -lmach -lscc -o $@ -dep: inc-dep - -clean: - rm -f $(OBJS) - include deps.mk diff --git a/src/libc/.gitignore b/src/libc/.gitignore @@ -3,4 +3,4 @@ *.8 *.z *.q -libc.lst +*.6d diff --git a/src/libc/Makefile b/src/libc/Makefile @@ -1,7 +1,7 @@ .POSIX: +PROJECTDIR = ../.. DIRS =\ - arch\ assert\ ctype\ locale\ @@ -9,23 +9,18 @@ DIRS =\ stdlib\ string\ time\ + arch\ -PROJECTDIR =../.. include $(PROJECTDIR)/scripts/rules.mk include rules.mk +include objs/$(ARCH)-$(SYS).mk +NODEP = 1 +TARGET = $(LIBC) -all: $(LIBC) - -$(LIBC): $(DIRS) - $(AR) $(PROJ_ARFLAGS) $@ `cat $(LIBCLST)` - $(RL) $(PROJ_RLFLAGS) $@ - -rm-lst: FORCE - rm -f $(LIBCLST) - -dep: - $(FORALL) +all: $(DIRS) + $(MAKE) $(LIBC) -clean: rm-lst - $(FORALL) +$(LIBC): $(OBJS) + $(AR) $(PROJ_ARFLAGS) $(LIBC) $? + $(RL) $(PROJ_RLFLAGS) $(LIBC) diff --git a/src/libc/arch/Makefile b/src/libc/arch/Makefile @@ -11,7 +11,6 @@ PROJECTDIR =../../.. include $(PROJECTDIR)/scripts/rules.mk include ../rules.mk -all: $(ARCH) +NODEP = 1 -dep clean: - $(FORALL) +all: $(ARCH) diff --git a/src/libc/arch/amd64/Makefile b/src/libc/arch/amd64/Makefile @@ -14,22 +14,8 @@ include ../../rules.mk OBJS =\ longjmp.$O\ setjmp.$O\ - memchr.$O\ - memcmp.$O\ memcpy.$O\ - memmove.$O\ - memset.$O\ -all: $(LIBC) $(SYS) - -$(LIBC): $(LIBCLST) - -$(LIBCLST): $(OBJS) - $(MKLST) - -dep: inc-dep - -dep clean: - $(FORALL) +all: $(OBJS) $(SYS) include deps.mk diff --git a/src/libc/arch/amd64/darwin/Makefile b/src/libc/arch/amd64/darwin/Makefile @@ -20,27 +20,17 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ _getheap.$O\ - _tzone.$O\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ _sys_errlist.$O\ # Rules -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/amd64/darwin/_tzone.c b/src/libc/arch/amd64/darwin/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/amd64/darwin/deps.mk b/src/libc/arch/amd64/darwin/deps.mk @@ -1,6 +1 @@ #deps -./_tzone.o: ./../../posix/_tzone.c -./getenv.o: ./../../posix/getenv.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c -./time.o: ./../../posix/time.c diff --git a/src/libc/arch/amd64/darwin/getenv.c b/src/libc/arch/amd64/darwin/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/amd64/darwin/raise.c b/src/libc/arch/amd64/darwin/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/amd64/darwin/signal.c b/src/libc/arch/amd64/darwin/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/amd64/darwin/time.c b/src/libc/arch/amd64/darwin/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/amd64/deps.mk b/src/libc/arch/amd64/deps.mk @@ -1,34 +1 @@ #deps -./darwin/_tzone.o: ./darwin/../../posix/_tzone.c -./darwin/getenv.o: ./darwin/../../posix/getenv.c -./darwin/raise.o: ./darwin/../../posix/raise.c -./darwin/signal.o: ./darwin/../../posix/signal.c -./darwin/time.o: ./darwin/../../posix/time.c -./dragonfly/_getheap.o: ./dragonfly/../../posix/_getheap.c -./dragonfly/_tzone.o: ./dragonfly/../../posix/_tzone.c -./dragonfly/getenv.o: ./dragonfly/../../posix/getenv.c -./dragonfly/raise.o: ./dragonfly/../../posix/raise.c -./dragonfly/signal.o: ./dragonfly/../../posix/signal.c -./dragonfly/time.o: ./dragonfly/../../posix/time.c -./linux/_getheap.o: ./linux/../../linux/_getheap.c -./linux/_tzone.o: ./linux/../../posix/_tzone.c -./linux/getenv.o: ./linux/../../posix/getenv.c -./linux/raise.o: ./linux/../../posix/raise.c -./linux/signal.o: ./linux/../../posix/signal.c -./linux/time.o: ./linux/../../posix/time.c -./memchr.o: ./../../string/memchr.c -./memcmp.o: ./../../string/memcmp.c -./memmove.o: ./../../string/memmove.c -./memset.o: ./../../string/memset.c -./netbsd/_getheap.o: ./netbsd/../../posix/_getheap.c -./netbsd/_tzone.o: ./netbsd/../../posix/_tzone.c -./netbsd/getenv.o: ./netbsd/../../posix/getenv.c -./netbsd/raise.o: ./netbsd/../../posix/raise.c -./netbsd/signal.o: ./netbsd/../../posix/signal.c -./netbsd/time.o: ./netbsd/../../posix/time.c -./openbsd/_getheap.o: ./openbsd/../../posix/_getheap.c -./openbsd/_tzone.o: ./openbsd/../../posix/_tzone.c -./openbsd/getenv.o: ./openbsd/../../posix/getenv.c -./openbsd/raise.o: ./openbsd/../../posix/raise.c -./openbsd/signal.o: ./openbsd/../../posix/signal.c -./openbsd/time.o: ./openbsd/../../posix/time.c diff --git a/src/libc/arch/amd64/dragonfly/Makefile b/src/libc/arch/amd64/dragonfly/Makefile @@ -19,29 +19,17 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ - _getheap.$O\ - _sigaction.$O\ - _tzone.$O\ _sys_errlist.$O\ # Rules -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f _sys_errlist.c diff --git a/src/libc/arch/amd64/dragonfly/_getheap.c b/src/libc/arch/amd64/dragonfly/_getheap.c @@ -1 +0,0 @@ -#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/dragonfly/_tzone.c b/src/libc/arch/amd64/dragonfly/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/amd64/dragonfly/deps.mk b/src/libc/arch/amd64/dragonfly/deps.mk @@ -1,7 +1 @@ #deps -./_getheap.o: ./../../posix/_getheap.c -./_tzone.o: ./../../posix/_tzone.c -./getenv.o: ./../../posix/getenv.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c -./time.o: ./../../posix/time.c diff --git a/src/libc/arch/amd64/dragonfly/getenv.c b/src/libc/arch/amd64/dragonfly/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/amd64/dragonfly/raise.c b/src/libc/arch/amd64/dragonfly/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/amd64/dragonfly/signal.c b/src/libc/arch/amd64/dragonfly/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/amd64/dragonfly/time.c b/src/libc/arch/amd64/dragonfly/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -23,30 +23,18 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS = \ $(GENOBJS)\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ - clock.$O\ _cerrno.$O\ - _getheap.$O\ - _tzone.$O\ _sys_errlist.$O\ # Rules -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f _sys_errlist.c diff --git a/src/libc/arch/amd64/linux/_getheap.c b/src/libc/arch/amd64/linux/_getheap.c @@ -1 +0,0 @@ -#include "../../linux/_getheap.c" diff --git a/src/libc/arch/amd64/linux/_tzone.c b/src/libc/arch/amd64/linux/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/amd64/linux/clock.c b/src/libc/arch/amd64/linux/clock.c @@ -1 +0,0 @@ -#include "../../posix/clock.c" diff --git a/src/libc/arch/amd64/linux/deps.mk b/src/libc/arch/amd64/linux/deps.mk @@ -1,7 +1 @@ #deps -./_getheap.o: ./../../linux/_getheap.c -./_tzone.o: ./../../posix/_tzone.c -./getenv.o: ./../../posix/getenv.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c -./time.o: ./../../posix/time.c diff --git a/src/libc/arch/amd64/linux/getenv.c b/src/libc/arch/amd64/linux/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/amd64/linux/raise.c b/src/libc/arch/amd64/linux/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/amd64/linux/signal.c b/src/libc/arch/amd64/linux/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/amd64/linux/time.c b/src/libc/arch/amd64/linux/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/amd64/memchr.c b/src/libc/arch/amd64/memchr.c @@ -1 +0,0 @@ -#include "../../string/memchr.c" diff --git a/src/libc/arch/amd64/memcmp.c b/src/libc/arch/amd64/memcmp.c @@ -1 +0,0 @@ -#include "../../string/memcmp.c" diff --git a/src/libc/arch/amd64/memmove.c b/src/libc/arch/amd64/memmove.c @@ -1 +0,0 @@ -#include "../../string/memmove.c" diff --git a/src/libc/arch/amd64/memset.c b/src/libc/arch/amd64/memset.c @@ -1 +0,0 @@ -#include "../../string/memset.c" diff --git a/src/libc/arch/amd64/netbsd/Makefile b/src/libc/arch/amd64/netbsd/Makefile @@ -19,29 +19,17 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - _getheap.$O\ _setcontext.$O\ - _sigaction.$O\ _sigaction2.$O\ - _tzone.$O\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ _sys_errlist.$O\ -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s ../netbsd/crt.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -deps: inc-dep - clean: rm -f $(GENSRC) rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/amd64/netbsd/_getheap.c b/src/libc/arch/amd64/netbsd/_getheap.c @@ -1 +0,0 @@ -#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/netbsd/_sigaction.c b/src/libc/arch/amd64/netbsd/_sigaction.c @@ -1,14 +0,0 @@ -#include <stddef.h> -#include <sys.h> - -extern int _sigaction2(int sig, - struct sigaction *new, struct sigaction *old, - int siginfo[], int num); - -int -_sigaction(int sig, struct sigaction *new, struct sigaction *old) -{ - extern int _setcontext[]; - - return _sigaction2(sig, new, old, _setcontext, 2); -} diff --git a/src/libc/arch/amd64/netbsd/_tzone.c b/src/libc/arch/amd64/netbsd/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/amd64/netbsd/getenv.c b/src/libc/arch/amd64/netbsd/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/amd64/netbsd/raise.c b/src/libc/arch/amd64/netbsd/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/amd64/netbsd/signal.c b/src/libc/arch/amd64/netbsd/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/amd64/netbsd/time.c b/src/libc/arch/amd64/netbsd/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/amd64/openbsd/Makefile b/src/libc/arch/amd64/openbsd/Makefile @@ -14,18 +14,12 @@ GENOBJS =\ _read.$O\ _write.$O\ _brk.$O\ - _sigaction.$O\ + _sigaction2.$O\ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - _getheap.$O\ - _tzone.$O\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ _sys_errlist.$O\ all: $(LIBC) $(CRT) @@ -38,8 +32,6 @@ crt.$O: ../crt-posix.s ../openbsd/crt.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/amd64/openbsd/_getheap.c b/src/libc/arch/amd64/openbsd/_getheap.c @@ -1 +0,0 @@ -#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/openbsd/_sigaction.c b/src/libc/arch/amd64/openbsd/_sigaction.c @@ -1,14 +0,0 @@ -#include <stddef.h> -#include <sys.h> - -extern int _sigaction2(int sig, - struct sigaction *new, struct sigaction *old, - int siginfo[], int num); - -int -_sigaction(int sig, struct sigaction *new, struct sigaction *old) -{ - extern int _setcontext[]; - - return _sigaction2(sig, new, old, _setcontext, 2); -} diff --git a/src/libc/arch/amd64/openbsd/_sigaction2.s b/src/libc/arch/amd64/openbsd/_sigaction2.s @@ -0,0 +1,12 @@ + .file "_sigaction2.s" + + .globl _sigaction2 +_sigaction2: + movq $46,%rax + syscall + jb 1f + retq + +1: movq %rax,(errno) + movq $-1,%rax + retq diff --git a/src/libc/arch/amd64/openbsd/_tzone.c b/src/libc/arch/amd64/openbsd/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/amd64/openbsd/deps.mk b/src/libc/arch/amd64/openbsd/deps.mk @@ -1,7 +1 @@ #deps -./_getheap.o: ./../../posix/_getheap.c -./_tzone.o: ./../../posix/_tzone.c -./getenv.o: ./../../posix/getenv.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c -./time.o: ./../../posix/time.c diff --git a/src/libc/arch/amd64/openbsd/getenv.c b/src/libc/arch/amd64/openbsd/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/amd64/openbsd/raise.c b/src/libc/arch/amd64/openbsd/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/amd64/openbsd/signal.c b/src/libc/arch/amd64/openbsd/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/amd64/openbsd/syscall.lst b/src/libc/arch/amd64/openbsd/syscall.lst @@ -6,6 +6,6 @@ 6 _close 17 _brk 20 _getpid -46 _sigaction +46 _sigaction2 122 _kill 198 _lseek diff --git a/src/libc/arch/amd64/openbsd/time.c b/src/libc/arch/amd64/openbsd/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/arm/Makefile b/src/libc/arch/arm/Makefile @@ -10,22 +10,7 @@ include ../../rules.mk OBJS =\ longjmp.$O\ setjmp.$O\ - memchr.$O\ - memcmp.$O\ - memcpy.$O\ - memmove.$O\ - memset.$O\ -all: $(LIBC) $(SYS) - -$(LIBC): $(LIBCLST) - -$(LIBCLST): $(OBJS) - $(MKLST) - -dep: inc-dep - -dep clean: - $(FORALL) +all: $(OBJS) $(SYS) include deps.mk diff --git a/src/libc/arch/arm/deps.mk b/src/libc/arch/arm/deps.mk @@ -1,13 +1 @@ #deps -./linux/_getheap.o: ./linux/../../linux/_getheap.c -./linux/_open.o: ./linux/../../../syscall.h -./linux/_tzone.o: ./linux/../../posix/_tzone.c -./linux/getenv.o: ./linux/../../posix/getenv.c -./linux/raise.o: ./linux/../../posix/raise.c -./linux/signal.o: ./linux/../../posix/signal.c -./linux/time.o: ./linux/../../posix/time.c -./memchr.o: ./../../string/memchr.c -./memcmp.o: ./../../string/memcmp.c -./memcpy.o: ./../../string/memcpy.c -./memmove.o: ./../../string/memmove.c -./memset.o: ./../../string/memset.c diff --git a/src/libc/arch/arm/linux/Makefile b/src/libc/arch/arm/linux/Makefile @@ -21,27 +21,15 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ _cerrno.$O\ - _getheap.$O\ - _open.$O\ - _tzone.$O\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ _sys_errlist.$O\ -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.o: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/arm/linux/_getheap.c b/src/libc/arch/arm/linux/_getheap.c @@ -1 +0,0 @@ -#include "../../linux/_getheap.c" diff --git a/src/libc/arch/arm/linux/_tzone.c b/src/libc/arch/arm/linux/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/arm/linux/deps.mk b/src/libc/arch/arm/linux/deps.mk @@ -1,8 +1 @@ #deps -./_getheap.o: ./../../linux/_getheap.c -./_open.o: ./../../../syscall.h -./_tzone.o: ./../../posix/_tzone.c -./getenv.o: ./../../posix/getenv.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c -./time.o: ./../../posix/time.c diff --git a/src/libc/arch/arm/linux/getenv.c b/src/libc/arch/arm/linux/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/arm/linux/raise.c b/src/libc/arch/arm/linux/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/arm/linux/signal.c b/src/libc/arch/arm/linux/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/arm/linux/time.c b/src/libc/arch/arm/linux/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/arm/memchr.c b/src/libc/arch/arm/memchr.c @@ -1 +0,0 @@ -#include "../../string/memchr.c" diff --git a/src/libc/arch/arm/memcmp.c b/src/libc/arch/arm/memcmp.c @@ -1 +0,0 @@ -#include "../../string/memcmp.c" diff --git a/src/libc/arch/arm/memcpy.c b/src/libc/arch/arm/memcpy.c @@ -1 +0,0 @@ -#include "../../string/memcpy.c" diff --git a/src/libc/arch/arm/memmove.c b/src/libc/arch/arm/memmove.c @@ -1 +0,0 @@ -#include "../../string/memmove.c" diff --git a/src/libc/arch/arm/memset.c b/src/libc/arch/arm/memset.c @@ -1 +0,0 @@ -#include "../../string/memset.c" diff --git a/src/libc/arch/arm64/Makefile b/src/libc/arch/arm64/Makefile @@ -10,22 +10,7 @@ include ../../rules.mk OBJS =\ longjmp.$O\ setjmp.$O\ - memchr.$O\ - memcmp.$O\ - memcpy.$O\ - memmove.$O\ - memset.$O\ -all: $(LIBC) $(SYS) - -$(LIBC): $(LIBCLST) - -$(LIBCLST): $(OBJS) - $(MKLST) - -dep: inc-dep - -clean: - $(FORALL) +all: $(OBJS) $(SYS) include deps.mk diff --git a/src/libc/arch/arm64/deps.mk b/src/libc/arch/arm64/deps.mk @@ -1,13 +1 @@ #deps -./linux/_getheap.o: ./linux/../../linux/_getheap.c -./linux/_open.o: ./linux/../../../syscall.h -./linux/_tzone.o: ./linux/../../posix/_tzone.c -./linux/getenv.o: ./linux/../../posix/getenv.c -./linux/raise.o: ./linux/../../posix/raise.c -./linux/signal.o: ./linux/../../posix/signal.c -./linux/time.o: ./linux/../../posix/time.c -./memchr.o: ./../../string/memchr.c -./memcmp.o: ./../../string/memcmp.c -./memcpy.o: ./../../string/memcpy.c -./memmove.o: ./../../string/memmove.c -./memset.o: ./../../string/memset.c diff --git a/src/libc/arch/arm64/linux/Makefile b/src/libc/arch/arm64/linux/Makefile @@ -20,20 +20,10 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - getenv.$O\ - raise.$O\ - signal.$O\ - time.$O\ - _tzone.$O\ - _open.$O\ - _getheap.$O\ _cerrno.$O\ _sys_errlist.$O\ -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s diff --git a/src/libc/arch/arm64/linux/_getheap.c b/src/libc/arch/arm64/linux/_getheap.c @@ -1 +0,0 @@ -#include "../../linux/_getheap.c" diff --git a/src/libc/arch/arm64/linux/_open.c b/src/libc/arch/arm64/linux/_open.c @@ -1,13 +0,0 @@ -#include <stddef.h> - -#include "../../../syscall.h" - -#define AT_FDCWD -100 - -extern int _openat(int fd, const char *fname, int flags, int mode); - -int -_open(const char *fname, int flags, int mode) -{ - return _openat(AT_FDCWD, fname, flags, mode); -} diff --git a/src/libc/arch/arm64/linux/_tzone.c b/src/libc/arch/arm64/linux/_tzone.c @@ -1 +0,0 @@ -#include "../../posix/_tzone.c" diff --git a/src/libc/arch/arm64/linux/deps.mk b/src/libc/arch/arm64/linux/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libc/arch/arm64/linux/getenv.c b/src/libc/arch/arm64/linux/getenv.c @@ -1 +0,0 @@ -#include "../../posix/getenv.c" diff --git a/src/libc/arch/arm64/linux/raise.c b/src/libc/arch/arm64/linux/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/arm64/linux/signal.c b/src/libc/arch/arm64/linux/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/arm64/linux/time.c b/src/libc/arch/arm64/linux/time.c @@ -1 +0,0 @@ -#include "../../posix/time.c" diff --git a/src/libc/arch/arm64/memchr.c b/src/libc/arch/arm64/memchr.c @@ -1 +0,0 @@ -#include "../../string/memchr.c" diff --git a/src/libc/arch/arm64/memcmp.c b/src/libc/arch/arm64/memcmp.c @@ -1 +0,0 @@ -#include "../../string/memcmp.c" diff --git a/src/libc/arch/arm64/memcpy.c b/src/libc/arch/arm64/memcpy.c @@ -1 +0,0 @@ -#include "../../string/memcpy.c" diff --git a/src/libc/arch/arm64/memmove.c b/src/libc/arch/arm64/memmove.c @@ -1 +0,0 @@ -#include "../../string/memmove.c" diff --git a/src/libc/arch/arm64/memset.c b/src/libc/arch/arm64/memset.c @@ -1 +0,0 @@ -#include "../../string/memset.c" diff --git a/src/libc/arch/amd64/dragonfly/_sigaction.c b/src/libc/arch/bsd/_sigaction.c diff --git a/src/libc/arch/i386/Makefile b/src/libc/arch/i386/Makefile @@ -10,22 +10,7 @@ include ../../rules.mk OBJS =\ longjmp.$O\ setjmp.$O\ - memchr.$O\ - memcmp.$O\ - memcpy.$O\ - memmove.$O\ - memset.$O\ -all: $(LIBC) $(SYS) - -$(LIBC): $(LIBCLST) - -$(LIBCLST): $(OBJS) - $(MKLST) - -dep: inc-dep - -dep clean: - $(FORALL) +all: $(OBJS) $(SYS) include deps.mk diff --git a/src/libc/arch/i386/deps.mk b/src/libc/arch/i386/deps.mk @@ -1,9 +1 @@ #deps -./linux/_getheap.o: ./linux/../../linux/_getheap.c -./linux/raise.o: ./linux/../../posix/raise.c -./linux/signal.o: ./linux/../../posix/signal.c -./memchr.o: ./../../string/memchr.c -./memcmp.o: ./../../string/memcmp.c -./memcpy.o: ./../../../string/memcpy.c -./memmove.o: ./../../string/memmove.c -./memset.o: ./../../string/memset.c diff --git a/src/libc/arch/i386/linux/Makefile b/src/libc/arch/i386/linux/Makefile @@ -20,24 +20,16 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS =\ $(GENOBJS)\ - signal.$O\ - raise.$O\ - _getheap.$O\ _cerrno.$O\ - signal.$O + _sys_errlist.$O\ -all: $(LIBC) $(CRT) - -$(LIBCLST): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) rm -f syscall _sys_errlist.c diff --git a/src/libc/arch/i386/linux/_getheap.c b/src/libc/arch/i386/linux/_getheap.c @@ -1 +0,0 @@ -#include "../../linux/_getheap.c" diff --git a/src/libc/arch/i386/linux/deps.mk b/src/libc/arch/i386/linux/deps.mk @@ -1,4 +1 @@ #deps -./_getheap.o: ./../../linux/_getheap.c -./raise.o: ./../../posix/raise.c -./signal.o: ./../../posix/signal.c diff --git a/src/libc/arch/i386/linux/raise.c b/src/libc/arch/i386/linux/raise.c @@ -1 +0,0 @@ -#include "../../posix/raise.c" diff --git a/src/libc/arch/i386/linux/signal.c b/src/libc/arch/i386/linux/signal.c @@ -1 +0,0 @@ -#include "../../posix/signal.c" diff --git a/src/libc/arch/i386/memchr.c b/src/libc/arch/i386/memchr.c @@ -1 +0,0 @@ -#include "../../string/memchr.c" diff --git a/src/libc/arch/i386/memcmp.c b/src/libc/arch/i386/memcmp.c @@ -1 +0,0 @@ -#include "../../string/memcmp.c" diff --git a/src/libc/arch/i386/memcpy.c b/src/libc/arch/i386/memcpy.c @@ -1 +0,0 @@ -#include "../../../string/memcpy.c" diff --git a/src/libc/arch/i386/memmove.c b/src/libc/arch/i386/memmove.c @@ -1 +0,0 @@ -#include "../../string/memmove.c" diff --git a/src/libc/arch/i386/memset.c b/src/libc/arch/i386/memset.c @@ -1 +0,0 @@ -#include "../../string/memset.c" diff --git a/src/libc/arch/arm/linux/_open.c b/src/libc/arch/posix/_open.c diff --git a/src/libc/arch/posix/clock.c b/src/libc/arch/posix/clock.c @@ -9,7 +9,6 @@ convtick(struct rusage r) r.ru_stime.tv_usec / (1000000 / CLOCKS_PER_SEC); } - clock_t clock(void) { diff --git a/src/libc/arch/posix/clock.h b/src/libc/arch/posix/clock.h @@ -1,15 +1,6 @@ -#ifndef CLOCK_H -#define CLOCK_H - -#include <time.h> - -#define RUSAGE_SELF 0 - -typedef long int clock_t; - struct timeval { - long int tv_sec; - long int tv_usec; + time_t tv_sec; + suseconds_t tv_usec; }; struct rusage { @@ -30,5 +21,3 @@ struct rusage { long int ru_nvcsw; long int ru_nivcsw; }; - -#endif diff --git a/src/libc/arch/posix/time.c b/src/libc/arch/posix/time.c @@ -1,12 +1,7 @@ #include <time.h> -struct timeval { - time_t tv_sec; - int tv_usec; /* TODO use a arch type */ -}; - int -_gettimeofday(struct timeval * restrict tp, void * restrict tzp); +_gettimeofday(struct timeval *restrict, void *tzp); time_t time(time_t *t) diff --git a/src/libc/arch/ppc/Makefile b/src/libc/arch/ppc/Makefile @@ -10,22 +10,7 @@ include ../../rules.mk OBJS =\ longjmp.$O\ setjmp.$O\ - memchr.$O\ - memcmp.$O\ - memcpy.$O\ - memmove.$O\ - memset.$O\ -all: $(LIBC) $(SYS) - -$(LIBC): $(LIBCLST) - -$(LIBCLST): $(OBJS) - $(MKLST) - -dep: inc-dep - -dep clean: - $(FORALL) +all: $(OBJS) $(SYS) include deps.mk diff --git a/src/libc/arch/ppc/deps.mk b/src/libc/arch/ppc/deps.mk @@ -1,7 +1 @@ #deps -./linux/_getheap.o: ./linux/../../linux/_getheap.c -./memchr.o: ./../../string/memchr.c -./memcmp.o: ./../../string/memcmp.c -./memcpy.o: ./../../string/memcpy.c -./memmove.o: ./../../string/memmove.c -./memset.o: ./../../string/memset.c diff --git a/src/libc/arch/ppc/linux/Makefile b/src/libc/arch/ppc/linux/Makefile @@ -22,22 +22,16 @@ GENSRC = $(GENOBJS:.$O=.s) OBJS = \ $(GENOBJS)\ _cerrno.$O\ - _getheap.$O\ # Rules -all: $(LIBC) $(CRT) - -$(LIBC): $(OBJS) - $(MKLST) +all: $(OBJS) $(CRT) crt.$O: ../crt-posix.s $(GENSRC): syscall.lst ./gensys.sh $(@:.s=) -dep: inc-dep - clean: rm -f $(GENSRC) diff --git a/src/libc/arch/ppc/linux/_getheap.c b/src/libc/arch/ppc/linux/_getheap.c @@ -1 +0,0 @@ -#include "../../linux/_getheap.c" diff --git a/src/libc/arch/ppc/linux/deps.mk b/src/libc/arch/ppc/linux/deps.mk @@ -1,2 +1 @@ #deps -./_getheap.o: ./../../linux/_getheap.c diff --git a/src/libc/arch/ppc/memchr.c b/src/libc/arch/ppc/memchr.c @@ -1 +0,0 @@ -#include "../../string/memchr.c" diff --git a/src/libc/arch/ppc/memcmp.c b/src/libc/arch/ppc/memcmp.c @@ -1 +0,0 @@ -#include "../../string/memcmp.c" diff --git a/src/libc/arch/ppc/memcpy.c b/src/libc/arch/ppc/memcpy.c @@ -1 +0,0 @@ -#include "../../string/memcpy.c" diff --git a/src/libc/arch/ppc/memmove.c b/src/libc/arch/ppc/memmove.c @@ -1 +0,0 @@ -#include "../../string/memmove.c" diff --git a/src/libc/arch/ppc/memset.c b/src/libc/arch/ppc/memset.c @@ -1 +0,0 @@ -#include "../../string/memset.c" diff --git a/src/libc/assert/Makefile b/src/libc/assert/Makefile @@ -7,11 +7,6 @@ OBJS =\ __assert.$O\ assert.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/ctype/Makefile b/src/libc/ctype/Makefile @@ -22,11 +22,6 @@ OBJS =\ tolower.$O\ toupper.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/locale/Makefile b/src/libc/locale/Makefile @@ -7,11 +7,6 @@ OBJS =\ localeconv.$O\ setlocale.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/objs/amd64-darwin.mk b/src/libc/objs/amd64-darwin.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/amd64-dragonfly.mk b/src/libc/objs/amd64-dragonfly.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/amd64-linux.mk b/src/libc/objs/amd64-linux.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/amd64-netbsd.mk b/src/libc/objs/amd64-netbsd.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/amd64-openbsd.mk b/src/libc/objs/amd64-openbsd.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/arm-linux.mk b/src/libc/objs/arm-linux.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/arm64-linux.mk b/src/libc/objs/arm64-linux.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/common-objs.mk b/src/libc/objs/common-objs.mk @@ -0,0 +1,107 @@ +COMMON_OBJS =\ + assert/__assert.$O\ + assert/assert.$O\ + ctype/ctype.$O\ + ctype/isalnum.$O\ + ctype/isalpha.$O\ + ctype/isascii.$O\ + ctype/isblank.$O\ + ctype/iscntrl.$O\ + ctype/isdigit.$O\ + ctype/isgraph.$O\ + ctype/islower.$O\ + ctype/isprint.$O\ + ctype/ispunct.$O\ + ctype/isspace.$O\ + ctype/isupper.$O\ + ctype/isxdigit.$O\ + ctype/toascii.$O\ + ctype/tolower.$O\ + ctype/toupper.$O\ + locale/localeconv.$O\ + locale/setlocale.$O\ + stdio/__getc.$O\ + stdio/__iob.$O\ + stdio/__putc.$O\ + stdio/_allocbuf.$O\ + stdio/_flsbuf.$O\ + stdio/_fpopen.$O\ + stdio/clearerr.$O\ + stdio/fclose.$O\ + stdio/feof.$O\ + stdio/ferror.$O\ + stdio/fgetc.$O\ + stdio/fgets.$O\ + stdio/fopen.$O\ + stdio/fprintf.$O\ + stdio/fputc.$O\ + stdio/fputs.$O\ + stdio/fread.$O\ + stdio/freopen.$O\ + stdio/fseek.$O\ + stdio/ftell.$O\ + stdio/fwrite.$O\ + stdio/getc.$O\ + stdio/getchar.$O\ + stdio/gets.$O\ + stdio/perror.$O\ + stdio/printf.$O\ + stdio/putc.$O\ + stdio/putchar.$O\ + stdio/puts.$O\ + stdio/remove.$O\ + stdio/rewind.$O\ + stdio/setbuf.$O\ + stdio/setvbuf.$O\ + stdio/snprintf.$O\ + stdio/sprintf.$O\ + stdio/tmpnam.$O\ + stdio/vfprintf.$O\ + stdio/vprintf.$O\ + stdio/vsnprintf.$O\ + stdio/vsprintf.$O\ + stdlib/_dtoi.$O\ + stdlib/abort.$O\ + stdlib/abs.$O\ + stdlib/atexit.$O\ + stdlib/atoi.$O\ + stdlib/atol.$O\ + stdlib/atoll.$O\ + stdlib/bsearch.$O\ + stdlib/calloc.$O\ + stdlib/errno.$O\ + stdlib/exit.$O\ + stdlib/labs.$O\ + stdlib/llabs.$O\ + stdlib/malloc.$O\ + stdlib/qsort.$O\ + stdlib/rand.$O\ + stdlib/realloc.$O\ + stdlib/strtol.$O\ + stdlib/strtoll.$O\ + stdlib/strtoul.$O\ + stdlib/strtoull.$O\ + string/strcat.$O\ + string/strchr.$O\ + string/strcmp.$O\ + string/strcoll.$O\ + string/strcpy.$O\ + string/strcspn.$O\ + string/strerror.$O\ + string/strncat.$O\ + string/strncmp.$O\ + string/strncpy.$O\ + string/strpbrk.$O\ + string/strrchr.$O\ + string/strspn.$O\ + string/strstr.$O\ + string/strtok.$O\ + string/strxfrm.$O\ + time/_daysyear.$O\ + time/asctime.$O\ + time/ctime.$O\ + time/difftime.$O\ + time/gmtime.$O\ + time/localtime.$O\ + time/mktime.$O\ + time/strftime.$O\ diff --git a/src/libc/objs/i386-linux.mk b/src/libc/objs/i386-linux.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/ppc-linux.mk b/src/libc/objs/ppc-linux.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/objs/z80-msxdos.mk b/src/libc/objs/z80-msxdos.mk @@ -0,0 +1,4 @@ +include objs/common-objs.mk + +OBJS =\ + $(COMMON_OBJS)\ diff --git a/src/libc/rules.mk b/src/libc/rules.mk @@ -1,23 +1,21 @@ +#MORE_CFLAGS = -I$(INCDIR) +#LIBCDIR = $(PROJECTDIR)/src/libc + CINCLUDES =\ -I$(INCDIR)\ -I$(INCDIR)/bits/$(SYS)\ -I$(INCDIR)/bits/$(ARCH)\ +MORE_ARFLAGS = -u + SYSERRNO = $(INCDIR)/bits/$(SYS)/sys/errno.h LIBC = $(LIBCDIR)/libc.a CRT = $(LIBCDIR)/crt.o -LIBCLST= $(PROJECTDIR)/src/libc/libc.lst - -MKLST = \ - echo $? |\ - tr ' ' '\n' |\ - sed '/^$$/d' |\ - sed 's@^@$(PWD)/@' >> $(LIBCLST) # Rules -.SUFFIXES: .6 .7 .8 .z .q +.SUFFIXES: .6 .7 .8 .z .q .6d _sys_errlist.c: $(SYSERRNO) ../../mkerrstr $(SYSERRNO) @@ -28,7 +26,7 @@ $(CRT): crt.$O clean: clean-libc clean-libc: FORCE - rm -f *.6 *.7 *.8 *.z *.q + rm -f *.6d *.6 *.7 *.8 *.z *.q # amd64-posix objects .c.6: diff --git a/src/libc/stdio/Makefile b/src/libc/stdio/Makefile @@ -45,11 +45,6 @@ OBJS =\ vprintf.$O\ _allocbuf.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/stdio/deps.mk b/src/libc/stdio/deps.mk @@ -16,5 +16,6 @@ ./fseek.o: ./../libc.h ./fseek.o: ./../syscall.h ./ftell.o: ./../syscall.h +./remove.o: ./../syscall.h ./setvbuf.o: ./../libc.h ./tmpnam.o: ./../syscall.h diff --git a/src/libc/stdlib/Makefile b/src/libc/stdlib/Makefile @@ -26,11 +26,6 @@ OBJS =\ strtoul.$O\ strtoull.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/string/Makefile b/src/libc/string/Makefile @@ -23,11 +23,6 @@ OBJS = \ strtok.$O\ strxfrm.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -dep: inc-dep +all: $(OBJS) include deps.mk diff --git a/src/libc/syscall.h b/src/libc/syscall.h @@ -1,9 +1,9 @@ -extern void *_brk(void *addr); -extern int _open(const char *path, int flags, int mode); -extern int _close(int fd); -extern int _read(int fd, void *buf, size_t n); -extern int _write(int fd, void *buf, size_t n); -extern int _lseek(int fd, long off, int whence); -extern void _Exit(int status); -extern int _access(char *path, int mode); -extern int _unlink(const char *path); +extern int _brk(void *); +extern void _exit(int); +extern int _close(int); +extern int _getpid(void); +extern int _kill(int, int); +extern int _open(const char *, int, int); +extern int _read(int, void *, size_t); +extern int _unlink(const char *); +extern int _write(int, void *, size_t); diff --git a/src/libc/time/Makefile b/src/libc/time/Makefile @@ -14,18 +14,12 @@ OBJS =\ strftime.$O\ tz.$O\ -all: $(LIBC) - -$(LIBC): $(OBJS) - $(MKLST) - -$(OBJS): tz.c +all: $(OBJS) tz.c: timezone.lst awk -f gentz.awk $? >$@ -dep: inc-dep - -distclean: tz.c +clean: + rm -f tz.c include deps.mk diff --git a/src/libc/time/deps.mk b/src/libc/time/deps.mk @@ -4,3 +4,4 @@ ./localtime.o: ./../libc.h ./mktime.o: ./../libc.h ./strftime.o: ./../libc.h +./tz.o: ./../libc.h diff --git a/src/libcrt/Makefile b/src/libcrt/Makefile @@ -1,7 +1,15 @@ .POSIX: +DIRS =\ + amd64\ + arm\ + arm64\ + i386\ + ppc\ + PROJECTDIR=../.. include $(PROJECTDIR)/scripts/rules.mk -all clean dep: - cd $(ARCH) && $(MAKE) $@ +NODEP = 1 + +all: $(ARCH) diff --git a/src/libcrt/amd64/deps.mk b/src/libcrt/amd64/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libcrt/arm/deps.mk b/src/libcrt/arm/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libcrt/arm64/deps.mk b/src/libcrt/arm64/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libcrt/i386/deps.mk b/src/libcrt/i386/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libcrt/ppc/deps.mk b/src/libcrt/ppc/deps.mk @@ -0,0 +1 @@ +#deps diff --git a/src/libmach/Makefile b/src/libmach/Makefile @@ -39,12 +39,7 @@ all: $(OBJS) $(DIRS) objlst.mk objlst.mk: $(OBJS) $(DIRS) ./mklst $@ -dep: inc-dep - $(FORALL) - clean: - $(FORALL) rm -f $(TBLS) objlst.mk - include deps.mk diff --git a/src/libmach/coff32/Makefile b/src/libmach/coff32/Makefile @@ -24,6 +24,4 @@ OBJS =\ all: $(OBJS) -dep: inc-dep - include deps.mk diff --git a/src/libscc/Makefile b/src/libscc/Makefile @@ -23,6 +23,4 @@ $(TARGET): $(OBJS) $(AR) $(PROJ_ARFLAGS) $@ $? $(RL) $(PROJ_RLFLAGS) $@ -dep: inc-dep - include deps.mk diff --git a/tests/Makefile b/tests/Makefile @@ -10,8 +10,12 @@ DIRS =\ libc/execute\ cc/execute cc/error\ -PROJECTDIR = .. -include $(PROJECTDIR)/scripts/rules.mk - all clean: - $(FORALL) + for i in $(DIRS);\ + do \ + cd $$i;\ + $(MAKE) $@;\ + cd -;\ + done + +dep: