Annotation of /trunk/mkinitrd-magellan/klibc/usr/klibc/Kbuild
Parent Directory | Revision Log
Revision 815 -
(hide annotations)
(download)
Fri Apr 24 18:32:46 2009 UTC (15 years, 5 months ago) by niro
File size: 5930 byte(s)
Fri Apr 24 18:32:46 2009 UTC (15 years, 5 months ago) by niro
File size: 5930 byte(s)
-updated to klibc-1.5.15
1 | niro | 532 | # |
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 | niro | 815 | memmove.o memchr.o memrchr.o bzero.o \ |
34 | niro | 532 | 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 | fnmatch.o \ | ||
40 | gethostname.o getdomainname.o getcwd.o \ | ||
41 | seteuid.o setegid.o \ | ||
42 | getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ | ||
43 | clearenv.o nullenv.o \ | ||
44 | getopt.o getopt_long.o readdir.o remove.o \ | ||
45 | niro | 815 | syslog.o closelog.o pty.o getpt.o posix_openpt.o isatty.o reboot.o \ |
46 | niro | 532 | time.o utime.o llseek.o nice.o getpriority.o \ |
47 | qsort.o bsearch.o \ | ||
48 | lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ | ||
49 | inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ | ||
50 | inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ | ||
51 | send.o recv.o \ | ||
52 | ctype/isalnum.o ctype/isalpha.o ctype/isascii.o \ | ||
53 | ctype/isblank.o ctype/iscntrl.o ctype/isdigit.o \ | ||
54 | ctype/isgraph.o ctype/islower.o ctype/isprint.o \ | ||
55 | ctype/ispunct.o ctype/isspace.o ctype/isupper.o \ | ||
56 | ctype/isxdigit.o ctype/tolower.o ctype/toupper.o \ | ||
57 | userdb/getgrgid.o userdb/getgrnam.o userdb/getpwnam.o \ | ||
58 | userdb/getpwuid.o userdb/root_group.o userdb/root_user.o | ||
59 | |||
60 | klib-$(CONFIG_KLIBC_ERRLIST) += errlist.o | ||
61 | |||
62 | ifeq ($(CONFIG_KLIBC_ERRLIST),y) | ||
63 | KLIBCCFLAGS_strerror.o += -DWITH_ERRLIST | ||
64 | endif | ||
65 | |||
66 | klib-$(CONFIG_KLIBC_ZLIB) += zlib/ | ||
67 | # arch specific .o files | ||
68 | klib-y += arch/$(KLIBCARCHDIR)/ | ||
69 | |||
70 | ##### | ||
71 | # Shared definitions | ||
72 | LIBC := libc.a | ||
73 | SOLIB := libc.so | ||
74 | SOHASH := klibc.so | ||
75 | CRT0 := arch/$(KLIBCARCHDIR)/crt0.o | ||
76 | INTERP_O := interp.o | ||
77 | |||
78 | always := $(LIBC) $(SOLIB) $(SOHASH) $(INTERP_O) | ||
79 | LIBC := $(call objectify,$(LIBC)) | ||
80 | SOLIB := $(call objectify,$(SOLIB)) | ||
81 | SOHASH := $(call objectify,$(SOHASH)) | ||
82 | CRT0 := $(call objectify,$(CRT0)) | ||
83 | INTERP_O := $(call objectify,$(INTERP_O)) | ||
84 | |||
85 | SOLIBHASH = $(shell cat $(SOLIB).hash) | ||
86 | |||
87 | # Generate syscall stubs | ||
88 | klib-y += syscalls/ | ||
89 | # Generate socket calls stubs | ||
90 | klib-y += socketcalls/ | ||
91 | |||
92 | ##### | ||
93 | # Readable errormessages extracted from src.. | ||
94 | targets += errlist.c | ||
95 | quiet_cmd_errlist = GEN $@ | ||
96 | cmd_errlist = $(PERL) $< $(KLIBCCPPFLAGS) -errlist > $@ || rm -f $@ | ||
97 | |||
98 | $(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl | ||
99 | $(call cmd,errlist) | ||
100 | |||
101 | |||
102 | # all .o files for all dirs | ||
103 | klib-o-files = $(shell cat $(obj)/klib.list \ | ||
104 | $(addsuffix /klib.list, $(klib-dirs))) | ||
105 | ###### | ||
106 | # Build static library: libc.a | ||
107 | targets += libc.a __static_init.o | ||
108 | quiet_cmd_libc = KLIBCAR $@ | ||
109 | cmd_libc = rm -f $@; \ | ||
110 | $(KLIBCAR) cq $@ \ | ||
111 | $(call objectify,__static_init.o) $(klib-o-files); \ | ||
112 | $(KLIBCRANLIB) $@ | ||
113 | |||
114 | $(LIBC): $(call objectify,__static_init.o) $(obj)/klib.list FORCE | ||
115 | $(call if_changed,libc) | ||
116 | |||
117 | ###### | ||
118 | # Build shared library | ||
119 | targets += libc.so __shared_init.o | ||
120 | |||
121 | quiet_cmd_libcso = KLIBCLD $@ | ||
122 | cmd_libcso = $(KLIBCLD) $(KLIBCLDFLAGS) $(KLIBCSHAREDFLAGS) -o $@ \ | ||
123 | --start-group \ | ||
124 | $(CRT0) \ | ||
125 | $(call objectify,__shared_init.o) \ | ||
126 | $(klib-o-files) \ | ||
127 | $(KLIBCLIBGCC) \ | ||
128 | --end-group | ||
129 | |||
130 | $(SOLIB): $(call objectify,__shared_init.o) $(obj)/klib.list FORCE | ||
131 | $(call if_changed,libcso) | ||
132 | |||
133 | |||
134 | ##### | ||
135 | # Build sha1 hash values | ||
136 | targets += klibc.so libc.so.hash | ||
137 | hostprogs-y := sha1hash | ||
138 | clean-files += klibc-???????????????????????????.so | ||
139 | |||
140 | quiet_cmd_solibhash = HASH $@ | ||
141 | cmd_solibhash = $(KLIBCNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \ | ||
142 | sort | $(obj)/sha1hash > $@ | ||
143 | $(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE | ||
144 | $(call if_changed,solibhash) | ||
145 | |||
146 | quiet_cmd_sohash = GEN $@ | ||
147 | cmd_sohash = cat $< > $@; \ | ||
148 | $(KLIBCSTRIP) $(KLIBCSTRIPFLAGS) $@; \ | ||
149 | chmod a+x $@; \ | ||
150 | rm -f $(obj)/klibc-???????????????????????????.so; \ | ||
151 | ln -f $@ $(obj)/klibc-$(SOLIBHASH).so | ||
152 | $(SOHASH): $(SOLIB) $(SOLIB).hash | ||
153 | $(call cmd,sohash) | ||
154 | |||
155 | |||
156 | ##### | ||
157 | # build interp.o | ||
158 | targets += interp.o | ||
159 | |||
160 | quiet_cmd_interp = BUILD $@ | ||
161 | cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \ | ||
162 | -DLIBDIR=\"$(SHLIBDIR)\" \ | ||
163 | -DSOHASH=\"$(SOLIBHASH)\" \ | ||
164 | -c -o $@ $< | ||
165 | |||
166 | $(INTERP_O): $(obj)/interp.S $(SOLIB).hash | ||
167 | $(call if_changed,interp) | ||
168 | |||
169 | ##### | ||
170 | # Install klibc | ||
171 | install-rule: | ||
172 | @echo " INSTALL klibc to $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib" | ||
173 | $(Q)$(foreach f, $(LIBC) $(SOLIB) $(CRT0) $(INTERP_O), \ | ||
174 | $(shell $(install-data) $(f) \ | ||
175 | $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib)) | ||
176 | $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \ | ||
177 | $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)lib | ||
178 | $(Q)$(install-lib) $(obj)/klibc-$(SOLIBHASH).so \ | ||
179 | $(INSTALLROOT)$(SHLIBDIR) |