OSDN Git Service

Some sparc updates from Stanley <ngstanley@cwc.nus.edu.sg>
[uclinux-h8/uClibc.git] / Makefile
index d04e657..8d524ee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -35,11 +35,17 @@ ifeq ($(DO_SHARED),shared)
 endif
 DIRS = extra $(LDSO_DIR) libc libcrypt libresolv libutil libm  
 
+ifndef $(TARGET_PREFIX)
+       TARGET_PREFIX = `pwd`/_install
+endif
+
 all: headers uClibc_config.h subdirs $(DO_SHARED) done
 
 shared:
        @$(MAKE) -C libc shared
+ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
        @$(MAKE) -C ldso shared
+endif
        @$(MAKE) -C libcrypt shared
        @$(MAKE) -C libutil shared
        @$(MAKE) -C libm shared
@@ -69,6 +75,7 @@ headers: dummy
        @ln -s $(KERNEL_SOURCE)/include/linux include/linux
        @ln -s ../libc/sysdeps/linux/$(TARGET_ARCH)/bits include/bits
        (cd include/bits; ln -sf ../../../../../uClibc_config.h uClibc_config.h)
+       $(MAKE) -C libc/sysdeps/linux/$(TARGET_ARCH) headers
 
 uClibc_config.h: Config
        @echo "/* WARNING!!! AUTO-GENERATED FILE!!! DO NOT EDIT!!! */" > uClibc_config.h
@@ -82,20 +89,25 @@ uClibc_config.h: Config
        else \
            echo "#undef __UCLIBC_HAS_MMU__" >> uClibc_config.h ; \
        fi
-       @if [ "$(HAS_FLOATS)" = "true" ] ; then \
+       @if [ "$(HAS_FLOATING_POINT)" = "true" ] ; then \
            echo "#define __UCLIBC_HAS_FLOATS__ 1" >> uClibc_config.h ; \
        else \
            echo "#undef __UCLIBC_HAS_FLOATS__" >> uClibc_config.h ; \
        fi
-       @if [ "$(HAS_DOUBLE)" = "true" ] ; then \
-           echo "#define __UCLIBC_HAS_DOUBLE__ 1" >> uClibc_config.h ; \
+       @if [ "$(HAS_LIBM_FLOAT)" = "true" ] ; then \
+           echo "#define __UCLIBC_HAS_LIBM_FLOAT__ 1" >> uClibc_config.h ; \
        else \
-           echo "#undef __UCLIBC_HAS_DOUBLE__" >> uClibc_config.h ; \
+           echo "#undef __UCLIBC_HAS_LIBM_FLOAT__" >> uClibc_config.h ; \
        fi
-       @if [ "$(HAS_LONG_DOUBLE)" = "true" ] ; then \
-           echo "#define __UCLIBC_HAS_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
+       @if [ "$(HAS_LIBM_DOUBLE)" = "true" ] ; then \
+           echo "#define __UCLIBC_HAS_LIBM_DOUBLE__ 1" >> uClibc_config.h ; \
        else \
-           echo "#undef __UCLIBC_HAS_LONG_DOUBLE__" >> uClibc_config.h ; \
+           echo "#undef __UCLIBC_HAS_LIBM_DOUBLE__" >> uClibc_config.h ; \
+       fi
+       @if [ "$(HAS_LIBM_LONG_DOUBLE)" = "true" ] ; then \
+           echo "#define __UCLIBC_HAS_LIBM_LONG_DOUBLE__ 1" >> uClibc_config.h ; \
+       else \
+           echo "#undef __UCLIBC_HAS_LIBM_LONG_DOUBLE__" >> uClibc_config.h ; \
        fi
        @if [ "$(HAS_LONG_LONG)" = "true" ] ; then \
            echo "#define __UCLIBC_HAS_LONG_LONG__ 1" >> uClibc_config.h ; \
@@ -108,15 +120,10 @@ uClibc_config.h: Config
        else \
            echo "#undef __UCLIBC_HAS_LOCALE__" >> uClibc_config.h ; \
        fi
-       @if [ "$(TARGET_ARCH)" = "m68k" ] ; then \
-           echo "#define __VFORK_MACRO__ 1" >> uClibc_config.h ; \
-           if [ `expr match "$(CC)" ".*\(m68k-elf-.*\)"`x = x ]; then \
-               echo "#define const" >> uClibc_config.h ; \
-               echo "#define __const" >> uClibc_config.h ; \
-               echo "#define __extension" >> uClibc_config.h ; \
-           fi; \
+       @if [ "$(HAVE_ELF)" = "false" ] ; then \
+           echo "#undef HAVE_ELF" >> uClibc_config.h ; \
        else \
-           echo "#undef __VFORK_MACRO__" >> uClibc_config.h ; \
+           echo "#define HAVE_ELF 1" >> uClibc_config.h ; \
        fi
        @if [ "$(TARGET_ARCH)" = "sh" ] ; then \
            echo "#define NO_UNDERSCORES 1" >> uClibc_config.h ; \
@@ -137,40 +144,61 @@ $(patsubst %, _dir_%, $(DIRS)) : dummy
 tags:
        ctags -R
 
-install: install_runtime install_dev
+install: install_dev
 
-# Installs shared library
-install_runtime:
-       install -d $(INSTALL_DIR)/lib
-       cp -fa lib/* $(INSTALL_DIR)/lib;
-#ifeq ($(LDSO_PRESENT), $(TARGET_ARCH))
-       ln -sf $(INSTALL_DIR)/lib/$(UCLIBC_LDSO) /lib/$(UCLIBC_LDSO);
-       install -d $(INSTALL_DIR)/etc
-       ldso/util/ldconfig
-#endif
+# Installs shared libraries for a target.
+install_target:
+ifeq ($(DO_SHARED),shared)
+       install -d $(TARGET_PREFIX)$(ROOT_DIR)/lib
+       cp -fa lib/*.so* $(TARGET_PREFIX)$(ROOT_DIR)/lib;
+       install -d $(TARGET_PREFIX)$(ROOT_DIR)/etc
+       install -d $(TARGET_PREFIX)$(ROOT_DIR)/sbin
+       install -d $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
+       cp -f ldso/util/ldd $(TARGET_PREFIX)$(ROOT_DIR)/usr/bin
+       cp -f ldso/util/ldconfig $(TARGET_PREFIX)$(ROOT_DIR)/sbin
+ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
+       -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
+endif
+endif
 
 # Installs development library and headers
 # This is done with the assumption that it can blow away anything
-# in $(INSTALL_DIR)/include.  Probably true only if you're using
+# in $(DEVEL_PREFIX)$(ROOT_DIR)/include.  Probably true only if you're using
 # a packaging system.
 install_dev:
-       install -d $(INSTALL_DIR)/include
-       install -d $(INSTALL_DIR)/include/bits
-       rm -f $(INSTALL_DIR)/include/asm
-       rm -f $(INSTALL_DIR)/include/linux
-       ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
-       ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib
+       cp -fa lib/*.[ao] $(DEVEL_PREFIX)$(ROOT_DIR)/usr/lib;
+ifeq ($(DO_SHARED),shared)
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/lib
+       cp -fa lib/*.so* $(DEVEL_PREFIX)$(ROOT_DIR)/lib;
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
+       cp -f ldso/util/ldd $(DEVEL_PREFIX)$(ROOT_DIR)/usr/bin
+       cp -f ldso/util/ldconfig $(DEVEL_PREFIX)$(ROOT_DIR)/sbin
+ifeq ($(NATIVE_ARCH), $(TARGET_ARCH))
+       -@if [ -x ldso/util/ldconfig ] ; then ldso/util/ldconfig; fi
+endif
+endif
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/etc
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include
+       install -d $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits
+       rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
+       rm -f $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
+       ln -s $(KERNEL_SOURCE)/include/asm $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/asm
+       ln -s $(KERNEL_SOURCE)/include/linux $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/linux
        find include/ -type f -depth -not -path "*CVS*" -exec install \
-           -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
+           -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
        find include/bits/ -type f -depth -not -path "*CVS*" -exec install \
-           -D -m 644 {} $(INSTALL_DIR)/'{}' ';'
-       install -m 644 include/bits/uClibc_config.h $(INSTALL_DIR)/include/bits/
+           -D -m 644 {} $(DEVEL_PREFIX)$(ROOT_DIR)/usr/'{}' ';'
+       install -m 644 include/bits/uClibc_config.h $(DEVEL_PREFIX)$(ROOT_DIR)/usr/include/bits/
        $(MAKE) -C extra/gcc-uClibc install
 
 clean:
-       @rm -rf tmp lib
-       rm -f include/asm include/linux include/bits uClibc_config.h
+       @rm -rf tmp lib include/bits/uClibc_config.h uClibc_config.h
+       - find include -type l -exec rm -f {} \;
        - find . \( -name \*.o -o -name \*.a -o -name \*.so -o -name core \) -exec rm -f {} \;
+       $(MAKE) -C ldso clean
 
 .PHONY: dummy subdirs