summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-09-28 12:34:41 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2005-09-28 12:34:41 +0000
commitf70602be19ff8042c369ea33b29f90b8c0f5d02e (patch)
tree146eb1810d44dc99f8bf26ecd71cec4ee5ba5b32
parente1ac781ed8b4a0f44a696f95618b73d2fa490576 (diff)
Remove ar-target and shared targets, at build time now we traverse the tree only once. Generalize all toplevel makefiles. Make sure, that libdl.so is built against libc.so and not libc.a
-rw-r--r--Makefile46
-rw-r--r--Rules.mak4
-rw-r--r--extra/Makefile2
-rw-r--r--extra/locale/Makefile2
-rw-r--r--ldso/Makefile35
-rw-r--r--ldso/ldso/Makefile70
-rw-r--r--ldso/libdl/Makefile77
-rw-r--r--libc/Makefile77
-rw-r--r--libcrypt/Makefile47
-rw-r--r--libintl/Makefile42
-rw-r--r--libm/Makefile46
-rw-r--r--libm/powerpc/Makefile31
-rw-r--r--libnsl/Makefile47
-rw-r--r--libpthread/Makefile74
-rw-r--r--libpthread/linuxthreads/Makefile65
-rw-r--r--libpthread/linuxthreads/sysdeps/sh64/Makefile26
-rw-r--r--libpthread/linuxthreads_db/Makefile62
-rw-r--r--libresolv/Makefile48
-rw-r--r--librt/Makefile66
-rw-r--r--libutil/Makefile49
-rw-r--r--test/Makefile1
21 files changed, 442 insertions, 475 deletions
diff --git a/Makefile b/Makefile
index 442649fda..012af8d9e 100644
--- a/Makefile
+++ b/Makefile
@@ -24,11 +24,13 @@
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
- release tags TAGS
+ release tags
TOPDIR=./
include Rules.mak
-DIRS = ldso libc libcrypt libresolv libnsl libutil librt
+# need to have libc.so built, before we can build the others
+PRE_DIRS = ldso libc
+DIRS = ldso libcrypt libresolv libnsl libutil librt
ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
DIRS += libm
endif
@@ -41,25 +43,12 @@ endif
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
-all: headers pregen subdirs shared finished
+all: finished
# In this section, we need .config
-include .config.cmd
-shared: $(patsubst %, _shared_dir_%, $(DIRS))
-$(patsubst %, _shared_dir_%, $(DIRS)): subdirs
-ifeq ($(strip $(HAVE_SHARED)),y)
- $(SECHO)
- $(SECHO) Building shared libraries ...
- $(SECHO)
- $(MAKE) -C $(patsubst _shared_dir_%, %, $@) shared
-else
- $(SECHO)
- $(SECHO) Not building shared libraries ...
- $(SECHO)
-endif
-
-finished: shared
+finished: subdirs
$(SECHO)
$(SECHO) Finally finished compiling ...
$(SECHO)
@@ -139,9 +128,12 @@ ifeq ($(strip $(UCLIBC_PREGENERATED_LOCALE_DATA)),y)
$(MAKE) -C extra/locale pregen
endif
+pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS))
+$(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen
+ $(MAKE) -C $(patsubst _pre_dir_%, %, $@)
subdirs: $(patsubst %, _dir_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)): headers
+$(patsubst %, _dir_%, $(DIRS)): pre_subdirs
$(MAKE) -C $(patsubst _dir_%, %, $@)
tags:
@@ -241,17 +233,17 @@ ifeq ($(strip $(HAVE_SHARED)),y)
$(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
$(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
done
-ifeq ($(strip $(COMPAT_ATEXIT)),y)
if [ -f $(TOPDIR)lib/libc.so ] ; then \
$(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
+ fi
+ifeq ($(strip $(COMPAT_ATEXIT)),y)
+ if [ -f $(TOPDIR)lib/libc.so ] ; then \
echo "GROUP ( $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) )" \
>> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
fi
else
if [ -f $(TOPDIR)lib/libc.so ] ; then \
- $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
- sed -e '/^GROUP/d' $(TOPDIR)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
echo "GROUP ( $(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) $(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME) )" \
>> $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
fi
@@ -263,15 +255,11 @@ endif
# # If we build shared libraries then the static libs are PIC...
# # Make _pic.a symlinks to make mklibs.py and similar tools happy.
if [ -d lib ] ; then \
- for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
- $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
- | sed -e 's/\.a$$/_pic.a/'`; \
- done ; \
+ for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
+ $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
+ | sed -e 's/\.a$$/_pic.a/'`; \
+ done ; \
fi
- # Ugh!!! Remember that libdl.a and libdl_pic.a are different. Since
- # libdl is pretty small, and not likely to benefit from mklibs.py and
- # similar, lets just remove libdl_pic.a and avoid the issue
- $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libdl_pic.a
endif
diff --git a/Rules.mak b/Rules.mak
index fea33b89c..7d864e392 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -43,7 +43,6 @@ CC = $(CROSS)gcc
AR = $(CROSS)ar
LD = $(CROSS)ld
NM = $(CROSS)nm
-RANLIB = $(CROSS)ranlib
STRIPTOOL = $(CROSS)strip
INSTALL = install
@@ -67,12 +66,9 @@ VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
LC_ALL := C
export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION LC_ALL
-SHARED_FULLNAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
SHARED_MAJORNAME:=libc.so.$(MAJOR_VERSION)
UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION)
NONSHARED_LIBNAME:=uclibc_nonshared.a
-LIBNAME:=libc.a
-LIBC:=$(TOPDIR)libc/$(LIBNAME)
# Make sure DESTDIR and PREFIX can be used to install
# PREFIX is a uClibcism while DESTDIR is a common GNUism
diff --git a/extra/Makefile b/extra/Makefile
index 9b46ada51..5fabeb9ed 100644
--- a/extra/Makefile
+++ b/extra/Makefile
@@ -33,7 +33,6 @@ tags:
ctags -R
clean: subdirs_clean
- $(RM) *.[oa] *~ core
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN))
@@ -45,4 +44,3 @@ $(patsubst %, _dirclean_%, $(DIRS) $(EXTRA_DIRS_TO_CLEAN)) : dummy
$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
.PHONY: dummy
-
diff --git a/extra/locale/Makefile b/extra/locale/Makefile
index 2d8a147e8..8fe252875 100644
--- a/extra/locale/Makefile
+++ b/extra/locale/Makefile
@@ -86,7 +86,7 @@ pregen:
cat uClibc_locale_data.h | awk 'BEGIN{i=1}{ if ( /WANT_/ ) i = /endif/ ; else if (i) print $0 }' > ../../include/bits/uClibc_locale_data.h
clean:
- $(RM) *.[oa] *~ core
+ $(RM) *.o *~ core
$(RM) gen_wc8bit gen_wctype gen_locale gen_ldc gen_collate
$(RM) c8tables.h wctables.h locale_tables.h lt_defines.h locale_collate.h
$(RM) gen_mmap locale.mmap lmmtolso
diff --git a/ldso/Makefile b/ldso/Makefile
index dd7ff2052..340ddfacb 100644
--- a/ldso/Makefile
+++ b/ldso/Makefile
@@ -21,33 +21,38 @@ include $(TOPDIR)Rules.mak
DIRS = ldso libdl
-all: ldso libdl
-
ifeq ($(strip $(BUILD_UCLIBC_LDSO)),y)
-ldso: headers
- $(MAKE) -C ldso
-libdl: ldso headers
- $(MAKE) -C libdl
-shared: libdl
- $(MAKE) -C libdl shared
+all: subdirs
else
-ldso libdl shared:
- echo "Skipping $@ target"
+all:
endif
LN_HEADERS := $(patsubst %, include/%, elf.h)
LN_ARCH_HEADERS := $(patsubst %, include/%, dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h)
HEADERS := $(LN_HEADERS) $(LN_ARCH_HEADERS) include/dl-progname.h
+
headers: $(HEADERS)
+
$(LN_HEADERS):
- $(LN) -fs $(TOPDIR)../$@ $@
+ $(LN) -sf $(TOPDIR)../$@ $@
+
$(LN_ARCH_HEADERS):
- $(LN) -fs ../ldso/$(TARGET_ARCH)/$(patsubst include/%,%,$@) $@
+ $(LN) -sf ../ldso/$(TARGET_ARCH)/$(patsubst include/%,%,$@) $@
+
include/dl-progname.h:
echo '#include "$(TARGET_ARCH)/elfinterp.c"' \
> include/dl-progname.h
-clean:
- set -e ; for d in $(DIRS) ; do $(MAKE) -C $$d $@ ; done
- -find . -name '*~' | xargs $(RM)
+clean: subdirs_clean
$(RM) $(HEADERS)
+
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
+
+$(patsubst %, _dir_%, $(DIRS)): headers
+ $(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirclean_%, $(DIRS)): dummy
+ $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+
+.PHONY: dummy
diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index eb05d1f4f..f08c64c2f 100644
--- a/ldso/ldso/Makefile
+++ b/ldso/ldso/Makefile
@@ -16,16 +16,8 @@
# along with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
TOPDIR=../../
include $(TOPDIR)Rules.mak
-LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-
-# reset to initial (disabling predefined CFLAGS)
-ASFLAGS=
-ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
-ASFLAGS+=$(call check_as,--noexecstack)
-endif
XXFLAGS=$(XWARNINGS) $(SSP_DISABLE_FLAGS)
@@ -44,21 +36,6 @@ XXFLAGS+= -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\" $(XARCH_CFLAGS) $(CPU_CFLAGS) $(PICFL
# BEWARE!!! At least mips* will die if -O0 is used!!!
XXFLAGS:=$(XXFLAGS:-O0=-O1)
XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
-LDFLAGS=$(CPU_LDFLAGS-y) -e _start -z now -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
- -z combreloc --discard-locals --discard-all --no-undefined
-ifeq ($(UCLIBC_BUILD_RELRO),y)
- LDFLAGS+=-z relro
-endif
-
-CSRC= ldso.c
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-ASRC=$(shell ls $(TARGET_ARCH)/*.S 2>/dev/null)
-AOBJS=$(patsubst %.S,%.o, $(ASRC))
-OBJS=$(AOBJS) $(COBJS)
-
-ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
-LDFLAGS+=-s
-endif
ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
XXFLAGS+=-D__SUPPORT_LD_DEBUG__
@@ -71,25 +48,50 @@ endif
#This stuff will not work with -fomit-frame-pointer
XXFLAGS := $(XXFLAGS:-fomit-frame-pointer=)
-all: $(LDSO_FULLNAME)
+ASFLAGS=$(XXFLAGS)
+ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
+ASFLAGS+=$(call check_as,--noexecstack)
+endif
-$(LDSO_FULLNAME): $(OBJS) $(DLINK_OBJS)
- $(LD) $(LDFLAGS) -soname=$(UCLIBC_LDSO) \
- -o $(LDSO_FULLNAME) $(OBJS) $(LIBGCC)
+LDFLAGS=$(CPU_LDFLAGS-y) -e _start -z now -Bsymbolic -shared --warn-common --export-dynamic --sort-common \
+ -z combreloc --discard-locals --discard-all --no-undefined
+
+ifeq ($(UCLIBC_BUILD_RELRO),y)
+LDFLAGS+=-z relro
+endif
+
+ifneq ($(strip $(SUPPORT_LD_DEBUG)),y)
+LDFLAGS+=-s
+endif
+
+LIB_NAME=ld-uClibc
+SO_LIB_NAME=$(TOPDIR)lib/$(UCLIBC_LDSO)
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+CSRC= ldso.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
+
+ASRC=$(wildcard $(TARGET_ARCH)/*.S)
+AOBJS=$(patsubst %.S,%.o, $(ASRC))
+
+OBJS=$(AOBJS) $(COBJS)
+
+all: $(SO_LIB_NAME)
+
+$(SO_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(INSTALL) -m 755 $(LDSO_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LDSO_FULLNAME) $(TOPDIR)lib/$(UCLIBC_LDSO)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(UCLIBC_LDSO) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) $(OBJS) $(LIBGCC)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(COBJS): %.o : %.c
$(CC) $(XXFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(AOBJS): %.o : %.S
- $(CC) $(XXFLAGS) $(ASFLAGS) -c $< -o $@
+ $(CC) $(ASFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-ldso.o: $(CSRC) dl-elf.c dl-hash.c dl-startup.c dl-debug.c \
- $(TARGET_ARCH)/*.h $(TARGET_ARCH)/*.c $(TOPDIR)ldso/include/*.h
-
clean:
- $(RM) $(UCLIBC_LDSO) $(LDSO_FULLNAME) core *.o */*.o *.a *.s *.i ldso.h *~
+ $(RM) *.o */*.o *~ core
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 6a8b46ad6..a5b2f6be2 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -29,57 +29,62 @@ XXFLAGS+=$(OPTIMIZATION)
endif
XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) \
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
- -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I$(TOPDIR)ldso/ldso -I. -I$(TOPDIR)include
+ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I$(TOPDIR)ldso/ldso -I$(TOPDIR)include
XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
+ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
+XXFLAGS+=-D__SUPPORT_LD_DEBUG__
+endif
XXFLAGS_NOPIC:=$(XXFLAGS)
ifeq ($(DOPIC),y)
XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__
endif
-ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
-XXFLAGS+=-D__SUPPORT_LD_DEBUG__
-endif
-
-LIBDL=libdl.a
-LIBDL_PIC=libdl_pic.a
-LIBDL_SHARED=libdl.so
-LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-CSRC=libdl.c
-OBJS=libdl.o
-PIC_OBJS=libdl_pic.o
+LIB_NAME=libdl
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-all: $(LIBDL) $(LIBDL_PIC)
+CSRC = libdl.c
+OBJS = libdl.o
+PIC_OBJS = libdl_pic.o
-ar-target: $(LIBDL) $(LIBDL_PIC)
+# we do not get here, do we need a libdl.a, if ld.so is not ours?
+#ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(AR_LIB_NAME) $(SO_LIB_NAME)
+#else
+#all: $(AR_LIB_NAME)
+#endif
-$(LIBDL): $(OBJS)
- $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
+$(AR_LIB_NAME): $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBDL)
- $(INSTALL) -m 644 $(LIBDL) $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
-$(LIBDL_PIC): $(PIC_OBJS)
- $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
+shared_$(LIB_NAME).a: $(PIC_OBJS)
+ $(RM) shared_$(LIB_NAME).a
+ $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $(PIC_OBJS)
-libdl.o: libdl.c $(TOPDIR)ldso/include/*.h
- $(CC) $(XXFLAGS_NOPIC) -c libdl.c -o libdl.o
- $(STRIPTOOL) -x -R .note -R .comment $*.o
+# this will be built only on the second round, when libc.so is present,
+# else we would link against libc.a
+$(SO_LIB_NAME): shared_$(LIB_NAME).a
+ if [ -f $(TOPDIR)lib/libc.so ] ; then \
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) ; \
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) -fini dl_cleanup --whole-archive shared_$(LIB_NAME).a \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) ; \
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) ; \
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) ; \
+ fi
-libdl_pic.o: libdl.c $(TOPDIR)ldso/include/*.h
- $(CC) $(XXFLAGS) -c libdl.c -o libdl_pic.o
+$(OBJS): %.o : %.c
+ $(CC) $(XXFLAGS_NOPIC) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-shared: $(LIBDL_PIC)
- $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
- -o $(LIBDL_SHARED_FULLNAME) -fini dl_cleanup --whole-archive $(LIBDL_PIC) \
- --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
- -L$(TOPDIR)/lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC);
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED)
- $(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
+libdl_pic.o: libdl.c
+ $(CC) $(XXFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
clean:
- $(RM) .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~
+ $(RM) *.o *~ core *.a
diff --git a/libc/Makefile b/libc/Makefile
index 14b83ef42..c9c9ac315 100644
--- a/libc/Makefile
+++ b/libc/Makefile
@@ -37,9 +37,17 @@ DIRS = misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd
VERSION_SCRIPT:=${shell if [ -f sysdeps/linux/$(TARGET_ARCH)/libc.map ] ; then \
echo "--version-script sysdeps/linux/$(TARGET_ARCH)/libc.map"; fi}
-LIBNAME_TARGET:=$(TOPDIR)lib/$(LIBNAME)
-
-all: halfclean $(LIBNAME_TARGET)
+# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
+LIB_NAME=libc
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
# Some functions are duplicated across subdirs, and when you pass $(AR)
# the same object file more than once, it'll add it to the archive multiple
@@ -52,62 +60,55 @@ all: halfclean $(LIBNAME_TARGET)
# the wildcard will be evaluated when `make` is run instead of when the make
# target is evaluated. That means if you run `rm obj.* ; make`, the wildcard
# will evaluate to no files :(.
-$(LIBNAME) shared_$(LIBNAME) ar-target: subdirs
- $(RM) $(LIBNAME) shared_$(LIBNAME)
+shared_$(LIB_NAME).a: subdirs
+ $(RM) shared_$(LIB_NAME).a
objs=`cat obj.*` ; \
- $(AR) $(ARFLAGS) $(LIBNAME) $$objs && \
- $(AR) dN 2 $(LIBNAME) $$objs && \
- $(AR) dN 2 $(LIBNAME) $$objs
+ $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objs && \
+ $(AR) dN 2 shared_$(LIB_NAME).a $$objs && \
+ $(AR) dN 2 shared_$(LIB_NAME).a $$objs
@for objfile in obj.signal \
obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
if [ -e $$objfile ] ; then \
if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
- echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \
+ echo $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objfile ; \
fi ; \
objs=`cat $$objfile` ; \
fi ; \
- $(AR) $(ARFLAGS) $(LIBNAME) $$objs || exit 1 ; \
+ $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objs || exit 1 ; \
done
- cp $(LIBNAME) shared_$(LIBNAME)
- $(AR) $(ARFLAGS) $(LIBNAME) misc/internals/static.o `cat nonshared_obj.*`
- $(RANLIB) $(LIBNAME)
-$(LIBNAME_TARGET): $(LIBNAME)
+$(AR_LIB_NAME): shared_$(LIB_NAME).a
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBNAME)
- $(INSTALL) -m 644 $(LIBNAME) $(TOPDIR)lib
-
-shared: shared_$(LIBNAME)
- $(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \
- --whole-archive shared_$(LIBNAME) \
- $(TOPDIR)libc/misc/internals/interp.o --no-whole-archive \
- -init __uClibc_init $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) $(LDADD_LIBFLOAT)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(SHARED_FULLNAME)
- $(INSTALL) -m 644 $(SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(SHARED_FULLNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME)
+ $(RM) $(AR_LIB_NAME)
+ cp shared_$(LIB_NAME).a $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) misc/internals/static.o `cat nonshared_obj.*`
+
+$(SO_LIB_NAME): shared_$(LIB_NAME).a
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive shared_$(LIB_NAME).a \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -init __uClibc_init $(TOPDIR)lib/$(UCLIBC_LDSO) $(LDADD_LIBFLOAT) $(LIBGCC)
+ $(LN) -sf $(SO_FULL_NAME) $(TOPDIR)lib/$(SHARED_MAJORNAME)
+ $(RM) $(TOPDIR)lib/$(NONSHARED_LIBNAME)
$(AR) $(ARFLAGS) $(TOPDIR)lib/$(NONSHARED_LIBNAME) `cat nonshared_obj.*`
- $(RANLIB) $(TOPDIR)lib/$(NONSHARED_LIBNAME)
- echo "/* GNU ld script" > $(TOPDIR)lib/libc.so
- echo " * Use the shared library, but some functions are only in" >> $(TOPDIR)lib/libc.so
- echo " * the static library, so try that secondarily. */" >> $(TOPDIR)lib/libc.so
+ echo "/* GNU ld script" > $(SO_LIB_NAME)
+ echo " * Use the shared library, but some functions are only in" >> $(SO_LIB_NAME)
+ echo " * the static library, so try that secondarily. */" >> $(SO_LIB_NAME)
#OUT_FORMAT:=$(shell $(LD) --verbose | grep OUTPUT_FORMAT | awk -F '"' '{print $2}')
- #echo "OUTPUT_FORMAT($(OUT_FORMAT))" >> $(TOPDIR)lib/libc.so
+ #echo "OUTPUT_FORMAT($(OUT_FORMAT))" >> $(SO_LIB_NAME)
ifeq ($(strip $(COMPAT_ATEXIT)),y)
- echo "GROUP ( $(TOPDIR)lib/$(NONSHARED_LIBNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) )" >> $(TOPDIR)lib/libc.so
+ echo "GROUP ( $(TOPDIR)lib/$(NONSHARED_LIBNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) )" >> $(SO_LIB_NAME)
else
- echo "GROUP ( $(TOPDIR)lib/$(SHARED_MAJORNAME) $(TOPDIR)lib/$(NONSHARED_LIBNAME) )" >> $(TOPDIR)lib/libc.so
+ echo "GROUP ( $(TOPDIR)lib/$(SHARED_MAJORNAME) $(TOPDIR)lib/$(NONSHARED_LIBNAME) )" >> $(SO_LIB_NAME)
endif
-halfclean:
- $(RM) $(LIBNAME) shared_$(LIBNAME) $(SHARED_FULLNAME)
-
tags:
ctags -R
-clean: subdirs_clean halfclean
- $(RM) obj.* nonshared_obj.*
+clean: subdirs_clean
+ $(RM) *.a obj.* nonshared_obj.*
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
diff --git a/libcrypt/Makefile b/libcrypt/Makefile
index d41309f3c..2b129a8e2 100644
--- a/libcrypt/Makefile
+++ b/libcrypt/Makefile
@@ -26,35 +26,38 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
-LIBCRYPT=libcrypt.a
-LIBCRYPT_SHARED=libcrypt.so
-LIBCRYPT_SHARED_FULLNAME=libcrypt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+LIB_NAME=libcrypt
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+CSRC = $(wildcard *.c)
-CSRC = crypt.c des.c md5.c
OBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBCRYPT)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBCRYPT) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBCRYPT) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBCRYPT)
- $(INSTALL) -m 644 $(LIBCRYPT) $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
+
+$(SO_LIB_NAME): $(AR_LIB_NAME)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-shared: all
- $(LD) $(LDFLAGS) -soname=$(LIBCRYPT_SHARED).$(MAJOR_VERSION) \
- -o $(LIBCRYPT_SHARED_FULLNAME) --whole-archive $(LIBCRYPT) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED)
- $(LN) -sf $(LIBCRYPT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBCRYPT_SHARED).$(MAJOR_VERSION)
-
-clean:
- $(RM) *.[oa] *~ core $(LIBCRYPT) $(LIBCRYPT_SHARED_FULLNAME)
+clean:
+ $(RM) *.o *~ core
diff --git a/libintl/Makefile b/libintl/Makefile
index 8977b5ba9..86a6b8deb 100644
--- a/libintl/Makefile
+++ b/libintl/Makefile
@@ -26,9 +26,10 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
-LIBINTL=libintl.a
-LIBINTL_SHARED=libintl.so
-LIBINTL_SHARED_FULLNAME=libintl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+LIB_NAME=libintl
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
MSRC= intl.c
MOBJ= gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \
@@ -37,28 +38,29 @@ MOBJ= gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \
OBJS=$(MOBJ)
-all: $(LIBINTL)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBINTL) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBINTL) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBINTL)
- $(INSTALL) -m 644 $(LIBINTL) $(TOPDIR)lib/
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
+
+$(SO_LIB_NAME): $(AR_LIB_NAME)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(MOBJ): $(MSRC)
$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
-shared: all
- $(LD) $(LDFLAGS) -soname=$(LIBINTL_SHARED).$(MAJOR_VERSION) \
- -o $(LIBINTL_SHARED_FULLNAME) --whole-archive $(LIBINTL) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED)
- $(LN) -sf $(LIBINTL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBINTL_SHARED).$(MAJOR_VERSION)
-
clean:
- $(RM) *.[oa] *~ core $(LIBINTL) $(LIBINTL_SHARED_FULLNAME)
+ $(RM) *.o *~ core
diff --git a/libm/Makefile b/libm/Makefile
index d8927a89a..00d29d589 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -36,19 +36,22 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+
+ALL_SUBDIRS = powerpc
+
DIRS =
ifeq ($(strip $(HAS_FPU)),y)
ifeq ($(TARGET_ARCH),$(wildcard $(TARGET_ARCH)))
DIRS = $(TARGET_ARCH)
endif
endif
-ALL_SUBDIRS = powerpc
+LIB_NAME=libm
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-LIBM=libm.a
-LIBM_SHARED=libm.so
-LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
FL_MSRC = float_wrappers.c
ifeq ($(strip $(DO_C99_MATH)),y)
@@ -92,26 +95,25 @@ endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS) $(FL_MOBJ)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: subdirs
+endif
-all: $(LIBM) subdirs
-
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBM) $(OBJS)
-$(LIBM): ar-target
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBM)
- $(INSTALL) -m 644 $(LIBM) $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-shared: all
- $(LD) $(LDFLAGS) -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \
- -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \
+$(SO_LIB_NAME): subdirs
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED)
- $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
@@ -125,12 +127,12 @@ tags:
ctags -R
clean: subdirs_clean
- $(RM) *.[oa] *~ core $(LIBM) $(LIBM_SHARED_FULLNAME)
+ $(RM) *.o *~ core
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
-$(patsubst %, _dir_%, $(DIRS)): ar-target
+$(patsubst %, _dir_%, $(DIRS)): $(AR_LIB_NAME)
$(MAKE) -C $(patsubst _dir_%, %, $@)
$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)): dummy
diff --git a/libm/powerpc/Makefile b/libm/powerpc/Makefile
index 342c182ba..a81edeb9a 100644
--- a/libm/powerpc/Makefile
+++ b/libm/powerpc/Makefile
@@ -34,39 +34,32 @@
TOPDIR=../../
include $(TOPDIR)Rules.mak
-LIBM=../libm.a
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+LIB_NAME=libm
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+
ifeq ($(strip $(DO_C99_MATH)),y)
-CSRC = s_ceil.c s_copysign.c s_floor.c s_frexp.c s_ldexp.c s_logb.c s_modf.c \
- s_nearbyint.c s_rint.c s_round.c s_trunc.c w_scalb.c
+CSRC = $(wildcard *.c)
else
CSRC =
endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+OBJS=$(patsubst %.c,%.o, $(CSRC))
-ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
-all: clean
-else
-all: $(OBJS) $(LIBM)
-endif
+all: add_to_archive
-$(LIBM): ar-target
+add_to_archive: $(OBJS)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBM) $(OBJS)
-
-$(COBJS): %.o : %.c
+$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-$(OBJ): Makefile
-
tags:
ctags -R
clean:
- $(RM) *.[oa] *~ core
-
+ $(RM) *.o *~ core
diff --git a/libnsl/Makefile b/libnsl/Makefile
index 28cff08dd..d20fe2113 100644
--- a/libnsl/Makefile
+++ b/libnsl/Makefile
@@ -21,35 +21,38 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
-LIBNSL=libnsl.a
-LIBNSL_SHARED=libnsl.so
-LIBNSL_SHARED_FULLNAME=libnsl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+LIB_NAME=libnsl
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+CSRC = $(wildcard *.c)
-CSRC = nsl.c
OBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBNSL)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBNSL) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBNSL) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBNSL)
- $(INSTALL) -m 644 $(LIBNSL) $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
+
+$(SO_LIB_NAME): $(AR_LIB_NAME)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-shared: all
- $(LD) $(LDFLAGS) -soname=$(LIBNSL_SHARED).$(MAJOR_VERSION) \
- -o $(LIBNSL_SHARED_FULLNAME) --whole-archive $(LIBNSL) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBNSL_SHARED_FULLNAME)