From eb2ecd0b083611bdd07c5352ffc9cfa22e0de711 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 4 Oct 2000 23:26:55 +0000 Subject: Fix all the makefiles. Clean up some warnings, cleanup some headers. -Erik --- Makefile | 86 ++++++++---------- include/a.out.h | 115 ------------------------ include/alloca.h | 41 --------- include/features.h | 6 ++ include/regex.h | 18 ++-- include/stdlib.h | 140 ++++++++++++++--------------- libc/inet/Makefile | 61 ++++++++----- libc/inet/rpc/Makefile | 52 ++++++++--- libc/misc/regex/Makefile | 37 ++++++-- libc/misc/regex/rx.c | 36 +++++--- libc/misc/time/Makefile | 37 +++++--- libc/pwd_grp/Makefile | 30 +++++-- libc/stdio/Makefile | 66 ++++++++------ libc/stdlib/Makefile | 50 +++++++---- libc/stdlib/malloc/Makefile | 32 +++++-- libc/string/Makefile | 42 ++++++--- libc/sysdeps/Makefile | 47 ++++++++-- libc/sysdeps/linux/Makefile | 52 ++++++++--- libc/sysdeps/linux/common/Makefile | 37 +++++--- libc/sysdeps/linux/common/kernel_version.c | 115 ++++++++---------------- libc/sysdeps/linux/i386/Makefile | 54 +++++++---- libc/termios/Makefile | 55 ++++++++---- libc/termios/termios.c | 4 +- test/Makefile | 57 +++++++----- 24 files changed, 678 insertions(+), 592 deletions(-) delete mode 100644 include/a.out.h delete mode 100644 include/alloca.h diff --git a/Makefile b/Makefile index d47ad04ce..442083cba 100644 --- a/Makefile +++ b/Makefile @@ -1,62 +1,54 @@ -DIRS = headers error getent malloc-simple misc regex stdio2 \ +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + +DIRS = error getent malloc misc regex stdio \ string termios time sysdeps #rpc - all: libc.a -libc.a: $(DIRS) dummy +libc.a: subdirs headers @echo @echo Finally finished compiling... @echo $(CROSS)ranlib $@ -headers: dummy - if [ ! -L "include/asm" ]; then ln -s /usr/src/linux/include/asm include/asm ; fi - if [ ! -L "include/net" ]; then ln -s /usr/src/linux/include/net include/net ; fi - if [ ! -L "include/linux" ]; then ln -s /usr/src/linux/include/linux include/linux ; fi - -error: dummy - make -C error - -getent: dummy - make -C getent - -malloc-simple: dummy - make -C malloc-simple - -misc: dummy - make -C misc - -net: dummy - make -C net - -regex: dummy - make -C regex - -rpc: dummy - make -C rpc -stdio2: dummy - make -C stdio2 - -string: dummy - make -C string - -sysdeps: dummy - make -C sysdeps - -termios: dummy - make -C termios - -time: dummy - make -C time +headers: dummy + @if [ ! -L "include/asm" ]; then ln -s /usr/src/linux/include/asm include/asm ; fi + @if [ ! -L "include/net" ]; then ln -s /usr/src/linux/include/net include/net ; fi + @if [ ! -L "include/linux" ]; then ln -s /usr/src/linux/include/linux include/linux ; fi tags: ctags -R -dummy: +clean: subdirs_clean + +subdirs: $(patsubst %, _dir_%, $(DIRS)) +subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) + +$(patsubst %, _dir_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dir_%, %, $@) + +$(patsubst %, _dirclean_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean -clean: - -rm -f `find -name \*.[oa]` `find -name \*~` core - -rm -rf include/asm include/net include/linux - make -C test clean +.PHONY: dummy diff --git a/include/a.out.h b/include/a.out.h deleted file mode 100644 index bd58346c1..000000000 --- a/include/a.out.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 1990-1996 - * This file is part of the ld86 command for Linux-86 - * It is distributed under the GNU Library General Public License. - * - * - This may actually be BSD or Minix code, can someone clarify please. -RDB - */ - -#ifndef __AOUT_H -#define __AOUT_H - -struct exec { /* a.out header */ - unsigned char a_magic[2]; /* magic number */ - unsigned char a_flags; /* flags, see below */ - unsigned char a_cpu; /* cpu id */ - unsigned char a_hdrlen; /* length of header */ - unsigned char a_unused; /* reserved for future use */ - unsigned short a_version; /* version stamp (not used at present) */ - long a_text; /* size of text segement in bytes */ - long a_data; /* size of data segment in bytes */ - long a_bss; /* size of bss segment in bytes */ - long a_entry; /* entry point */ - long a_total; /* total memory allocated */ - long a_syms; /* size of symbol table */ - - /* SHORT FORM ENDS HERE */ - long a_trsize; /* text relocation size */ - long a_drsize; /* data relocation size */ - long a_tbase; /* text relocation base */ - long a_dbase; /* data relocation base */ -}; - -#define A_MAGIC0 (unsigned char) 0x01 -#define A_MAGIC1 (unsigned char) 0x03 -#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1) - -/* CPU Id of TARGET machine (byte order coded in low order two bits) */ -#define A_NONE 0x00 /* unknown */ -#define A_I8086 0x04 /* intel i8086/8088 */ -#define A_M68K 0x0B /* motorola m68000 */ -#define A_NS16K 0x0C /* national semiconductor 16032 */ -#define A_I80386 0x10 /* intel i80386 */ -#define A_SPARC 0x17 /* Sun SPARC */ - -#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */ -#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */ - -/* Flags. */ -#define A_UZP 0x01 /* unmapped zero page (pages) */ -#define A_PAL 0x02 /* page aligned executable */ -#define A_NSYM 0x04 /* new style symbol table */ -#define A_EXEC 0x10 /* executable */ -#define A_SEP 0x20 /* separate I/D */ -#define A_PURE 0x40 /* pure text */ -#define A_TOVLY 0x80 /* text overlay */ - -/* Offsets of various things. */ -#define A_MINHDR 32 -#define A_TEXTPOS(X) ((long)(X).a_hdrlen) -#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text) -#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR) -#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8)) -#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16)) -#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24)) -#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data) -#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize) -#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \ - ((X).a_trsize + (X).a_drsize) : 0)) - -struct reloc { - long r_vaddr; /* virtual address of reference */ - unsigned short r_symndx; /* internal segnum or extern symbol num */ - unsigned short r_type; /* relocation type */ -}; - -/* r_tyep values: */ -#define R_ABBS 0 -#define R_RELLBYTE 2 -#define R_PCRBYTE 3 -#define R_RELWORD 4 -#define R_PCRWORD 5 -#define R_RELLONG 6 -#define R_PCRLONG 7 -#define R_REL3BYTE 8 -#define R_KBRANCHE 9 - -/* r_symndx for internal segments */ -#define S_ABS ((unsigned short)-1) -#define S_TEXT ((unsigned short)-2) -#define S_DATA ((unsigned short)-3) -#define S_BSS ((unsigned short)-4) - -struct nlist { /* symbol table entry */ - char n_name[8]; /* symbol name */ - long n_value; /* value */ - unsigned char n_sclass; /* storage class */ - unsigned char n_numaux; /* number of auxiliary entries (not used) */ - unsigned short n_type; /* language base and derived type (not used) */ -}; - -/* Low bits of storage class (section). */ -#define N_SECT 07 /* section mask */ -#define N_UNDF 00 /* undefined */ -#define N_ABS 01 /* absolute */ -#define N_TEXT 02 /* text */ -#define N_DATA 03 /* data */ -#define N_BSS 04 /* bss */ -#define N_COMM 05 /* (common) */ - -/* High bits of storage class. */ -#define N_CLASS 0370 /* storage class mask */ -#define C_NULL -#define C_EXT 0020 /* external symbol */ -#define C_STAT 0030 /* static */ - -#endif /* _AOUT_H */ diff --git a/include/alloca.h b/include/alloca.h deleted file mode 100644 index 741eca743..000000000 --- a/include/alloca.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright (C) 1992, 1996, 1997, 1998 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _ALLOCA_H -#define _ALLOCA_H 1 - -#include - -#define __need_size_t -#include - -__BEGIN_DECLS - -/* Remove any previous definitions. */ -#undef alloca - -/* Allocate a block that will be freed when the calling function exits. */ -extern __ptr_t alloca __P ((size_t __size)); - -#ifdef __GNUC__ -# define alloca(size) __builtin_alloca (size) -#endif /* GCC. */ - -__END_DECLS - -#endif /* alloca.h */ diff --git a/include/features.h b/include/features.h index d97a1aff2..dd2c5ae03 100644 --- a/include/features.h +++ b/include/features.h @@ -9,6 +9,11 @@ #define __UCLIBC_MAJOR__ 9 #define __UCLIBC_MINOR__ 1 +/* Make a half-hearted attempt to accomodate non-gcc compilers */ +#ifndef __GNUC__ +#define __attribute(foo) /* Ignore */ +#endif + /* __restrict is known in EGCS 1.2 and above. */ #if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92) # define __restrict /* Ignore */ @@ -49,6 +54,7 @@ #define __USE_POSIX2 #define _POSIX_THREAD_SAFE_FUNCTIONS + #include diff --git a/include/regex.h b/include/regex.h index 813882c42..64a8de685 100644 --- a/include/regex.h +++ b/include/regex.h @@ -1568,9 +1568,9 @@ typedef void (*rx_hash_freefn) (); #ifdef __STDC__ -RX_DECL int rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b); +//RX_DECL int rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b); RX_DECL int rx_bitset_is_subset (int size, rx_Bitset a, rx_Bitset b); -RX_DECL int rx_bitset_empty (int size, rx_Bitset set); +//RX_DECL int rx_bitset_empty (int size, rx_Bitset set); RX_DECL void rx_bitset_null (int size, rx_Bitset b); RX_DECL void rx_bitset_universe (int size, rx_Bitset b); RX_DECL void rx_bitset_complement (int size, rx_Bitset b); @@ -1579,9 +1579,9 @@ RX_DECL void rx_bitset_union (int size, rx_Bitset a, rx_Bitset b); RX_DECL void rx_bitset_intersection (int size, rx_Bitset a, rx_Bitset b); RX_DECL void rx_bitset_difference (int size, rx_Bitset a, rx_Bitset b); -RX_DECL void rx_bitset_revdifference (int size, - rx_Bitset a, rx_Bitset b); -RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b); +//RX_DECL void rx_bitset_revdifference (int size, +// rx_Bitset a, rx_Bitset b); +//RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b); RX_DECL unsigned long rx_bitset_hash (int size, rx_Bitset b); RX_DECL struct rx_hash_item * rx_hash_find (struct rx_hash * table, unsigned long hash, @@ -1616,8 +1616,8 @@ RX_DECL struct rexp_node * rx_mk_r_2phase_star (struct rx * rx, struct rexp_node * b); RX_DECL struct rexp_node * rx_mk_r_side_effect (struct rx * rx, rx_side_effect a); -RX_DECL struct rexp_node * rx_mk_r_data (struct rx * rx, - void * a); +//RX_DECL struct rexp_node * rx_mk_r_data (struct rx * rx, +// void * a); RX_DECL void rx_free_rexp (struct rx * rx, struct rexp_node * node); RX_DECL struct rexp_node * rx_copy_rexp (struct rx *rx, struct rexp_node *node); @@ -2803,8 +2803,8 @@ rx_search (rxb, startpos, range, stop, total_size, */ { - struct rx_inx * next_tr_table; - struct rx_inx * this_tr_table; + struct rx_inx * next_tr_table = NULL; + struct rx_inx * this_tr_table = NULL; /* The fastest route through the loop is when the instruction * is RX_NEXT_CHAR. This case is detected when SEARCH_STATE.IFR->DATA diff --git a/include/stdlib.h b/include/stdlib.h index d323d099b..b1ae61d06 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,6 +1,7 @@ -/* stdlib.h */ +/* stdlib.h */ #include #include +#include #ifndef __STDLIB_H #define __STDLIB_H @@ -10,102 +11,101 @@ #define NULL ((void *) 0) #endif -/* For program termination */ -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 +/* We define these the same for all machines. + * Changes from this to the outside world should be done in `_exit'. */ +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ -/* Call all functions registered with `atexit' and `on_exit', - * in the reverse of the order in which they were registered - * perform stdio cleanup, and terminate program execution with STATUS. */ -extern void exit __P ((int __status)) __attribute__ ((__noreturn__)); -/* Register a function to be called when `exit' is called. */ -extern int atexit __P ((void (*__func) (void))); -/* Abort execution and generate a core-dump. */ -extern void abort __P ((void)) __attribute__ ((__noreturn__)); +/* The largest number rand will return */ +#define RAND_MAX INT_MIN -extern void * malloc __P ((size_t)); -extern void * calloc __P ((size_t, size_t)); -extern void free __P ((void *)); -extern void * realloc __P ((void *, size_t)); +/* Maximum length of a multibyte character in the current locale. */ +#define MB_CUR_MAX 1 -#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC -# include -#endif /* Use GNU, BSD, or misc. */ +typedef struct +{ + int quot; /* Quotient. */ + int rem; /* Remainder. */ +} div_t; -#ifdef DEBUG_MALLOC +typedef struct +{ + long int quot; /* Quotient. */ + long int rem; /* Remainder. */ +} ldiv_t; -extern void * malloc_dbg __P ((size_t, char* func, char* file, int line)); -extern void * calloc_dbg __P ((size_t, size_t, char* func, char* file, int line)); -extern void free_dbg __P ((void *, char* func, char* file, int line)); -extern void * realloc_dbg __P ((void *, size_t, char* func, char* file, int line)); +/* comparison function used by bsearch() and qsort() */ +typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); +typedef __compar_fn_t comparison_fn_t; -#define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__) -#define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__) -#define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__) -#define realloc(x) realloc((x),__FUNCTION__,__FILE__,__LINE__) +/* String to number conversion functions */ +#define atof(x) strtod((x),(char**)0) +#define atoi(x) (int)strtol((x),(char**)0,10) +#define atol(x) strtol((x),(char**)0,10) +extern long strtol __P ((const char * nptr, char ** endptr, int base)); +extern unsigned long strtoul __P ((const char * nptr, char ** endptr, int base)); +#ifndef __HAS_NO_FLOATS__ +extern char * gcvt __P ((float number, size_t ndigit, char * buf)); +extern float strtod __P ((const char * nptr, char ** endptr)); #endif + + +/* Random number functions */ extern int rand __P ((void)); extern void srand __P ((unsigned int seed)); -extern long strtol __P ((const char * nptr, char ** endptr, int base)); -extern unsigned long strtoul __P ((const char * nptr, - char ** endptr, int base)); -#ifndef __HAS_NO_FLOATS__ -extern float strtod __P ((const char * nptr, char ** endptr)); + +/* Memory management functions */ +extern __ptr_t alloca __P ((size_t __size)); +extern __ptr_t calloc __P ((size_t, size_t)); +extern __ptr_t malloc __P ((size_t)); +extern __ptr_t realloc __P ((__ptr_t, size_t)); +extern void free __P ((__ptr_t)); + +#ifdef DEBUG_MALLOC +extern __ptr_t malloc_dbg __P ((size_t, char* func, char* file, int line)); +extern __ptr_t calloc_dbg __P ((size_t, size_t, char* func, char* file, int line)); +extern void free_dbg __P ((__ptr_t, char* func, char* file, int line)); +extern __ptr_t realloc_dbg __P ((__ptr_t, size_t, char* func, char* file, int line)); +#define malloc(x) malloc_dbg((x),__FUNCTION__,__FILE__,__LINE__) +#define calloc(x,y) calloc_dbg((x),(y),__FUNCTION__,__FILE__,__LINE__) +#define free(x) free_dbg((x),__FUNCTION__,__FILE__,__LINE__) +#define realloc(x) realloc((x),__FUNCTION__,__FILE__,__LINE__) #endif -extern char *getenv __P ((__const char *__name)); -extern int putenv __P ((__const char *__string)); +/* System and environment functions */ +extern void abort __P ((void)) __attribute__ ((__noreturn__)); +extern int atexit __P ((void (*__func) (void))); +extern void exit __P ((int __status)) __attribute__ ((__noreturn__)); +extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); +extern char *getenv __P ((__const char *__name)); +extern int putenv __P ((__const char *__string)); +extern char *realpath __P ((__const char *__restrict __name, + char *__restrict __resolved)); extern int setenv __P ((__const char *__name, __const char *__value, int __replace)); -extern void unsetenv __P ((__const char *__name)); - extern int system __P ((__const char *__command)); +extern void unsetenv __P ((__const char *__name)); -extern char * gcvt __P ((float number, size_t ndigit, char * buf)); - -#if defined __USE_BSD || defined __USE_XOPEN_EXTENDED -/* Return the canonical absolute name of file NAME. The last file name - * component need not exist, and may be a symlink to a nonexistent file. - * If RESOLVED is null, the result is malloc'd; otherwise, if the canonical - * name is PATH_MAX chars or more, returns null with `errno' set to - * ENAMETOOLONG; if the name fits in fewer than PATH_MAX chars, returns the - * name in RESOLVED. */ -extern char *realpath __P ((__const char *__restrict __name, - char *__restrict __resolved)); -#endif -/* Shorthand for type of comparison functions. */ -typedef int (*__compar_fn_t) __P ((__const __ptr_t, __const __ptr_t)); -typedef __compar_fn_t comparison_fn_t; -/* Sort NMEMB elements of BASE, of SIZE bytes each, - using COMPAR to perform the comparisons. */ +/* Search and sort functions */ +extern __ptr_t bsearch __P ((__const __ptr_t __key, __const __ptr_t __base, + size_t __nmemb, size_t __size, __compar_fn_t __compar)); extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size, __compar_fn_t __compar)); -#define atof(x) strtod((x),(char**)0) -#define atoi(x) (int)strtol((x),(char**)0,10) -#define atol(x) strtol((x),(char**)0,10) -/* Returned by `div'. */ -typedef struct - { - int quot; /* Quotient. */ - int rem; /* Remainder. */ - } div_t; - -/* Returned by `ldiv'. */ -typedef struct - { - long int quot; /* Quotient. */ - long int rem; /* Remainder. */ - } ldiv_t; +/* Integer math functions */ +extern int abs __P ((int __x)) __attribute__ ((__const__)); +extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__)); +extern long int labs __P ((long int __x)) __attribute__ ((__const__)); +extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__)); diff --git a/libc/inet/Makefile b/libc/inet/Makefile index b73a5499e..519501180 100644 --- a/libc/inet/Makefile +++ b/libc/inet/Makefile @@ -1,37 +1,50 @@ -# Copyright (C) 1995,1996 Robert de Bath -# Copyright (C) 1998-1999 D. Jeff Dionne -# Copyright (C) 1998 Kenneth Albanowski -# Copyright (C) 1999 D. Jeff Dionne -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a -LIBC=../libc.a +MSRC=addr.c +MOBJ=inet_aton.o inet_addr.o inet_ntoa.o -ASRC=addr.c -AOBJ=inet_aton.o inet_addr.o inet_ntoa.o +MSRC2=resolv.c +MOBJ2=encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \ + decodeq.o lengthq.o encodea.o decodea.o encodep.o decodep.o \ + formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \ + opennameservers.o closenameservers.o resolvename.o gethostbyname.o\ + gethostbyaddr.o -RSRC=resolv.c -ROBJ= encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \ -decodeq.o lengthq.o encodea.o decodea.o encodep.o decodep.o \ -formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \ -opennameservers.o closenameservers.o resolvename.o gethostbyname.o\ -gethostbyaddr.o +all: $(MOBJ) $(MOBJ2) $(LIBC) -OBJ=$(AOBJ) $(ROBJ) +$(LIBC): $(MOBJ) $(MOBJ2) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2) -all: $(LIBC) - -$(LIBC): $(LIBC)($(OBJ)) - -$(LIBC)($(AOBJ)): $(ASRC) +$(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o -$(LIBC)($(ROBJ)): $(RSRC) +$(MOBJ2): $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o clean: - rm -f *.o libc.a + rm -f *.[oa] *~ core + diff --git a/libc/inet/rpc/Makefile b/libc/inet/rpc/Makefile index e2c867703..907d55deb 100644 --- a/libc/inet/rpc/Makefile +++ b/libc/inet/rpc/Makefile @@ -1,25 +1,49 @@ +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + TOPDIR=../ include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a CFLAGS+=-I$(TOPDIR)include/linux -OBJS = auth_none.o auth_unix.o authunix_prot.o \ - bindresvport.o clnt_generic.o clnt_perror.o \ - clnt_raw.o clnt_simple.o clnt_tcp.o clnt_udp.o \ - get_myaddress.o getrpcent.o getrpcport.o pmap_clnt.o \ - pmap_getmaps.o pmap_getport.o pmap_prot.o pmap_prot2.o \ - pmap_rmt.o rpc_callmsg.o rpc_commondata.o \ - rpc_dtablesize.o rpc_prot.o svc.o svc_auth.o \ - svc_auth_unix.o svc_raw.o svc_run.o svc_simple.o \ - svc_tcp.o svc_udp.o xdr.o xdr_array.o xdr_float.o \ - xdr_mem.o xdr_rec.o xdr_reference.o xdr_stdio.o +CSRC = auth_none.c auth_unix.c authunix_prot.c \ + bindresvport.c clnt_generic.c clnt_perror.c \ + clnt_raw.c clnt_simple.c clnt_tcp.c clnt_udp.c \ + get_myaddress.c getrpcent.c getrpcport.c pmap_clnt.c \ + pmap_getmaps.c pmap_getport.c pmap_prot.c pmap_prot2.c \ + pmap_rmt.c rpc_callmsg.c rpc_commondata.c \ + rpc_dtablesize.c rpc_prot.c svc.c svc_auth.c \ + svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \ + svc_tcp.c svc_udp.c xdr.c xdr_array.c xdr_float.c \ + xdr_mem.c xdr_rec.c xdr_reference.c xdr_stdio.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) -LIBC = ../libc.a +all: $(COBJS) $(LIBC) -all: $(LIBC) +$(LIBC): $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(COBJS) -$(LIBC): $(LIBC)($(OBJS)) +$(COBJS): $(CSRC) clean: rm -f *.[oa] *~ core - diff --git a/libc/misc/regex/Makefile b/libc/misc/regex/Makefile index c6c8d8e52..ad0745020 100644 --- a/libc/misc/regex/Makefile +++ b/libc/misc/regex/Makefile @@ -1,17 +1,36 @@ +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. + TOPDIR=../ include $(TOPDIR)Rules.make - -LIBC=../libc.a +LIBC=$(TOPDIR)libc.a OBJ=rx.o -all: $(LIBC) +all: $(OBJ) $(LIBC) -$(LIBC): $(LIBC)($(OBJ)) - -$(LIBC)(rx.o): rx.c - $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o +$(LIBC): $(OBJ) + $(AR) $(ARFLAGS) $(LIBC) $(OBJ) clean: - rm -f libc.a *.o core mon.out timer.t.h dMakefile dtr try timer + rm -f *.[oa] *~ core + diff --git a/libc/misc/regex/rx.c b/libc/misc/regex/rx.c index 8e85782f2..1abff8cc5 100644 --- a/libc/misc/regex/rx.c +++ b/libc/misc/regex/rx.c @@ -161,8 +161,8 @@ RX_DECL struct rexp_node struct rexp_node *); RX_DECL struct rexp_node *rx_mk_r_side_effect (struct rx *, rx_side_effect); -RX_DECL struct rexp_node - *rx_mk_r_data (struct rx *, void *); +//RX_DECL struct rexp_node +// *rx_mk_r_data (struct rx *, void *); RX_DECL void rx_free_rexp (struct rx *, struct rexp_node *); RX_DECL struct rexp_node *rx_copy_rexp (struct rx *, struct rexp_node *); @@ -486,9 +486,9 @@ print_fastmap (fm) /* This page: Bitsets. Completely unintersting. */ -RX_DECL int rx_bitset_is_equal (int, rx_Bitset, rx_Bitset); +//RX_DECL int rx_bitset_is_equal (int, rx_Bitset, rx_Bitset); RX_DECL int rx_bitset_is_subset (int, rx_Bitset, rx_Bitset); -RX_DECL int rx_bitset_empty (int, rx_Bitset); +//RX_DECL int rx_bitset_empty (int, rx_Bitset); RX_DECL void rx_bitset_null (int, rx_Bitset); RX_DECL void rx_bitset_complement (int, rx_Bitset); RX_DECL void rx_bitset_complement (int, rx_Bitset); @@ -496,11 +496,14 @@ RX_DECL void rx_bitset_assign (int, rx_Bitset, rx_Bitset); RX_DECL void rx_bitset_union (int, rx_Bitset, rx_Bitset); RX_DECL void rx_bitset_intersection (int, rx_Bitset, rx_Bitset); RX_DECL void rx_bitset_difference (int, rx_Bitset, rx_Bitset); -RX_DECL void rx_bitset_revdifference (int, rx_Bitset, rx_Bitset); +//RX_DECL void rx_bitset_revdifference (int, rx_Bitset, rx_Bitset); +#ifdef emacs RX_DECL void rx_bitset_xor (int, rx_Bitset, rx_Bitset); +#endif RX_DECL unsigned long rx_bitset_hash (int, rx_Bitset); +#if 0 #ifdef __STDC__ RX_DECL int rx_bitset_is_equal (int size, rx_Bitset a, rx_Bitset b) @@ -522,6 +525,7 @@ rx_bitset_is_equal (size, a, b) b[0] = s; return !x && s == a[0]; } +#endif #ifdef __STDC__ RX_DECL int @@ -539,7 +543,7 @@ rx_bitset_is_subset (size, a, b) return x == -1; } - +#if 0 #ifdef __STDC__ RX_DECL int rx_bitset_empty (int size, rx_Bitset set) @@ -558,6 +562,7 @@ rx_bitset_empty (size, set) set[0] = s; return !s; } +#endif #ifdef __STDC__ RX_DECL void @@ -676,6 +681,7 @@ rx_bitset_difference (size, a, b) } +#if 0 #ifdef __STDC__ RX_DECL void rx_bitset_revdifference (int size, @@ -692,7 +698,10 @@ rx_bitset_revdifference (size, a, b) for (x = rx_bitset_numb_subsets(size) - 1; x >=0; --x) a[x] = ~a[x] & b[x]; } +#endif + +#ifdef emacs #ifdef __STDC__ RX_DECL void rx_bitset_xor (int size, rx_Bitset a, rx_Bitset b) @@ -708,6 +717,7 @@ rx_bitset_xor (size, a, b) for (x = rx_bitset_numb_subsets(size) - 1; x >=0; --x) a[x] ^= b[x]; } +#endif #ifdef __STDC__ @@ -1305,6 +1315,7 @@ rx_mk_r_side_effect (rx, a) } +#if 0 #ifdef __STDC__ RX_DECL struct rexp_node * rx_mk_r_data (struct rx * rx, @@ -1324,6 +1335,7 @@ rx_mk_r_data (rx, a) } return n; } +#endif #ifdef __STDC__ RX_DECL void @@ -5744,11 +5756,13 @@ rx_compile (pattern, size, syntax, rxb) handle_close: /* See similar code for backslashed left paren above. */ - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_char; - else - return REG_ERPAREN; + if (COMPILE_STACK_EMPTY) { + if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) { + goto normal_char; + } else { + return REG_ERPAREN; + } + } /* Since we just checked for an empty stack above, this ``can't happen''. */ diff --git a/libc/misc/time/Makefile b/libc/misc/time/Makefile index 2ee2a14e0..252a67e09 100644 --- a/libc/misc/time/Makefile +++ b/libc/misc/time/Makefile @@ -1,20 +1,37 @@ -# Copyright (C) 1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make - -CFLAGS+=-I$(TOPDIR)include/linux - -LIBC=../libc.a +LIBC=$(TOPDIR)libc.a OBJ=localtime.o gmtime.o asctime.o ctime.o asc_conv.o tm_conv.o mktime.o \ localtime_r.o gmtime_r.o asctime_r.o ctime_r.o -all: $(LIBC) +all: $(OBJ) $(LIBC) -$(LIBC): $(LIBC)($(OBJ)) +$(LIBC): $(OBJ) + $(AR) $(ARFLAGS) $(LIBC) $(OBJ) clean: - rm -f *.o libc.a + rm -f *.[oa] *~ core + diff --git a/libc/pwd_grp/Makefile b/libc/pwd_grp/Makefile index efcb9c502..a8a916525 100644 --- a/libc/pwd_grp/Makefile +++ b/libc/pwd_grp/Makefile @@ -1,19 +1,37 @@ -# Copyright (C) 1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make - LIBC=$(TOPDIR)libc.a OBJ=__getpwent.o pwent.o getpwnam.o getpwuid.o putpwent.o getpw.o fgetpwent.o \ __getgrent.o grent.o getgrnam.o getgrgid.o fgetgrent.o initgroups.o \ utent.o -all: $(LIBC)($(OBJ)) +all: $(OBJ) $(LIBC) $(LIBC): $(OBJ) + $(AR) $(ARFLAGS) $(LIBC) $(OBJ) clean: - rm -f *.o libc.a + rm -f *.[oa] *~ core diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 984af2106..6b0748237 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -1,48 +1,62 @@ -# Copyright (C) 1995,1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a -LIBC=../libc.a -ASRC=stdio.c -AOBJ=_stdio_init.o fputc.o fgetc.o fflush.o fgets.o gets.o fputs.o \ +MSRC=stdio.c +MOBJ=_stdio_init.o fputc.o fgetc.o fflush.o fgets.o gets.o fputs.o \ puts.o fread.o fwrite.o fopen.o fclose.o fseek.o rewind.o ftell.o \ setbuffer.o setvbuf.o ungetc.o -PSRC=printf.c -POBJ=printf.o sprintf.o fprintf.o vprintf.o vsprintf.o vfprintf.o snprintf.o vsnprintf.o +MSRC2=printf.c +MOBJ2=printf.o sprintf.o fprintf.o vprintf.o vsprintf.o vfprintf.o snprintf.o vsnprintf.o -SSRC=scanf.c -SOBJ=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o +MSRC3=scanf.c +MOBJ3=scanf.o sscanf.o fscanf.o vscanf.o vsscanf.o vfscanf.o -OBJ= $(AOBJ) $(POBJ) $(SOBJ) dputs.o +CSRC=dputs.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(LIBC) -$(LIBC): $(LIBC)($(OBJ)) +all: $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS) $(LIBC) -$(LIBC)($(AOBJ)): $(ASRC) +$(LIBC): $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2) $(MOBJ3) $(COBJS) + +$(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o -$(LIBC)($(POBJ)): $(PSRC) +$(MOBJ2): $(MSRC2) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o -$(LIBC)($(SOBJ)): $(SSRC) +$(MOBJ3): $(MSRC3) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o -#transfer: -# -@rm -f ../include/stdio.h -# cp -p stdio.h ../include/. -# -#$(LIBC)($(OBJ)): stdio.h +$(COBJS): $(CSRC) -clean: - rm -f *.o libc.a +clean: + rm -f *.[oa] *~ core diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile index a7cf3a844..3db182c5f 100644 --- a/libc/stdlib/Makefile +++ b/libc/stdlib/Makefile @@ -1,42 +1,56 @@ -# Copyright (C) 1995,1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make LIBC=$(TOPDIR)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 -CFILES=atoi.c atol.c ltoa.c ltostr.c ctype.c qsort.c bsearch.c rand.c lsearch.c \ +CSRC=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)) - +COBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(COBJS) $(MOBJ) $(MOBJ2) $(LIBC) +all: $(MOBJ) $(MOBJ2) $(COBJS) $(LIBC) -$(COBJS): $(CFILES) - $(CC) $(CFLAGS) -c $*.c -o $@ +$(LIBC): $(MOBJ) $(MOBJ2) $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ2) $(COBJS) $(MOBJ): $(MSRC) - $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@ + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o $(MOBJ2): $(MSRC2) - $(CC) $(CFLAGS) -DL_$* -c $(MSRC2) -o $@ + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o -$(LIBC): $(COBJS) $(MOBJ) $(MOBJ2) - $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ) $(MOBJ2) +$(COBJS): $(CSRC) -clean: - rm -f *.o +clean: + rm -f *.[oa] *~ core diff --git a/libc/stdlib/malloc/Makefile b/libc/stdlib/malloc/Makefile index 34c1b0538..d4ecab0b9 100644 --- a/libc/stdlib/malloc/Makefile +++ b/libc/stdlib/malloc/Makefile @@ -1,24 +1,40 @@ -# Copyright (C) 1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make - LIBC=$(TOPDIR)libc.a MSRC=alloc.c MOBJ=malloc.o realloc.o free.o calloc.o malloc_dbg.o free_dbg.o calloc_dbg.o -all: $(LIBC)($(MOBJ)) +all: $(MOBJ) $(LIBC) $(LIBC): $(MOBJ) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $(LIBC) $*.o clean: - rm -f *.o libc.a - + rm -f *.[oa] *~ core diff --git a/libc/string/Makefile b/libc/string/Makefile index 35c09565c..3af022365 100644 --- a/libc/string/Makefile +++ b/libc/string/Makefile @@ -1,6 +1,24 @@ -# Copyright (C) 1995,1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make @@ -10,23 +28,21 @@ 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 \ +CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c \ strspn.c strcasecmp.c strncasecmp.c config.c COBJS=$(patsubst %.c,%.o, $(CFILES)) +all: $(MOBJ) $(COBJS) $(LIBC) -all: $(COBJS) $(MOBJ) $(LIBC) - -$(COBJS): $(CFILES) - $(CC) $(CFLAGS) -c $*.c -o $@ +$(LIBC): $(MOBJ) $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(COBJS) $(MOBJ): $(MSRC) - $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@ + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o -$(LIBC): $(COBJS) $(MOBJ) - $(AR) $(ARFLAGS) $(LIBC) $(COBJS) $(MOBJ) +$(COBJS): $(CSRC) -clean: - rm -f *.o +clean: + rm -f *.[oa] *~ core diff --git a/libc/sysdeps/Makefile b/libc/sysdeps/Makefile index cdd7e4e24..45a34a25e 100644 --- a/libc/sysdeps/Makefile +++ b/libc/sysdeps/Makefile @@ -1,10 +1,45 @@ -all: linux +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. -linux: dummy - make -C linux +DIRS = linux + +all: libc.a + +libc.a: subdirs + +tags: + ctags -R + +clean: subdirs_clean + +subdirs: $(patsubst %, _dir_%, $(DIRS)) +subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) + +$(patsubst %, _dir_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dir_%, %, $@) + +$(patsubst %, _dirclean_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean -clean: - rm -f *.o - make -C linux clean .PHONY: dummy + diff --git a/libc/sysdeps/linux/Makefile b/libc/sysdeps/linux/Makefile index 16980d1b3..1440898b5 100644 --- a/libc/sysdeps/linux/Makefile +++ b/libc/sysdeps/linux/Makefile @@ -1,20 +1,48 @@ -# Figure out what arch to build... +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. +# Figure out what arch to build... ARCH = $(shell uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/') -all: $(ARCH) common +DIRS = $(ARCH) common + +all: libc.a + +libc.a: subdirs -$(ARCH): dummy - @echo Building for ARCH=$(ARCH) - make -C $(ARCH) +tags: + ctags -R + +clean: subdirs_clean -common: dummy - echo Building common stuff - make -C common +subdirs: $(patsubst %, _dir_%, $(DIRS)) +subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) + +$(patsubst %, _dir_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dir_%, %, $@) + +$(patsubst %, _dirclean_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean -clean: - rm -f *.o - make -C common clean - make -C $(ARCH) clean .PHONY: dummy + diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile index eac2dc3b4..b4a922eb5 100644 --- a/libc/sysdeps/linux/common/Makefile +++ b/libc/sysdeps/linux/common/Makefile @@ -1,24 +1,37 @@ # Copyright (C) 1995,1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../../../ include $(TOPDIR)Rules.make - -CFLAGS+= -D_GCC_LIMITS_H_ - LIBC=$(TOPDIR)libc.a include makefile.objs -all: $(LIBC) +all: $(OBJ) $(LIBC) $(LIBC): $(OBJ) - $(AR) $(ARFLAGS) $@ $(OBJ) - -transfer: - -@rm -f ../include/stdio.h - cp -p stdio.h ../include/. + $(AR) $(ARFLAGS) $(LIBC) $(OBJ) clean: - rm -f *.o + rm -f *.[oa] *~ core + diff --git a/libc/sysdeps/linux/common/kernel_version.c b/libc/sysdeps/linux/common/kernel_version.c index dacc4f0f7..c6b7eabea 100644 --- a/libc/sysdeps/linux/common/kernel_version.c +++ b/libc/sysdeps/linux/common/kernel_version.c @@ -1,89 +1,46 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 2 of the -License, or (at your option) any later version. - -The GNU C Library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include +/* vi: set sw=4 ts=4: */ +/* + * Copyright (C) 1999,2000 by Lineo, inc. + * Written by Erik Andersen , + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include #include #include -#include static int __linux_kernel_version = -1; -static inline int -asc2int (const char *s) +/* Returns kernel version encoded as major*65536 + minor*256 + patch, + * so, for example, to check if the kernel is greater than 2.2.11: + * if (get_kernel_revision() <= 2*65536+2*256+11) { } + */ +static int find_kernel_revision(void) { - int result = 0; - - for (; *s >= '0' && *s <= '9'; s++) - { - result = result * 10 + (*s - '0'); - } - - return result; + struct utsname name; + int major = 0, minor = 0, patch = 0; + + if (uname(&name) == -1) { + return (0); + } + sscanf(name.version, "%d.%d.%d", &major, &minor, &patch); + return major * 65536 + minor * 256 + patch; } -static int -set_linux_kernel_version (void) -{ - struct utsname uts; - char *version = NULL, *patchlevel = NULL, *sublevel = NULL; - - if (uname (&uts)) - { - __linux_kernel_version = 0; - return __linux_kernel_version; - } - - version = uts.release; - if (version != NULL) - { - patchlevel = strchr (version, '.'); - if (patchlevel != NULL) - { - *patchlevel = '\0'; - patchlevel++; - sublevel = strchr (patchlevel, '.'); - if (sublevel != NULL) - { - *sublevel = '\0'; - sublevel++; - } - } - - __linux_kernel_version = - GET_LINUX_KERNEL_VERSION (asc2int (version)); - if (patchlevel != NULL) - { - __linux_kernel_version |= - GET_LINUX_KERNEL_PATCHLEVEL (asc2int (patchlevel)); - } - if (sublevel != NULL) - { - __linux_kernel_version |= - GET_LINUX_KERNEL_SUBLEVEL (asc2int (sublevel)); - } - } - else - { - __linux_kernel_version = 0; - } - - return __linux_kernel_version; -} int __get_linux_kernel_version (void) @@ -91,5 +48,5 @@ __get_linux_kernel_version (void) if (__linux_kernel_version != -1) return __linux_kernel_version; - return set_linux_kernel_version (); + return find_kernel_revision (); } diff --git a/libc/sysdeps/linux/i386/Makefile b/libc/sysdeps/linux/i386/Makefile index 165d16cbd..3c32b6464 100644 --- a/libc/sysdeps/linux/i386/Makefile +++ b/libc/sysdeps/linux/i386/Makefile @@ -1,35 +1,53 @@ -# Copyright (C) 1995,1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../../../ include $(TOPDIR)Rules.make - LIBC=$(TOPDIR)libc.a -CFLAGS+= -D_GCC_LIMITS_H_ +ASFLAGS=$(CFLAGS) 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)) +SSRC=setjmp.S longjmp.S _start.S _exit.S #fork.S +SOBJS=$(patsubst %.S,%.o, $(SSRC)) + +CSRC=readdir.c #select.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) -all: $(SOBJS) $(COBJS) $(MOBJ) $(LIBC) -$(SOBJS): $(SFILES) - $(CC) $(CFLAGS) -c $*.S -o $@ +all: $(MOBJ) $(SOBJS) $(COBJS) $(LIBC) -$(COBJS): $(CFILES) - $(CC) $(CFLAGS) -c $*.c -o $@ +$(LIBC): $(MOBJ) $(SOBJS) $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(SOBJS) $(COBJS) $(MOBJ): $(MSRC) - $(CC) $(CFLAGS) -DL_$* -c $(MSRC) -o $@ + $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o + +$(SOBJS): $(SSRC) + +$(COBJS): $(CSRC) -$(LIBC): $(SOBJS) $(COBJS) $(MOBJ) - $(AR) $(ARFLAGS) $(LIBC) $(SOBJS) $(COBJS) $(MOBJ) clean: - rm -f *.o + rm -f *.[oa] *~ core diff --git a/libc/termios/Makefile b/libc/termios/Makefile index 4ab80e9da..322244104 100644 --- a/libc/termios/Makefile +++ b/libc/termios/Makefile @@ -1,30 +1,49 @@ -# Copyright (C) 1996 Robert de Bath -# This file is part of the Linux-8086 C library and is distributed -# under the GNU Library General Public License. +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. TOPDIR=../ include $(TOPDIR)Rules.make +LIBC=$(TOPDIR)libc.a -LIBC=../libc.a +MSRC=termios.c +MOBJ=tcsetattr.o tcgetattr.o tcdrain.o tcflow.o tcflush.o tcsendbreak.o \ + tcsetpgrp.o tcgetpgrp.o isatty.o cfgetospeed.o cfgetispeed.o cfsetospeed.o \ + cfsetispeed.o cfmakeraw.o -TSRC=termios.c -TOBJ=tcsetattr.o tcgetattr.o tcdrain.o tcflow.o tcflush.o tcsendbreak.o \ - tcsetpgrp.o tcgetpgrp.o isatty.o \ - cfgetospeed.o cfgetispeed.o cfsetospeed.o cfsetispeed.o cfmakeraw.o +CSRC=ttyname.c +COBJS=$(patsubst %.c,%.o, $(CSRC)) -# cfgetospeedn.o cfgetispeedn.o cfsetospeedn.o cfsetispeedn.o tcspeed.o -OBJ=$(TOBJ) ttyname.o -# unlike everything else, this does not compile out of the box... -# ttyname.o +all: $(MOBJ) $(COBJS) $(LIBC) -all: $(LIBC) +$(LIBC): $(MOBJ) $(COBJS) + $(AR) $(ARFLAGS) $(LIBC) $(MOBJ) $(COBJS) -$(LIBC): $(LIBC)($(OBJ)) - -$(LIBC)($(TOBJ)): $(TSRC) +$(MOBJ): $(MSRC) $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o - $(AR) $(ARFLAGS) $@ $*.o + +$(COBJS): $(CSRC) + clean: - rm -f *.o libc.a + rm -f *.[oa] *~ core + diff --git a/libc/termios/termios.c b/libc/termios/termios.c index c6c0117f0..7532259d4 100644 --- a/libc/termios/termios.c +++ b/libc/termios/termios.c @@ -11,10 +11,10 @@ #include #include #include +#include #ifdef L_isatty -isatty(fd) -int fd; +int isatty(int fd) { struct termios term; int rv, err = errno; diff --git a/test/Makefile b/test/Makefile index e430cf8b4..5c647822b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,31 +1,40 @@ -DIRS = assert ctype silly stdlib string - -all: $(DIRS) - -assert: dummy - make -C assert - -ctype: dummy - make -C ctype - -silly: dummy - make -C silly +# Makefile for uCLibc +# +# Copyright (C) 2000 by Lineo, inc. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU Library General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# +# Derived in part from the Linux-8086 C library, the GNU C Library, and several +# other sundry sources. Files within this library are copyright by their +# respective copyright holders. -stdlib: dummy - make -C stdlib - -string: dummy - make -C string +DIRS = assert ctype silly stdlib string +all: subdirs tags: ctags -R -dummy: +clean: subdirs_clean + +subdirs: $(patsubst %, _dir_%, $(DIRS)) +subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS)) + +$(patsubst %, _dir_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dir_%, %, $@) -clean: - make -C assert clean - make -C ctype clean - make -C silly clean - make -C stdlib clean - make -C string clean +$(patsubst %, _dirclean_%, $(DIRS)) : dummy + $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean +.PHONY: dummy -- cgit v1.2.3