OSDN Git Service

A large update from Manuel Novoa III <mnovoa3@bellsouth.net>.
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / common / Makefile
1 # Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk> Makefile
2 # for uClibc
3 #
4 # Copyright (C) 2000 by Lineo, inc.
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 # Derived in part from the Linux-8086 C library, the GNU C Library, and several
21 # other sundry sources.  Files within this library are copyright by their
22 # respective copyright holders.
23
24 TOPDIR=../../../
25 include $(TOPDIR)Rules.mak
26 LIBC=$(TOPDIR)libc.a
27
28 CSRC =closedir.c dirfd.c getdents.c getdnnm.c gethstnm.c getpagesize.c \
29         isatty.c kernel_version.c mkfifo.c opendir.c readdir.c rewinddir.c \
30         seekdir.c setegid.c seteuid.c setpgrp.c statfix.c tell.c telldir.c \
31         wait.c wait3.c _xmknod.c libc_init.c tcgetatr.c
32 COBJS=$(patsubst %.c,%.o, $(CSRC))
33
34 NISRC= _fxstat.c _lxstat.c _xstat.c
35 NIOBJS=$(patsubst %.c,%.o, $(NISRC))
36
37 MSRC=syscalls.c
38 MOBJ=$(shell ./list_syscalls.sh)
39
40 OBJ=$(COBJS) $(NIOBJS) $(MOBJ)
41
42 UNIFIED_SYSCALL_HEADER = /dev/null
43 STR_SYSCALLS =
44 ifeq ($(UNIFIED_SYSCALL),true)
45         ifeq ($(TARGET_ARCH), i386)
46                 UNIFIED_SYSCALL_HEADER = unified_syscall_i386.h
47                 STR_SYSCALLS = str_syscalls
48         endif
49 endif
50
51 all: $(STR_SYSCALLS) unified_syscall.h $(OBJ) $(LIBC)
52
53 $(LIBC): ar-target
54
55 ar-target: $(OBJ)
56         $(AR) $(ARFLAGS) $(LIBC) $(OBJ)
57
58 $(MOBJ): $(MSRC)
59         $(CC) $(CFLAGS) -DL_$* $< -c -o $*.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 $(NIOBJS):
67         $(CC) $(CFLAGS) $< -c $*.c -o $*.o -fno-inline
68         $(STRIPTOOL) -x -R .note -R .comment $*.o
69
70 str_syscalls:
71         ./str_syscalls.sh > str_syscalls.c
72         gcc str_syscalls.c -o str_syscalls
73         ./str_syscalls > str_syscalls.h
74
75 unified_syscall.h:
76         cat $(UNIFIED_SYSCALL_HEADER) > unified_syscall.h
77
78 clean:
79         rm -f *.[oa] *~ core unified_syscall.h str_syscalls.[ch] str_syscalls
80