From 998913a5ce37f97c69be8ee7f57a3ad8478c8a80 Mon Sep 17 00:00:00 2001
From: "Peter S. Mazinger" <ps.m@gmx.net>
Date: Tue, 11 Oct 2005 23:05:36 +0000
Subject: Do not defer expansions where useless, like
 CSRC/OBJS/LIB_NAME/AR_LIB_NAME, defer only for shared lib related stuff,
 because it is optional. Run STRIPTOOL only once. More use of /$^/$<.

---
 ldso/ldso/Makefile  | 25 ++++++++++++-------------
 ldso/libdl/Makefile | 30 +++++++++++++++---------------
 2 files changed, 27 insertions(+), 28 deletions(-)

(limited to 'ldso')

diff --git a/ldso/ldso/Makefile b/ldso/ldso/Makefile
index 2d7d867f9..cf5d07d57 100644
--- a/ldso/ldso/Makefile
+++ b/ldso/ldso/Makefile
@@ -67,34 +67,33 @@ 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
+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))
+CSRC := ldso.c
+COBJS := $(patsubst %.c,%.o, $(CSRC))
 
-ASRC=$(wildcard $(TARGET_ARCH)/*.S)
-AOBJS=$(patsubst %.S,%.o, $(ASRC))
+ASRC := $(wildcard $(TARGET_ARCH)/*.S)
+AOBJS := $(patsubst %.S,%.o, $(ASRC))
 
-OBJS=$(AOBJS) $(COBJS)
+OBJS := $(AOBJS) $(COBJS)
 
 all: $(SO_LIB_NAME)
 
 $(SO_LIB_NAME): $(OBJS)
 	$(INSTALL) -d $(TOPDIR)lib
-	$(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME)
+	$(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $@
+	$(STRIPTOOL) -x -R .note -R .comment $^
 	$(LD) $(LDFLAGS) -soname=$(UCLIBC_LDSO) \
-		-o $(TOPDIR)lib/$(SO_FULL_NAME) $(OBJS) $(LIBGCC)
-	$(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
+		-o $(TOPDIR)lib/$(SO_FULL_NAME) $^ $(LIBGCC)
+	$(LN) -sf $(SO_FULL_NAME) $@
 
 $(COBJS): %.o : %.c
 	$(CC) $(XXFLAGS) -c $< -o $@
-	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 $(AOBJS): %.o : %.S
 	$(CC) $(ASFLAGS) -c $< -o $@
-	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:
 	$(RM) *.o */*.o *~ core
diff --git a/ldso/libdl/Makefile b/ldso/libdl/Makefile
index 76149adbf..d31ce256d 100644
--- a/ldso/libdl/Makefile
+++ b/ldso/libdl/Makefile
@@ -45,14 +45,14 @@ ifeq ($(strip $(TARGET_ARCH)),mips)
 XXFLAGS := $(XXFLAGS:-O0=-O1)
 endif
 
-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
+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
 
-CSRC = libdl.c
-OBJS = libdl.o
-PIC_OBJS = libdl_pic.o
+CSRC := libdl.c
+OBJS := libdl.o
+PIC_OBJS := libdl_pic.o
 
 # we do not get here, do we need a libdl.a, if ld.so is not ours?
 #ifeq ($(strip $(HAVE_SHARED)),y)
@@ -63,24 +63,25 @@ all: $(AR_LIB_NAME) $(SO_LIB_NAME)
 
 $(AR_LIB_NAME): $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
 	$(INSTALL) -d $(TOPDIR)lib
-	$(RM) $(AR_LIB_NAME)
-	$(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
+	$(RM) $@
+	$(AR) $(ARFLAGS) $@ $^
 
 shared_$(LIB_NAME).a: $(PIC_OBJS)
-	$(RM) shared_$(LIB_NAME).a
-	$(AR) $(ARFLAGS) shared_$(LIB_NAME).a $(PIC_OBJS)
+	$(RM) $@
+	$(STRIPTOOL) -x -R .note -R .comment $^
+	$(AR) $(ARFLAGS) $@ $^
 
 # 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) ; \
+		$(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $@ ; \
 		$(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
-			-o $(TOPDIR)lib/$(SO_FULL_NAME) -fini dl_cleanup --whole-archive shared_$(LIB_NAME).a \
+			-o $(TOPDIR)lib/$(SO_FULL_NAME) -fini dl_cleanup --whole-archive $< \
 			--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) ; \
+		$(LN) -sf $(SO_FULL_NAME) $@ ; \
 	fi
 
 $(OBJS): %.o : %.c
@@ -89,7 +90,6 @@ $(OBJS): %.o : %.c
 
 libdl_pic.o: libdl.c
 	$(CC) $(XXFLAGS) -c $< -o $@
-	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 clean:
 	$(RM) *.[oa] *~ core
-- 
cgit v1.2.3