chiark / gitweb /
[PATCH] klibc: update v0.205
[elogind.git] / klibc / klibc / Makefile
index 3519b4508908b5d9f374eab58bf42c96c0969e2f..a9aedc58f0440e0d68647a3c62c260f684116dae 100644 (file)
@@ -7,6 +7,8 @@
 # Include configuration rules
 include MCONFIG
 
+INCLUDE += -I./zlib
+
 TESTS   = $(patsubst %.c,%,$(wildcard tests/*.c)) \
          $(patsubst %.c,%.shared,$(wildcard tests/*.c))
 LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
@@ -30,12 +32,12 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
          brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \
          memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
-         memmove.o memchr.o \
+         memmove.o memchr.o memrchr.o \
          strcasecmp.o strncasecmp.o strndup.o strerror.o \
          strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
          strncat.o strlcpy.o strlcat.o \
-         strstr.o strncmp.o strncpy.o strrchr.o strspn.o \
-         strsep.o strtok.o \
+         strstr.o strncmp.o strncpy.o strrchr.o \
+         strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \
          gethostname.o getdomainname.o getcwd.o \
          seteuid.o setegid.o \
          getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
@@ -47,10 +49,17 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \
          inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \
          inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \
          send.o recv.o
+
 ifeq ($(ERRLIST),1)
 LIBOBJS += errlist.o
 endif
 
+ifeq ($(ZLIB),1)
+LIBOBJS += zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \
+          zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \
+          zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o
+endif
+
 SOLIB   = libc.so
 SOHASH  = klibc.so
 
@@ -59,7 +68,7 @@ LIB     = libc.a
 
 INTERP_O = interp.o
 
-all: $(CRT0) $(LIB) $(SOLIB) klibc.so
+all: tests $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O)
 
 # Add any architecture-specific rules
 include arch/$(ARCH)/Makefile.inc
@@ -79,12 +88,12 @@ tests/testvsnp.o : tests/testvsnp.c
 tests/% : tests/%.o $(LIB) $(CRT0)
        $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC)
        cp $@ $@.stripped
-       $(STRIP) $@.stripped
+       $(STRIPCMD) $@.stripped
 
 tests/%.shared : tests/%.o interp.o $(SOLIB)
        $(LD) $(LDFLAGS) -o $@ $(EMAIN) interp.o tests/$*.o -R $(SOLIB) $(LIBGCC)
        cp $@ $@.stripped
-       $(STRIP) $@.stripped
+       $(STRIPCMD) $@.stripped
 
 $(LIB): __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj
        rm -f $(LIB)
@@ -120,14 +129,14 @@ crt0.o: arch/$(ARCH)/crt0.o
        cp arch/$(ARCH)/crt0.o .
 
 errlist.c:
-       $(PERL) makeerrlist.pl -errlist > $@ || rm -f $@
+       $(PERL) makeerrlist.pl -q $(INCLUDE) -errlist > $@ || rm -f $@
 
 # We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__"
 SYSCALLS.i: SYSCALLS.def
        $(CC) $(CFLAGS) -D__ASSEMBLY__ -ansi -x assembler-with-cpp -E -o $@ $<
 
-syscalls.nrs: ../include/sys/syscall.h ../include/arch/$(ARCH)/klibc/archsys.h ../linux/include/asm/unistd.h
-       $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ ../include/sys/syscall.h
+syscalls.nrs: ../include/sys/syscall.h
+       $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ $<
 
 syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs
        rm -rf syscalls
@@ -168,6 +177,14 @@ spotless: clean
 bitsize:
        @echo $(BITSIZE)
 
+install: all
+       $(INSTALL_DATA) $(LIB) $(SOLIB) $(CRT0) $(INTERP_O) \
+               $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib
+       $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \
+               $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib
+       $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \
+               $(INSTALLROOT)/$(SHLIBDIR)
+
 ifneq ($(wildcard $(DIR).*.d),)
 include $(wildcard $(DIR).*.d)
 endif