OSDN Git Service

Remove ar-target and shared targets, at build time now we traverse the tree only...
[uclinux-h8/uClibc.git] / ldso / libdl / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000 by Lineo, inc.
4 # Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
5 #
6 # This program is free software; you can redistribute it and/or modify it under
7 # the terms of the GNU Library General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option) any
9 # later version.
10 #
11 # This program is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
14 # details.
15 #
16 # You should have received a copy of the GNU Library General Public License
17 # along with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20
21 TOPDIR=../../
22 include $(TOPDIR)Rules.mak
23
24 XXFLAGS=$(XWARNINGS) $(SSP_CFLAGS) $(SSP_ALL_CFLAGS)
25 ifeq ($(DODEBUG),y)
26 XXFLAGS+=-O0 -g3
27 else
28 XXFLAGS+=$(OPTIMIZATION)
29 endif
30 XXFLAGS+= $(XARCH_CFLAGS) $(CPU_CFLAGS) \
31         -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
32         -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I$(TOPDIR)ldso/ldso -I$(TOPDIR)include
33
34 XXFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
35 ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
36 XXFLAGS+=-D__SUPPORT_LD_DEBUG__
37 endif
38 XXFLAGS_NOPIC:=$(XXFLAGS)
39 ifeq ($(DOPIC),y)
40     XXFLAGS += $(PICFLAG) -D__LIBDL_SHARED__
41 endif
42
43 LIB_NAME=libdl
44 AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
45 SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
46 SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
47
48 CSRC = libdl.c
49 OBJS = libdl.o
50 PIC_OBJS = libdl_pic.o
51
52 # we do not get here, do we need a libdl.a, if ld.so is not ours?
53 #ifeq ($(strip $(HAVE_SHARED)),y)
54 all: $(AR_LIB_NAME) $(SO_LIB_NAME)
55 #else
56 #all: $(AR_LIB_NAME)
57 #endif
58
59 $(AR_LIB_NAME): $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
60         $(INSTALL) -d $(TOPDIR)lib
61         $(RM) $(AR_LIB_NAME)
62         $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS) ../ldso/$(TARGET_ARCH)/resolve.o
63
64 shared_$(LIB_NAME).a: $(PIC_OBJS)
65         $(RM) shared_$(LIB_NAME).a
66         $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $(PIC_OBJS)
67
68 # this will be built only on the second round, when libc.so is present,
69 # else we would link against libc.a
70 $(SO_LIB_NAME): shared_$(LIB_NAME).a
71         if [ -f $(TOPDIR)lib/libc.so ] ; then \
72                 $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME) ; \
73                 $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
74                         -o $(TOPDIR)lib/$(SO_FULL_NAME) -fini dl_cleanup --whole-archive shared_$(LIB_NAME).a \
75                         --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
76                         -L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) ; \
77                 $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) ; \
78                 $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME) ; \
79         fi
80
81 $(OBJS): %.o : %.c
82         $(CC) $(XXFLAGS_NOPIC) -c $< -o $@
83         $(STRIPTOOL) -x -R .note -R .comment $*.o
84
85 libdl_pic.o: libdl.c
86         $(CC) $(XXFLAGS) -c $< -o $@
87         $(STRIPTOOL) -x -R .note -R .comment $*.o
88
89 clean:
90         $(RM) *.o *~ core *.a