summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-09-28 12:34:41 (GMT)
committerPeter S. Mazinger <ps.m@gmx.net>2005-09-28 12:34:41 (GMT)
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 442649f..012af8d 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 fea33b8..7d864e3 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 9b46ada..5fabeb9 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 2d8a147..8fe2528 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 dd7ff20..340ddfa 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 eb05d1f..f08c64c 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 6a8b46a..a5b2f6b 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 14b83ef..c9c9ac3 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 d41309f..2b129a8 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 8977b5b..86a6b8d 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 d8927a8..00d29d5 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 342c182..a81edeb 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 28cff08..d20fe21 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) $(TOPDIR)lib/$(LIBNSL_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBNSL_SHARED)
- $(LN) -sf $(LIBNSL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBNSL_SHARED).$(MAJOR_VERSION)
-
-clean:
- $(RM) *.[oa] *~ core $(LIBNSL) $(LIBNSL_SHARED_FULLNAME)
+clean:
+ $(RM) *.o *~ core
diff --git a/libpthread/Makefile b/libpthread/Makefile
index 1218b5c..60ad756 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -19,31 +19,14 @@
TOPDIR=../
include $(TOPDIR)Rules.mak
-#Adjust the soname version to avoid namespace collisions with glibc's libpthread
-LIBPTHREAD=libpthread.a
-LIBPTHREAD_SHARED=libpthread.so
-LIBPTHREAD_SHARED_FULLNAME=libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-
-LIBTHREAD_DB=libthread_db.a
-LIBTHREAD_DB_SHARED=libthread_db.so
-LIBTHREAD_DB_SHARED_FULLNAME=libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+ALL_SUBDIRS = linuxthreads linuxthreads_db
DIRS=linuxthreads
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
DIRS+=linuxthreads_db
endif
-ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
- SHARED_START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
- SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
-endif
-
-ALL_SUBDIRS = linuxthreads linuxthreads_db
-
-# Remove any -z defs since this lib will have undefined symbols
-LIBTHREAD_DB_LDFLAGS := $(subst -z defs,,$(LDFLAGS))
-
-all: $(LIBPTHREAD) $(LIBTHREAD_DB)
+all: subdirs
headers:
ifeq ($(strip $(UCLIBC_HAS_THREADS_NATIVE)),y)
@@ -53,6 +36,9 @@ ifeq ($(strip $(UCLIBC_HAS_THREADS_NATIVE)),y)
$(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h $(TOPDIR)include/bits/
$(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/pthread/bits/libc-lock.h $(TOPDIR)include/bits/
$(LN) -sf ../$(TOPDIR)libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h $(TOPDIR)include/bits/
+ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
+ $(LN) -sf $(TOPDIR)libpthread/nptl_db/thread_db.h $(TOPDIR)include/
+endif
else
$(LN) -sf $(TOPDIR)libpthread/linuxthreads/sysdeps/pthread/pthread.h $(TOPDIR)include/
$(LN) -sf $(TOPDIR)libpthread/linuxthreads/semaphore.h $(TOPDIR)include/
@@ -62,52 +48,6 @@ ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
endif
endif
-$(LIBPTHREAD): subdirs
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBPTHREAD)
- $(INSTALL) -m 644 $(LIBPTHREAD) $(TOPDIR)lib
-
-$(LIBTHREAD_DB): subdirs
-ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBTHREAD_DB)
- $(INSTALL) -m 644 $(LIBTHREAD_DB) $(TOPDIR)lib
-endif
-
-
-$(OBJS): %.o : %.c
- $(CC) $(CFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-shared: all
- $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIBPTHREAD_SHARED).$(MAJOR_VERSION) \
- -o $(LIBPTHREAD_SHARED_FULLNAME) $(SHARED_START_FILES) --whole-archive $(LIBPTHREAD) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) \
- $(SHARED_END_FILES)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBPTHREAD_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBPTHREAD_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBPTHREAD_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBPTHREAD_SHARED)
- $(LN) -sf $(LIBPTHREAD_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBPTHREAD_SHARED).$(MAJOR_VERSION)
-ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
- $(LD) $(LIBTHREAD_DB_LDFLAGS) --warn-unresolved-symbols -soname=$(LIBTHREAD_DB_SHARED).1 \
- -o $(LIBTHREAD_DB_SHARED_FULLNAME) --whole-archive $(LIBTHREAD_DB) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).1
- $(INSTALL) -m 644 $(LIBTHREAD_DB_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED)
- $(LN) -sf $(LIBTHREAD_DB_SHARED_FULLNAME) \
- $(TOPDIR)lib/$(LIBTHREAD_DB_SHARED).1
-endif
-
tags:
ctags -R
@@ -121,9 +61,7 @@ $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
clean: subdirs_clean
- $(RM) *.[oa] *~ core $(LIBPTHREAD) $(LIBPTHREAD_SHARED_FULLNAME) \
- $(LIBTHREAD_DB) $(LIBTHREAD_DB_SHARED_FULLNAME) \
- $(TOPDIR)include/pthread.h $(TOPDIR)include/semaphore.h \
+ $(RM) $(TOPDIR)include/pthread.h $(TOPDIR)include/semaphore.h \
$(TOPDIR)include/thread_db.h \
$(TOPDIR)include/bits/pthreadtypes.h $(TOPDIR)include/bits/semaphore.h \
$(TOPDIR)include/bits/libc-lock.h $(TOPDIR)include/bits/stdio-lock
diff --git a/libpthread/linuxthreads/Makefile b/libpthread/linuxthreads/Makefile
index 08ff8a2..2d20d23 100644
--- a/libpthread/linuxthreads/Makefile
+++ b/libpthread/linuxthreads/Makefile
@@ -16,7 +16,6 @@
# You should have received a copy of the GNU Library 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
-# Makefile for uClibc
TOPDIR=../../
include $(TOPDIR)Rules.mak
@@ -26,46 +25,62 @@ include $(TOPDIR)Rules.mak
# $(AR)'s in subdirs running on linuxthreads.a.
DIRS = sysdeps
-#Adjust the soname version to avoid namespace collisions with glibc's libpthread
-LIBPTHREAD:=../libpthread.a
-ifeq ($(strip $(TARGET_ARCH)),sparc)
-SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
-else
-SYSDEPS_DIR:=$(TARGET_ARCH)
-endif
-CFLAGS += $(SSP_ALL_CFLAGS)
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
#This stuff will not compile without at least -O1
CFLAGS :=$(CFLAGS:-O0=-O1)
-
# set up system dependencies include dirs (NOTE: order matters!)
+# psm: don't think that the last include makes sense
+# they all should be already linked to $(TOPDIR)include
PTDIR = $(TOPDIR)libpthread/linuxthreads/
SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
CFLAGS += $(SYSDEPINC)
-CSRC=attr.c cancel.c condvar.c errno.c events.c join.c lockfile.c manager.c \
- mutex.c oldsemaphore.c pt-machine.c ptfork.c pthread.c \
- ptlongjmp.c rwlock.c semaphore.c signals.c specific.c spinlock.c
+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
+ SHARED_START_FILES = $(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
+ SHARED_END_FILES = $(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
+endif
-ifeq ($(UCLIBC_HAS_XLOCALE),y)
- CSRC += locale.c
+LIB_NAME=libpthread
+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)
+ifneq ($(strip $(UCLIBC_HAS_XLOCALE)),y)
+CSRC := $(filter-out locale.c,$(CSRC))
endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+OBJS=$(patsubst %.c,%.o, $(CSRC))
# We need to make sure that we put all the top-level $(OBJS) into
# our archive before executing subdirs. That way, when $(AR) is
# run in the subdirs, it'll bump the generic top-level objects
# out of our archive in favor of the machine-specific ones.
-all: $(LIBPTHREAD) subdirs
-
-$(LIBPTHREAD) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: subdirs
+endif
-$(COBJS): %.o : %.c
+$(AR_LIB_NAME): $(OBJS)
+ $(INSTALL) -d $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
+
+$(SO_LIB_NAME): subdirs
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS_NOSTRIP) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) $(SHARED_START_FILES) --whole-archive $(AR_LIB_NAME) \
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
+ -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC) $(SHARED_END_FILES)
+ $(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 $@
ifeq ($(strip $(PTHREADS_DEBUG_SUPPORT)),y)
$(STRIPTOOL) -X --strip-debug -R .note -R .comment $*.o
@@ -74,15 +89,15 @@ else
endif
clean: subdirs_clean
- $(RM) *.[oa] *~ core
+ $(RM) *.o *~ core
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)): $(LIBPTHREAD)
+$(patsubst %, _dir_%, $(DIRS)): $(AR_LIB_NAME)
$(MAKE) -C $(patsubst _dir_%, %, $@)
-$(patsubst %, _dirclean_%, $(DIRS)):
+$(patsubst %, _dirclean_%, $(DIRS)): dummy
$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
.PHONY: dummy
diff --git a/libpthread/linuxthreads/sysdeps/sh64/Makefile b/libpthread/linuxthreads/sysdeps/sh64/Makefile
index 11b7cc0..b3abb82 100644
--- a/libpthread/linuxthreads/sysdeps/sh64/Makefile
+++ b/libpthread/linuxthreads/sysdeps/sh64/Makefile
@@ -19,31 +19,25 @@
TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-LIBPTHREAD=../../../libpthread.a
-SOBJS = $(patsubst %.S,%.o, $(SSRC))
-CSRC = pt-machine.c
-COBJS = $(patsubst %.c,%.o, $(CSRC))
+CFLAGS+=$(SSP_ALL_CFLAGS)
# We need to build as SHcompact for tas..
CFLAGS := $(subst 32media,compact,$(CFLAGS))
-OBJS = $(SOBJS) $(COBJS)
+LIB_NAME=libpthread
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
-all: $(OBJS) $(LIBC)
+CSRC = pt-machine.c
+OBJS = $(patsubst %.c,%.o, $(CSRC))
-$(LIBC): ar-target
+all: add_to_archive
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBPTHREAD) $(OBJS)
+add_to_archive: $(OBJS)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-$(SOBJS): %.o : %.S
- $(CC) $(ASFLAGS) -c $< -o $@
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
-$(COBJS): %.o : %.c
+$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
clean:
- $(RM) *.[oa] *~ core
-
+ $(RM) *.o *~ core
diff --git a/libpthread/linuxthreads_db/Makefile b/libpthread/linuxthreads_db/Makefile
index 66015be..2c27cdc 100644
--- a/libpthread/linuxthreads_db/Makefile
+++ b/libpthread/linuxthreads_db/Makefile
@@ -15,53 +15,55 @@
# You should have received a copy of the GNU Library 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
-# Makefile for uClibc
TOPDIR=../../
include $(TOPDIR)Rules.mak
-#Adjust the soname version to avoid namespace collisions with glibc's libpthread
-LIBTHREAD_DB:=../libthread_db.a
-ifeq ($(strip $(TARGET_ARCH)),sparc)
-SYSDEPS_DIR:=$(TARGET_ARCH)/sparc32
-else
-SYSDEPS_DIR:=$(TARGET_ARCH)
-endif
+#CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME=libthread_db
+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
# set up system dependencies include dirs (NOTE: order matters!)
PTDIR = $(TOPDIR)libpthread/linuxthreads/
SYSDEPINC = -I$(PTDIR)sysdeps/pthread \
-I$(PTDIR)sysdeps/$(TARGET_ARCH) \
-I$(TOPDIR)libc/sysdeps/linux/$(TARGET_ARCH)
-#CFLAGS += $(SSP_ALL_CFLAGS)
+
CFLAGS += $(SYSDEPINC) -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
-CSRC= td_init.c td_log.c td_ta_delete.c td_ta_get_nthreads.c \
- td_ta_get_ph.c td_ta_map_id2thr.c td_ta_map_lwp2thr.c \
- td_ta_new.c td_ta_thr_iter.c td_ta_tsd_iter.c \
- td_thr_get_info.c td_thr_getfpregs.c td_thr_getgregs.c \
- td_thr_getxregs.c td_thr_getxregsize.c td_thr_setfpregs.c \
- td_thr_setgregs.c td_thr_setprio.c td_thr_setsigpending.c \
- td_thr_setxregs.c td_thr_sigsetmask.c td_thr_tsd.c \
- td_thr_validate.c td_thr_dbsuspend.c td_thr_dbresume.c \
- td_ta_setconcurrency.c td_ta_enable_stats.c \
- td_ta_reset_stats.c td_ta_get_stats.c td_ta_event_addr.c \
- td_thr_event_enable.c td_thr_set_event.c \
- td_thr_clear_event.c td_thr_event_getmsg.c \
- td_ta_set_event.c td_ta_event_getmsg.c \
- td_ta_clear_event.c td_symbol_list.c td_thr_tls_get_addr.c
+# Remove any -z defs since this lib will have undefined symbols
+LDFLAGS := $(subst -z defs,,$(LDFLAGS)) --warn-unresolved-symbols
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+CSRC=$(wildcard *.c)
+
+OBJS=$(patsubst %.c,%.o, $(CSRC))
+
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-all: $(LIBTHREAD_DB)
+$(AR_LIB_NAME): $(OBJS)
+ $(INSTALL) -d $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-$(LIBTHREAD_DB) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBTHREAD_DB) $(OBJS)
+$(SO_LIB_NAME): $(AR_LIB_NAME)
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).1 $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.1 \
+ -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).1
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
-$(COBJS): %.o : %.c
+$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
clean:
- $(RM) *.[oa] *~ core
+ $(RM) *.o *~ core
diff --git a/libresolv/Makefile b/libresolv/Makefile
index d6270fe..e32f1dd 100644
--- a/libresolv/Makefile
+++ b/libresolv/Makefile
@@ -20,42 +20,44 @@
# 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.
-# Makefile for uClibc
TOPDIR=../
include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
-LIBRESOLV=libresolv.a
-LIBRESOLV_SHARED=libresolv.so
-LIBRESOLV_SHARED_FULLNAME=libresolv-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+LIB_NAME=libresolv
+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 = resolv.c
OBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBRESOLV)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBRESOLV) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBRESOLV) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBRESOLV)
- $(INSTALL) -m 644 $(LIBRESOLV) $(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=$(LIBRESOLV_SHARED).$(MAJOR_VERSION) \
- -o $(LIBRESOLV_SHARED_FULLNAME) --whole-archive $(LIBRESOLV) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED)
- $(LN) -sf $(LIBRESOLV_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRESOLV_SHARED).$(MAJOR_VERSION)
-
-clean:
- $(RM) *.[oa] *~ core $(LIBRESOLV) $(LIBRESOLV_SHARED_FULLNAME)
+clean:
+ $(RM) *.o *~ core
diff --git a/librt/Makefile b/librt/Makefile
index f820b67..b17e580 100644
--- a/librt/Makefile
+++ b/librt/Makefile
@@ -1,44 +1,60 @@
+# Makefile for uClibc
#
-# Makefile for librt
+# Copyright (C) 2002-2003 Erik Andersen <andersen@uclibc.org>
#
+# 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 Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library 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
TOPDIR=../
include $(TOPDIR)Rules.mak
-LIBRT=librt.a
-LIBRT_SHARED=librt.so
-LIBRT_SHARED_FULLNAME=librt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
+LIB_NAME=librt
+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
# uClibc's librt lacks all aio routines, all clock routines,
# and all shm routines
-CSRC=mq_open.c mq_close.c mq_unlink.c mq_getsetattr.c \
- mq_send.c mq_receive.c mq_notify.c \
- timer_create.c timer_delete.c \
- timer_settime.c timer_gettime.c timer_getoverr.c
+CSRC=$(wildcard *.c)
+
OBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBRT)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBRT) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBRT) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBRT)
- $(INSTALL) -m 644 $(LIBRT) $(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=$(LIBRT_SHARED).$(MAJOR_VERSION) \
- -o $(LIBRT_SHARED_FULLNAME) --whole-archive $(LIBRT) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED)
- $(LN) -sf $(LIBRT_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBRT_SHARED).$(MAJOR_VERSION)
-
clean:
- $(RM) *.[oa] *~ core $(LIBRT) $(LIBRT_SHARED_FULLNAME)
+ $(RM) *.o *~ core
diff --git a/libutil/Makefile b/libutil/Makefile
index 95f8797..6cd07e5 100644
--- a/libutil/Makefile
+++ b/libutil/Makefile
@@ -26,38 +26,41 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
-LIBUTIL=libutil.a
-LIBUTIL_SHARED=libutil.so
-LIBUTIL_SHARED_FULLNAME=libutil-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+LIB_NAME=libutil
+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=login.c login_tty.c logout.c logwtmp.c openpty.c
-ifeq ($(strip $(ARCH_HAS_MMU)),y)
- CSRC+=forkpty.c
+CSRC=$(wildcard *.c)
+ifneq ($(strip $(ARCH_HAS_MMU)),y)
+CSRC := $(filter-out forkpty.c,$(CSRC))
endif
+
OBJS=$(patsubst %.c,%.o, $(CSRC))
-all: $(LIBUTIL)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: $(AR_LIB_NAME)
+endif
-$(LIBUTIL) ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBUTIL) $(OBJS)
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBUTIL)
- $(INSTALL) -m 644 $(LIBUTIL) $(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=$(LIBUTIL_SHARED).$(MAJOR_VERSION) \
- -o $(LIBUTIL_SHARED_FULLNAME) --whole-archive $(LIBUTIL) \
- --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
- -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED)
- $(LN) -sf $(LIBUTIL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBUTIL_SHARED).$(MAJOR_VERSION)
-
clean:
- $(RM) *.[oa] *~ core $(LIBUTIL) $(LIBUTIL_SHARED_FULLNAME)
+ $(RM) *.o *~ core
diff --git a/test/Makefile b/test/Makefile
index cc54cd2..ba2b26a 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -42,7 +42,6 @@ tags:
ctags -R
clean: subdirs_clean
- $(RM) *.[oa] *~ core
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))