summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-08-11 01:23:29 +0000
committerEric Andersen <andersen@codepoet.org>2000-08-11 01:23:29 +0000
commit84866232d9644a02d613e11710d0f3abe8c7a66e (patch)
treea049bcdec016a50126beb40941fc786aa4a8b150
parent3973dd83bfc875c6ec2d71b99f17e72b578d517d (diff)
Yet more updates. Getting closer....
-Erik
-rw-r--r--Makefile1
-rw-r--r--include/stdio.h9
-rw-r--r--include/unistd.h1
-rw-r--r--libc/stdlib/Makefile57
-rw-r--r--libc/string/Makefile33
-rw-r--r--libc/sysdeps/linux/i386/Makefile34
6 files changed, 65 insertions, 70 deletions
diff --git a/Makefile b/Makefile
index 1a143cfd0..d47ad04ce 100644
--- a/Makefile
+++ b/Makefile
@@ -58,4 +58,5 @@ dummy:
clean:
-rm -f `find -name \*.[oa]` `find -name \*~` core
-rm -rf include/asm include/net include/linux
+ make -C test clean
diff --git a/include/stdio.h b/include/stdio.h
index 5f944f1f7..654cb8e55 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -172,6 +172,15 @@ extern int vfprintf __P ((FILE *__restrict __s,
extern int vsprintf __P ((char *__restrict __s,
__const char *__restrict __format,
va_list __arg));
+/* Maximum chars of output to write in MAXLEN. */
+extern int snprintf __P ((char *__restrict __s, size_t __maxlen,
+ __const char *__restrict __format, ...))
+ __attribute__ ((__format__ (__printf__, 3, 4)));
+/* Maximum chars of output to write in MAXLEN. */
+extern int vsnprintf __P ((char *__restrict __s, size_t __maxlen,
+ __const char *__restrict __format,
+ va_list __arg))
+ __attribute__ ((__format__ (__printf__, 3, 0)));
diff --git a/include/unistd.h b/include/unistd.h
index 6c2d1cece..d8a25dfa1 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -30,6 +30,7 @@ extern void usleep __P ((unsigned long __microseconds));
extern int pause __P ((void));
extern char* crypt __P((__const char *__key, __const char *__salt));
extern int isatty __P ((int __fd));
+extern char *ttyname __P ((int __fd));
extern int readlink __P ((__const char *__path, char *__buf, size_t __len));
extern int link __P ((__const char *__from, __const char *__to));
extern int symlink __P ((__const char *__from, __const char *__to));
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index 6f33f8afc..a7cf3a844 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -4,56 +4,39 @@
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
-LIBC=../libc.a
MSRC=aliases.c
-MOBJ=abs.o remove.o creat.o bcopy.o bzero.o
-# raise.o bcmp.o index.o rindex.o
+MOBJ=abs.o remove.o creat.o bcopy.o bzero.o
+ # raise.o bcmp.o index.o rindex.o
+MSRC2=atexit.c
+MOBJ2=on_exit.o atexit.o __do_exit.o exit.o
-ESRC=atexit.c
-EOBJ=on_exit.o atexit.o __do_exit.o exit.o
+CFILES=atoi.c atol.c ltoa.c ltostr.c ctype.c qsort.c bsearch.c rand.c lsearch.c \
+ getopt.c glob.c fnmatch.c itoa.c strtod.c strtol.c crypt.c sleep.c \
+ mkstemp.c mktemp.c realpath.c getenv.c putenv.c popen.c system.c \
+ getcwd.c setenv.c execl.c execv.c execlp.c execvp.c execvep.c
+COBJS=$(patsubst %.c,%.o, $(CFILES))
-GOBJ=atoi.o atol.o ltoa.o ltostr.o \
- ctype.o qsort.o bsearch.o rand.o lsearch.o getopt.o \
- glob.o fnmatch.o itoa.o strtol.o crypt.o sleep.o mkstemp.o \
- mktemp.o realpath.o
-UOBJ=getenv.o putenv.o popen.o system.o getcwd.o setenv.o \
- execl.o execv.o execlp.o execvp.o execvep.o
+all: $(COBJS) $(MOBJ) $(MOBJ2) $(LIBC)
-OBJ=$(MOBJ) $(EOBJ) $(GOBJ) $(UOBJ)
+$(COBJS): $(CFILES)
+ $(CC) $(CFLAGS) -c $*.c -o $@
-## No ELKS strtod() until BCC does 16 bit FP...
-#ifneq ($(LIB_CPU),i86)
-#OBJ+=strtod.o
-#endif
+$(MOBJ): $(MSRC)
+ $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
-all: $(LIBC)
+$(MOBJ2): $(MSRC2)
+ $(CC) $(CFLAGS) -DL_$* -c $(MSRC2) -o $@
-$(LIBC): $(LIBC)($(OBJ))
-
-$(LIBC)($(MOBJ)): $(MSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-
-$(LIBC)($(EOBJ)): $(ESRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
+$(LIBC): $(COBJS) $(MOBJ) $(MOBJ2)
+ $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ) $(MOBJ2)
clean:
- rm -f *.o libc.a
-
-$(LIBC)(strtol.o): strtol.c
- $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c
- $(AR) $(ARFLAGS) $@ $*.o
+ rm -f *.o
-$(LIBC)(strtod.o): strtod.c
- $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c
- $(AR) $(ARFLAGS) $@ $*.o
-$(LIBC)(crypt.o): crypt.c
- $(CC) -c -ansi $(ARCH) $(CCFLAGS) $(DEFS) $*.c
- $(AR) $(ARFLAGS) $@ $*.o
diff --git a/libc/string/Makefile b/libc/string/Makefile
index b190adb0f..35c09565c 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -4,28 +4,29 @@
TOPDIR=../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
-LIBC=../libc.a
+MSRC=string.c
+MOBJ=strlen.o strcat.o strcpy.o strcmp.o strncat.o strncpy.o strncmp.o \
+ strchr.o strrchr.o strdup.o memcpy.o memccpy.o memchr.o memset.o \
+ memcmp.o memmove.o movedata.o
+CFILES=strpbrk.c strsep.c strstr.c strtok.c strcspn.c \
+ strspn.c strcasecmp.c strncasecmp.c config.c
+COBJS=$(patsubst %.c,%.o, $(CFILES))
-SSRC=string.c
-SOBJ=strlen.o strcat.o strcpy.o strcmp.o strncat.o strncpy.o strncmp.o \
- strchr.o strrchr.o strdup.o memcpy.o memccpy.o memchr.o memset.o \
- memcmp.o memmove.o movedata.o
-OBJ=strpbrk.o strsep.o strstr.o strtok.o strcspn.o \
- strspn.o strcasecmp.o strncasecmp.o config.o
+all: $(COBJS) $(MOBJ) $(LIBC)
-all: $(LIBC)
+$(COBJS): $(CFILES)
+ $(CC) $(CFLAGS) -c $*.c -o $@
-$(LIBC): $(LIBC)($(SOBJ)) $(OBJ)
+$(MOBJ): $(MSRC)
+ $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
-$(LIBC)($(SOBJ)): $(SSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
-
-transfer:
- -@rm -f ../include/string.h
- cp -p string.h ../include/.
+$(LIBC): $(COBJS) $(MOBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ)
clean:
rm -f *.o
+
+
diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile
index 57fed3bf4..165d16cbd 100644
--- a/libc/sysdeps/linux/i386/Makefile
+++ b/libc/sysdeps/linux/i386/Makefile
@@ -5,31 +5,31 @@
TOPDIR=../../../
include $(TOPDIR)Rules.make
+LIBC=$(TOPDIR)libc.a
CFLAGS+= -D_GCC_LIMITS_H_
-LIBC=$(TOPDIR)libc.a
+MSRC=syscalls.S
+include makefile.objs
+SFILES=setjmp.S longjmp.S _start.S _exit.S #fork.o
+SOBJS=$(patsubst %.S,%.o, $(SFILES))
+CFILES=readdir.c #select.c
+COBJS=$(patsubst %.c,%.o, $(CFILES))
-.S.s:
- $(CC) $(CFLAGS) -D__ASSEMBLY__ -traditional -E -o $*.s $<
-.S.o:
- $(CC) $(CFLAGS) -c -o $*.o $<
-SSRC=syscalls.S
-OBJ= setjmp.o longjmp.o readdir.o _start.o _exit.o fork.o #select.o
-include makefile.objs
+all: $(SOBJS) $(COBJS) $(MOBJ) $(LIBC)
-all: $(LIBC)
+$(SOBJS): $(SFILES)
+ $(CC) $(CFLAGS) -c $*.S -o $@
-$(LIBC): $(OBJ) $(LIBC)($(SOBJ))
- $(AR) $(ARFLAGS) $@ $(OBJ)
+$(COBJS): $(CFILES)
+ $(CC) $(CFLAGS) -c $*.c -o $@
-$(LIBC)($(SOBJ)): $(SSRC)
- $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
- $(AR) $(ARFLAGS) $@ $*.o
+$(MOBJ): $(MSRC)
+ $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@
-transfer:
- -@rm -f ../include/stdio.h
- cp -p stdio.h ../include/.
+$(LIBC): $(SOBJS) $(COBJS) $(MOBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(SOBJS) $(COBJS) $(MOBJ)
clean:
rm -f *.o
+