Magellan Linux

Contents of /trunk/mkinitrd-magellan/klibc/usr/klibc/Kbuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1297 - (show annotations) (download)
Fri May 27 15:12:11 2011 UTC (12 years, 11 months ago) by niro
File size: 5996 byte(s)
-updated to klibc-1.5.22 with mntproc definitions patch included
1 #
2 # Kbuild file for klibc
3 #
4
5 # Tell that we are building klibc
6 export klibc-build := y
7
8 klib-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \
9 asprintf.o vasprintf.o \
10 vsscanf.o sscanf.o ctypes.o \
11 strntoumax.o strntoimax.o \
12 atoi.o atol.o atoll.o \
13 strtol.o strtoll.o strtoul.o strtoull.o \
14 strtoimax.o strtoumax.o \
15 globals.o exit.o atexit.o onexit.o \
16 execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \
17 fork.o vfork.o wait.o wait3.o waitpid.o system.o \
18 setpgrp.o getpgrp.o daemon.o \
19 printf.o vprintf.o fprintf.o vfprintf.o perror.o \
20 statfs.o fstatfs.o umount.o \
21 creat.o open.o openat.o open_cloexec.o \
22 fopen.o fread.o fread2.o fgetc.o fgets.o \
23 fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \
24 sleep.o usleep.o strtotimespec.o strtotimeval.o \
25 raise.o abort.o assert.o alarm.o pause.o \
26 __signal.o sysv_signal.o bsd_signal.o siglist.o sigabbrev.o \
27 siglongjmp.o \
28 sigaction.o sigpending.o sigprocmask.o sigsuspend.o \
29 pselect.o ppoll.o \
30 brk.o sbrk.o malloc.o realloc.o calloc.o \
31 mmap.o shm_open.o shm_unlink.o \
32 memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \
33 memmove.o memchr.o memrchr.o bzero.o \
34 strcasecmp.o strncasecmp.o strndup.o strerror.o strsignal.o \
35 strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \
36 strncat.o strlcpy.o strlcat.o \
37 strstr.o strncmp.o strncpy.o strrchr.o \
38 strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \
39 strtok_r.o \
40 fnmatch.o \
41 gethostname.o getdomainname.o getcwd.o \
42 seteuid.o setegid.o \
43 getenv.o setenv.o putenv.o __put_env.o unsetenv.o \
44 clearenv.o nullenv.o \
45 getopt.o getopt_long.o readdir.o remove.o \
46 syslog.o closelog.o pty.o getpt.o posix_openpt.o isatty.o reboot.o \
47 time.o utime.o llseek.o nice.o getpriority.o \
48 qsort.o bsearch.o \
49 lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \
50 inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \
51 inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \
52 send.o recv.o \
53 ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \
54 ctype/isblank.o ctype/iscntrl.o ctype/isdigit.o \
55 ctype/isgraph.o ctype/islower.o ctype/isprint.o \
56 ctype/ispunct.o ctype/isspace.o ctype/isupper.o \
57 ctype/isxdigit.o ctype/tolower.o ctype/toupper.o \
58 userdb/getgrgid.o userdb/getgrnam.o userdb/getpwnam.o \
59 userdb/getpwuid.o userdb/root_group.o userdb/root_user.o \
60 setmntent.o endmntent.o getmntent.o
61
62 klib-$(CONFIG_KLIBC_ERRLIST) += errlist.o
63
64 ifeq ($(CONFIG_KLIBC_ERRLIST),y)
65 KLIBCCFLAGS_strerror.o += -DWITH_ERRLIST
66 endif
67
68 klib-$(CONFIG_KLIBC_ZLIB) += zlib/
69 # arch specific .o files
70 klib-y += arch/$(KLIBCARCHDIR)/
71
72 #####
73 # Shared definitions
74 LIBC := libc.a
75 SOLIB := libc.so
76 SOHASH := klibc.so
77 CRT0 := arch/$(KLIBCARCHDIR)/crt0.o
78 INTERP_O := interp.o
79
80 always := $(LIBC) $(SOLIB) $(SOHASH) $(INTERP_O)
81 LIBC := $(call objectify,$(LIBC))
82 SOLIB := $(call objectify,$(SOLIB))
83 SOHASH := $(call objectify,$(SOHASH))
84 CRT0 := $(call objectify,$(CRT0))
85 INTERP_O := $(call objectify,$(INTERP_O))
86
87 SOLIBHASH = $(shell cat $(SOLIB).hash)
88
89 # Generate syscall stubs
90 klib-y += syscalls/
91 # Generate socket calls stubs
92 klib-y += socketcalls/
93
94 #####
95 # Readable errormessages extracted from src..
96 targets += errlist.c
97 quiet_cmd_errlist = GEN $@
98 cmd_errlist = $(PERL) $< $(KLIBCCPPFLAGS) -errlist > $@ || rm -f $@
99
100 $(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl
101 $(call cmd,errlist)
102
103
104 # all .o files for all dirs
105 klib-o-files = $(shell cat $(obj)/klib.list \
106 $(addsuffix /klib.list, $(klib-dirs)))
107 ######
108 # Build static library: libc.a
109 targets += libc.a __static_init.o
110 quiet_cmd_libc = KLIBCAR $@
111 cmd_libc = rm -f $@; \
112 $(call klibc-ar,cq,Dcq) $@ \
113 $(call objectify,__static_init.o) $(klib-o-files); \
114 $(KLIBCRANLIB) $@
115
116 $(LIBC): $(call objectify,__static_init.o) $(obj)/klib.list FORCE
117 $(call if_changed,libc)
118
119 ######
120 # Build shared library
121 targets += libc.so __shared_init.o
122
123 quiet_cmd_libcso = KLIBCLD $@
124 cmd_libcso = $(KLIBCLD) $(KLIBCLDFLAGS) $(KLIBCSHAREDFLAGS) -o $@ \
125 --start-group \
126 $(CRT0) \
127 $(call objectify,__shared_init.o) \
128 $(klib-o-files) \
129 $(KLIBCLIBGCC) \
130 --end-group
131
132 $(SOLIB): $(call objectify,__shared_init.o) $(obj)/klib.list FORCE
133 $(call if_changed,libcso)
134
135
136 #####
137 # Build sha1 hash values
138 targets += klibc.so libc.so.hash
139 hostprogs-y := sha1hash
140 clean-files += klibc-???????????????????????????.so
141
142 quiet_cmd_solibhash = HASH $@
143 cmd_solibhash = $(KLIBCNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \
144 sort | $(obj)/sha1hash > $@
145 $(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE
146 $(call if_changed,solibhash)
147
148 quiet_cmd_sohash = GEN $@
149 cmd_sohash = cat $< > $@; \
150 $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@; \
151 chmod a+x $@; \
152 rm -f $(obj)/klibc-???????????????????????????.so; \
153 ln -f $@ $(obj)/klibc-$(SOLIBHASH).so
154 $(SOHASH): $(SOLIB) $(SOLIB).hash
155 $(call cmd,sohash)
156
157
158 #####
159 # build interp.o
160 targets += interp.o
161
162 quiet_cmd_interp = BUILD $@
163 cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \
164 -DLIBDIR=\"$(SHLIBDIR)\" \
165 -DSOHASH=\"$(SOLIBHASH)\" \
166 -c -o $@ $<
167
168 $(INTERP_O): $(obj)/interp.S $(SOLIB).hash
169 $(call if_changed,interp)
170
171 #####
172 # Install klibc
173 install-rule:
174 @echo " INSTALL klibc to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib"
175 $(Q)$(foreach f, $(LIBC) $(SOLIB) $(CRT0) $(INTERP_O), \
176 $(shell $(install-data) $(f) \
177 $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib))
178 $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
179 $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib
180 $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \
181 $(INSTALLROOT)$(SHLIBDIR)