OSDN Git Service

Add PIE support to ARM. From Peter Mazinger
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / arm / Makefile
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Library General Public License as published by the Free
7 # Software Foundation; either version 2 of the License, or (at your option) any
8 # later version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
13 # details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 TOPDIR=../../../../
20 include $(TOPDIR)Rules.mak
21
22 CRT0_SRC = crt0.S
23 CRT0_OBJ = crt0.o crt1.o
24 SCRT0_OBJ = $(patsubst %,S%, $(CRT0_OBJ))
25 CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
26
27 SSRC=__longjmp.S vfork.S clone.S setjmp.S bsd-setjmp.S \
28         bsd-_setjmp.S sigrestorer.S mmap64.S
29 SOBJS=$(patsubst %.S,%.o, $(SSRC))
30
31 CSRC=brk.c syscall.c ioperm.c sigaction.c
32 COBJS=$(patsubst %.c,%.o, $(CSRC))
33
34 OBJS=$(SOBJS) $(MOBJ) $(COBJS)
35
36 OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
37
38 all: $(OBJ_LIST)
39
40 $(OBJ_LIST): $(OBJS) $(CRT0_OBJ) $(SCRT0_OBJ) $(CTOR_TARGETS)
41         echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
42         $(INSTALL) -d $(TOPDIR)lib/
43         cp $(CRT0_OBJ) $(SCRT0_OBJ) $(TOPDIR)lib/
44 ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
45         $(RM) $(TOPDIR)lib/Scrt0.o
46 else
47         mv $(TOPDIR)lib/Scrt0.o $(TOPDIR)lib/Scrt1.o
48 endif
49
50 $(CRT0_OBJ): $(CRT0_SRC)
51         $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
52         $(STRIPTOOL) -x -R .note -R .comment $*.o
53
54 $(SCRT0_OBJ): $(CRT0_SRC)
55         $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
56         $(STRIPTOOL) -x -R .note -R .comment $*.o
57
58 $(SOBJS): %.o : %.S
59         $(CC) $(ASFLAGS) -c $< -o $@
60         $(STRIPTOOL) -x -R .note -R .comment $*.o
61
62 $(COBJS): %.o : %.c
63         $(CC) $(CFLAGS) -c $< -o $@
64         $(STRIPTOOL) -x -R .note -R .comment $*.o
65
66 ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
67 crti.o: crti.S
68         $(CC) $(ASFLAGS) -c crti.S -o crti.o
69
70 $(TOPDIR)lib/crti.o: crti.o
71         $(INSTALL) -d $(TOPDIR)lib/
72         cp crti.o $(TOPDIR)lib/
73
74 crtn.o: crtn.S
75         $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
76
77 $(TOPDIR)lib/crtn.o: crtn.o
78         $(INSTALL) -d $(TOPDIR)lib/
79         cp crtn.o $(TOPDIR)lib/
80 else
81 $(TOPDIR)lib/crti.o:
82         $(INSTALL) -d $(TOPDIR)lib/
83         $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
84 $(TOPDIR)lib/crtn.o:
85         $(INSTALL) -d $(TOPDIR)lib/
86         $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
87 endif
88
89 headers:
90         $(LN) -fs ../libc/sysdeps/linux/arm/fpu_control.h $(TOPDIR)/include/
91
92 clean:
93         $(RM) *.[oa] *~ core
94         $(RM) bits/sysnum.h