summaryrefslogtreecommitdiffstats
path: root/libutil/Makefile
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 /libutil/Makefile
parente1ac781ed8b4a0f44a696f95618b73d2fa490576 (diff)
downloaduClibc-alpine-f70602be19ff8042c369ea33b29f90b8c0f5d02e.tar.bz2
uClibc-alpine-f70602be19ff8042c369ea33b29f90b8c0f5d02e.tar.xz
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
Diffstat (limited to 'libutil/Makefile')
-rw-r--r--libutil/Makefile49
1 files changed, 26 insertions, 23 deletions
diff --git a/libutil/Makefile b/libutil/Makefile
index 95f879786..6cd07e5e9 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