# 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 \
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 \
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
INTERP_O = interp.o
-all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so
+all: tests $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O)
# Add any architecture-specific rules
include arch/$(ARCH)/Makefile.inc
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)
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
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