OSDN Git Service

Rework things such that staticly linked applications can use
[uclinux-h8/uclibc-ng.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+=-DUCLIBC_TARGET_PREFIX=\"$(TARGET_PREFIX)\" \
25         -DUCLIBC_DEVEL_PREFIX=\"$(DEVEL_PREFIX)\" \
26         -DUCLIBC_BUILD_DIR=\"$(shell cd $(TOPDIR) && pwd)\"
27 ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
28 XXFLAGS+=-D__SUPPORT_LD_DEBUG__
29 endif
30
31 LIBDL=libdl.a
32 LIBDL_PIC=libdl_pic.a
33 LIBDL_SHARED=libdl.so
34 LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
35
36 CSRC=dlib.c
37 OBJS=dlib.o
38 PIC_OBJS=dlib_pic.o
39
40 all: $(OBJS) $(LIBDL) shared
41
42 $(LIBDL): ar-target
43
44 ar-target: $(OBJS) $(PIC_OBJS)
45         $(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
46         $(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
47         install -d $(TOPDIR)lib
48         rm -f $(TOPDIR)lib/$(LIBDL)
49         install -m 644 $(LIBDL) $(TOPDIR)lib
50
51
52 dlib.o: dlib.c
53         $(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS_NOPIC) $(XXFLAGS) -c dlib.c -o dlib.o
54         $(STRIPTOOL) -x -R .note -R .comment $*.o
55
56 dlib_pic.o: dlib.c
57         $(CC) -I../ldso -I../ldso/$(TARGET_ARCH) $(CFLAGS) -c dlib.c -o dlib_pic.o
58         $(STRIPTOOL) -x -R .note -R .comment $*.o
59
60 $(OBJ): Makefile
61
62 shared:
63         $(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
64                 -o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL_PIC) \
65                 --no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
66                 -L$(TOPDIR)/lib -lc;
67         install -d $(TOPDIR)lib
68         rm -f $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
69         install -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib;
70         (cd $(TOPDIR)lib && ln -sf $(LIBDL_SHARED_FULLNAME) $(LIBDL_SHARED)); 
71         (cd $(TOPDIR)lib && ln -sf $(LIBDL_SHARED_FULLNAME) $(LIBDL_SHARED).$(MAJOR_VERSION)); 
72
73 clean:
74         $(RM) -f .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~
75