1 |
1325 |
phoenix |
# Makefile for uClibc
|
2 |
|
|
#
|
3 |
|
|
# Copyright (C) 2000 by Lineo, inc.
|
4 |
|
|
# Copyright (C) 2000-2002 Erik Andersen
|
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) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) \
|
25 |
|
|
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
|
26 |
|
|
-fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
|
27 |
|
|
|
28 |
|
|
ifeq ($(DODEBUG),y)
|
29 |
|
|
XXFLAGS=$(XWARNINGS) -O0 -g3 $(XARCH_CFLAGS) $(CPU_CFLAGS) \
|
30 |
|
|
-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" \
|
31 |
|
|
-fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)ldso/include -I. -I$(TOPDIR)include
|
32 |
|
|
endif
|
33 |
|
|
|
34 |
|
|
XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp")
|
35 |
|
|
XXFLAGS_NOPIC:=$(XXFLAGS)
|
36 |
|
|
ifeq ($(DOPIC),y)
|
37 |
|
|
XXFLAGS += $(PICFLAG)
|
38 |
|
|
endif
|
39 |
|
|
ifeq ($(strip $(SUPPORT_LD_DEBUG)),y)
|
40 |
|
|
XXFLAGS+=-D__SUPPORT_LD_DEBUG__
|
41 |
|
|
endif
|
42 |
|
|
|
43 |
|
|
LIBDL=libdl.a
|
44 |
|
|
LIBDL_PIC=libdl_pic.a
|
45 |
|
|
LIBDL_SHARED=libdl.so
|
46 |
|
|
LIBDL_SHARED_FULLNAME=libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
|
47 |
|
|
|
48 |
|
|
CSRC=dlib.c
|
49 |
|
|
OBJS=dlib.o
|
50 |
|
|
PIC_OBJS=dlib_pic.o
|
51 |
|
|
|
52 |
|
|
all: $(OBJS) $(LIBDL) shared
|
53 |
|
|
|
54 |
|
|
$(LIBDL): ar-target
|
55 |
|
|
|
56 |
|
|
ar-target: $(OBJS) $(PIC_OBJS)
|
57 |
|
|
$(AR) $(ARFLAGS) $(LIBDL) ../ldso/$(TARGET_ARCH)/resolve.o $(OBJS)
|
58 |
|
|
$(AR) $(ARFLAGS) $(LIBDL_PIC) $(PIC_OBJS)
|
59 |
|
|
$(INSTALL) -d $(TOPDIR)lib
|
60 |
|
|
$(RM) $(TOPDIR)lib/$(LIBDL)
|
61 |
|
|
$(INSTALL) -m 644 $(LIBDL) $(TOPDIR)lib
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
dlib.o: dlib.c
|
65 |
|
|
$(CC) $(XXFLAGS_NOPIC) -c dlib.c -o dlib.o
|
66 |
|
|
$(STRIPTOOL) -x -R .note -R .comment $*.o
|
67 |
|
|
|
68 |
|
|
dlib_pic.o: dlib.c
|
69 |
|
|
$(CC) $(XXFLAGS) -c dlib.c -o dlib_pic.o
|
70 |
|
|
$(STRIPTOOL) -x -R .note -R .comment $*.o
|
71 |
|
|
|
72 |
|
|
$(OBJ): Makefile
|
73 |
|
|
|
74 |
|
|
shared:
|
75 |
|
|
$(LD) $(LDFLAGS) -soname=$(LIBDL_SHARED).$(MAJOR_VERSION) \
|
76 |
|
|
-o $(LIBDL_SHARED_FULLNAME) --whole-archive $(LIBDL_PIC) \
|
77 |
|
|
--no-whole-archive $(TOPDIR)/libc/misc/internals/interp.o \
|
78 |
|
|
-L$(TOPDIR)/lib -lc;
|
79 |
|
|
$(INSTALL) -d $(TOPDIR)lib
|
80 |
|
|
$(RM) $(TOPDIR)lib/$(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
|
81 |
|
|
$(INSTALL) -m 644 $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib
|
82 |
|
|
$(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED)
|
83 |
|
|
$(LN) -sf $(LIBDL_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBDL_SHARED).$(MAJOR_VERSION)
|
84 |
|
|
|
85 |
|
|
clean:
|
86 |
|
|
$(RM) .depend $(LIBDL_SHARED)* $(LIBDL_SHARED_FULLNAME) core *.o *.a *.s *.i tmp_make foo *~
|