]> git.pld-linux.org Git - packages/uClibc.git/blame - uClibc-toolchain-wrapper.patch
- really always disable stripping not only with %{?debug}
[packages/uClibc.git] / uClibc-toolchain-wrapper.patch
CommitLineData
ec09a558
AM
1diff -urN uClibc-0.9.29.org/extra/gcc-uClibc/gcc-uClibc.c uClibc-0.9.29/extra/gcc-uClibc/gcc-uClibc.c
2--- uClibc-0.9.29.org/extra/gcc-uClibc/gcc-uClibc.c 1970-01-01 01:00:00.000000000 +0100
06dd9bf8
AM
3+++ uClibc-0.9.29/extra/gcc-uClibc/gcc-uClibc.c 2007-06-03 22:10:49.372320596 +0200
4@@ -0,0 +1,668 @@
5+/* vi: set sw=4 ts=4: */
0a954816
AM
6+/*
7+ * Copyright (C) 2000 Manuel Novoa III
8+ * Copyright (C) 2002-2003 Erik Andersen
9+ *
06dd9bf8
AM
10+ * This is a crude wrapper to use uClibc with gcc.
11+ * It was originally written to work around ./configure for ext2fs-utils.
12+ * It certainly can be improved, but it works for me in the normal cases.
13+ *
14+ * April 7, 2001
15+ *
16+ * A bug was fixed in building the gcc command line when dynamic linking.
17+ * The functions dlopen, etc. now work. At this time, you must make sure
18+ * the correct libdl.so is included however. It is safest to, for example,
19+ * add /lib/libdl.so.1 if using ld-linux.so.1 rather than adding -ldl to the
20+ * command line.
21+ *
22+ * Note: This is only a problem if devel and target archs are the same. To
23+ * avoid the problem, you can use a customized dynamic linker.
24+ *
25+ *
26+ * April 18, 2001
27+ *
28+ * The wrapper now works with either installed and uninstalled uClibc versions.
29+ * If you want to use the uninstalled header files and libs, either include
30+ * the string "build" in the invocation name such as
31+ * 'ln -s <ARCH>-uclibc-gcc <ARCH>-uclibc-gcc-build'
32+ * or include it in the environment variable setting of UCLIBC_ENV.
33+ * Note: This automatically enables the "rpath" behavior described below.
34+ *
35+ * The wrapper will now pass the location of the uClibc shared libs used to
36+ * the linker with the "-rpath" option if the invocation name includes the
37+ * string "rpath" or if the environment variable UCLIBC_ENV include it (as
38+ * with "build" above). This is primarily intended to be used on devel
39+ * platforms of the same arch as the target. A good place to use this feature
40+ * would be in the uClibc/test directory.
41+ *
42+ * The wrapper now displays the command line passed to gcc when '-v' is used.
43+ *
44+ * May 31, 2001
45+ *
46+ * "rpath" and "build" behavior are now decoupled. You can of course get
47+ * the old "build" behavior by setting UCLIBC_ENV="rpath-build". Order
48+ * isn't important here, as only the substrings are searched for.
49+ *
50+ * Added environment variable check for UCLIBC_GCC_DLOPT to let user specify
51+ * an alternative dynamic linker at runtime without using command line args.
52+ * Since this wouldn't commonly be used, I made it easy on myself. You have
53+ * to match the option you would have passed to the gcc wrapper. As an
54+ * example,
55+ *
56+ * export UCLIBC_GCC_DLOPT="-Wl,--dynamic-linker,/lib/ld-alt-linker.so.3"
57+ *
58+ * This is really only useful if target arch == devel arch and DEVEL_PREFIX
59+ * isn't empty. It involves a recompile, but you can at least test apps
60+ * on your devel system if combined with the "rpath" behavor if by using
61+ * LD_LIBRARY_PATH, etc.
62+ *
63+ * Also added check for "-Wl,--dynamic-linker" on the command line. The
64+ * use default dynamic linker or the envirnment-specified dynamic linker
65+ * is disabled in that case.
66+ *
67+ * Added options --uclibc-use-build-dir and --uclibc-use-rpath so that those
68+ * behaviors can be invoked from the command line.
69+ *
70+ */
71+
72+/*
73+ *
74+ * TODO:
75+ * Check/modify gcc-specific environment variables?
0a954816
AM
76+ */
77+
78+#include <stdio.h>
79+#include <stdlib.h>
80+#include <stdarg.h>
81+#include <string.h>
82+#include <unistd.h>
83+#include <errno.h>
84+#include <sys/stat.h>
85+#include <sys/wait.h>
86+
06dd9bf8
AM
87+#include "gcc-uClibc.h"
88+
89+static char *our_usr_lib_path = "-L"UCLIBC_DEVEL_PREFIX"/lib";
90+
0a954816
AM
91+static char static_linking[] = "-static";
92+static char nostdinc[] = "-nostdinc";
93+static char nostartfiles[] = "-nostartfiles";
94+static char nodefaultlibs[] = "-nodefaultlibs";
95+static char nostdlib[] = "-nostdlib";
06dd9bf8 96+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 97+static char nostdinc_plus[] = "-nostdinc++";
06dd9bf8 98+#endif
0a954816 99+
06dd9bf8
AM
100+/* Include a local implementation of basename, since this
101+ * uses the host system's C lib, and CYGWIN apparently
102+ * doesn't provide an implementation of basename(). */
103+char *basename(const char *path)
104+{
105+ register const char *s;
106+ register const char *p;
107+ p = s = path;
108+ while (*s) {
109+ if (*s++ == '/') {
110+ p = s;
111+ }
112+ }
113+ return (char *) p;
114+}
0a954816 115+
06dd9bf8 116+char *dirname(char *path)
0a954816 117+{
06dd9bf8
AM
118+ static const char null_or_empty_or_noslash[] = ".";
119+ register char *s;
120+ register char *last;
121+ char *first;
122+
123+ last = s = path;
124+
125+ if (s != NULL) {
126+
127+LOOP:
128+ while (*s && (*s != '/')) ++s;
129+ first = s;
130+ while (*s == '/') ++s;
131+ if (*s) {
132+ last = first;
133+ goto LOOP;
134+ }
0a954816 135+
06dd9bf8
AM
136+ if (last == path) {
137+ if (*last != '/') {
138+ goto DOT;
139+ }
140+ if ((*++last == '/') && (last[1] == 0)) {
141+ ++last;
142+ }
143+ }
144+ *last = 0;
145+ return path;
0a954816 146+ }
06dd9bf8
AM
147+DOT:
148+ return (char *) null_or_empty_or_noslash;
0a954816
AM
149+}
150+
151+
06dd9bf8 152+extern void *xmalloc(size_t size)
0a954816 153+{
06dd9bf8 154+ void *ptr = malloc(size);
0a954816 155+
06dd9bf8
AM
156+ if (!ptr) {
157+ fprintf(stderr, "memory exhausted");
158+ exit(EXIT_FAILURE);
0a954816 159+ }
06dd9bf8
AM
160+ return ptr;
161+}
ec09a558 162+
06dd9bf8
AM
163+void xstrcat(char **string, ...)
164+{
165+ const char *c;
166+ va_list p;
167+ /* Don't bother to calculate how big exerything
168+ * will be, just be careful to not overflow... */
169+ va_start(p, string);
170+ *string = xmalloc(BUFSIZ);
171+ **string = '\0';
172+ while(1) {
173+ if (!(c = va_arg(p, const char *)))
174+ break;
175+ strcat(*string, c);
176+ }
177+ va_end(p);
0a954816
AM
178+}
179+
180+int main(int argc, char **argv)
181+{
182+ int use_build_dir = 0, linking = 1, use_static_linking = 0;
183+ int use_stdinc = 1, use_start = 1, use_stdlib = 1, use_pic = 0;
184+ int source_count = 0, use_rpath = 0, verbose = 0;
06dd9bf8
AM
185+ int i, j, k, l, m, n;
186+ char ** gcc_argv;
187+ char ** gcc_argument;
188+ char ** libraries;
189+ char ** libpath;
190+ char *dlstr;
191+ char *incstr;
192+ char *devprefix;
193+ char *runprefix;
194+ char *builddir;
195+ char *libstr;
196+ char *build_dlstr = 0;
197+ char *cc;
198+ char *ep;
199+ char *rpath_link[2];
200+ char *rpath[2];
201+ char *uClibc_inc[2];
202+ char *our_lib_path[2];
203+ char *crt0_path[2];
204+ char *crtbegin_path[2];
205+ char *crtend_path[2];
206+ const char *application_name;
207+#ifdef __UCLIBC_CTOR_DTOR__
208+ char *crti_path[2];
209+ char *crtn_path[2];
210+ int len;
211+ int ctor_dtor = 1, cplusplus = 0, use_nostdinc_plus = 0;
212+ int findlibgcc = 1;
213+ char *cpp = NULL;
214+#endif
215+#ifdef __UCLIBC_PROFILING__
0a954816
AM
216+ int profile = 0;
217+ char *gcrt1_path[2];
06dd9bf8
AM
218+#endif
219+
220+ cc = getenv("UCLIBC_CC");
221+ if (cc==NULL) {
222+ cc = GCC_BIN;
223+#ifdef __UCLIBC_CTOR_DTOR__
224+ findlibgcc = 0;
225+#endif
ec09a558
AM
226+ }
227+
06dd9bf8
AM
228+ application_name = basename(argv[0]);
229+ if (application_name[0] == '-')
230+ application_name++;
231+
232+#ifdef __UCLIBC_CTOR_DTOR__
233+ /* We must use strstr since g++ might be named like a
234+ * cross compiler (i.e. arm-linux-g++). We must also
235+ * search carefully, in case we are searching something
236+ * like /opt/c++/gcc-3.1/bin/arm-linux-g++ or some similar
237+ * perversion... */
238+ len = strlen(application_name);
239+ if ((strcmp(application_name+len-3, "g++")==0) ||
240+ (strcmp(application_name+len-3, "c++")==0)) {
0a954816
AM
241+ len = strlen(cc);
242+ if (strcmp(cc+len-3, "gcc")==0) {
243+ cpp = strdup(cc);
244+ cpp[len-1]='+';
245+ cpp[len-2]='+';
246+ }
247+ cplusplus = 1;
248+ use_nostdinc_plus = 1;
249+ }
06dd9bf8 250+#endif
0a954816
AM
251+
252+ devprefix = getenv("UCLIBC_DEVEL_PREFIX");
253+ if (!devprefix) {
06dd9bf8
AM
254+ devprefix = UCLIBC_DEVEL_PREFIX;
255+ }
256+
257+ runprefix = getenv("UCLIBC_RUNTIME_PREFIX");
258+ if (!runprefix) {
259+ runprefix = UCLIBC_RUNTIME_PREFIX;
260+ }
261+
262+ builddir = getenv("UCLIBC_BUILD_DIR");
263+ if (!builddir) {
264+ builddir = UCLIBC_BUILD_DIR;
0a954816
AM
265+ }
266+
267+ incstr = getenv("UCLIBC_GCC_INC");
268+ libstr = getenv("UCLIBC_GCC_LIB");
269+
270+ ep = getenv("UCLIBC_ENV");
271+ if (!ep) {
272+ ep = "";
273+ }
274+
275+ if (strstr(ep,"build") != 0) {
276+ use_build_dir = 1;
277+ }
278+
279+ if (strstr(ep,"rpath") != 0) {
280+ use_rpath = 1;
281+ }
282+
283+
06dd9bf8
AM
284+ xstrcat(&(rpath_link[0]), "-Wl,-rpath-link,", devprefix, "/lib:", runprefix, "/lib", NULL);
285+ xstrcat(&(rpath_link[1]), "-Wl,-rpath-link,", builddir, "/lib", NULL);
286+
287+ xstrcat(&(rpath[0]), "-Wl,-rpath,", devprefix, "/lib:", runprefix, "/lib", NULL);
288+ xstrcat(&(rpath[1]), "-Wl,-rpath,", builddir, "/lib", NULL);
289+
290+ xstrcat(&(uClibc_inc[0]), devprefix, "/include/", NULL);
291+ xstrcat(&(uClibc_inc[1]), builddir, "/include/", NULL);
292+
293+#ifdef __UCLIBC_CTOR_DTOR__
294+ xstrcat(&(crt0_path[0]), devprefix, "/lib/crt1.o", NULL);
295+ xstrcat(&(crt0_path[1]), builddir, "/lib/crt1.o", NULL);
296+ xstrcat(&(crti_path[0]), devprefix, "/lib/crti.o", NULL);
297+ xstrcat(&(crti_path[1]), builddir, "/lib/crti.o", NULL);
298+ xstrcat(&(crtn_path[0]), devprefix, "/lib/crtn.o", NULL);
299+ xstrcat(&(crtn_path[1]), builddir, "/lib/crtn.o", NULL);
300+#else
301+ xstrcat(&(crt0_path[0]), devprefix, "/lib/crt0.o", NULL);
302+ xstrcat(&(crt0_path[1]), builddir, "/lib/crt0.o", NULL);
303+#endif
304+#ifdef __UCLIBC_PROFILING__
305+ xstrcat(&(gcrt1_path[0]), devprefix, "/lib/gcrt1.o", NULL);
306+ xstrcat(&(gcrt1_path[1]), builddir, "/lib/gcrt1.o", NULL);
307+#endif
308+
309+ xstrcat(&(our_lib_path[0]), "-L", devprefix, "/lib", NULL);
310+ xstrcat(&(our_lib_path[1]), "-L", builddir, "/lib", NULL);
311+
312+#ifdef __UCLIBC_HAS_SHARED__
313+ build_dlstr = "-Wl,--dynamic-linker," BUILD_DYNAMIC_LINKER;
314+ dlstr = getenv("UCLIBC_GCC_DLOPT");
315+ if (!dlstr) {
316+ dlstr = "-Wl,--dynamic-linker," DYNAMIC_LINKER;
317+ }
318+#endif
ec09a558 319+
06dd9bf8 320+ m = 0;
0a954816 321+ libraries = __builtin_alloca(sizeof(char*) * (argc));
06dd9bf8 322+ libraries[m] = '\0';
0a954816
AM
323+
324+ n = 0;
325+ libpath = __builtin_alloca(sizeof(char*) * (argc));
326+ libpath[n] = '\0';
327+
328+ for ( i = 1 ; i < argc ; i++ ) {
06dd9bf8 329+ if (argv[i][0] == '-') { /* option */
0a954816
AM
330+ switch (argv[i][1]) {
331+ case 'c': /* compile or assemble */
332+ case 'S': /* generate assembler code */
333+ case 'E': /* preprocess only */
334+ case 'M': /* generate dependencies */
335+ linking = 0;
336+ break;
06dd9bf8 337+ case 'L': /* library */
0a954816
AM
338+ libpath[n++] = argv[i];
339+ libpath[n] = '\0';
340+ if (argv[i][2] == 0) {
341+ argv[i] = '\0';
342+ libpath[n++] = argv[++i];
343+ libpath[n] = '\0';
344+ }
345+ argv[i] = '\0';
346+ break;
347+ case 'l': /* library */
06dd9bf8
AM
348+ libraries[m++] = argv[i];
349+ libraries[m] = '\0';
0a954816
AM
350+ argv[i] = '\0';
351+ break;
352+ case 'v': /* verbose */
353+ if (argv[i][2] == 0) verbose = 1;
354+ printf("Invoked as %s\n", argv[0]);
355+ break;
356+ case 'n':
357+ if (strcmp(nostdinc,argv[i]) == 0) {
358+ use_stdinc = 0;
359+ } else if (strcmp(nostartfiles,argv[i]) == 0) {
06dd9bf8 360+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 361+ ctor_dtor = 0;
06dd9bf8 362+#endif
0a954816
AM
363+ use_start = 0;
364+ } else if (strcmp(nodefaultlibs,argv[i]) == 0) {
365+ use_stdlib = 0;
366+ argv[i] = '\0';
367+ } else if (strcmp(nostdlib,argv[i]) == 0) {
06dd9bf8 368+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 369+ ctor_dtor = 0;
06dd9bf8 370+#endif
0a954816
AM
371+ use_start = 0;
372+ use_stdlib = 0;
06dd9bf8
AM
373+ }
374+#ifdef __UCLIBC_CTOR_DTOR__
375+ else if (strcmp(nostdinc_plus,argv[i]) == 0) {
0a954816
AM
376+ if (cplusplus==1) {
377+ use_nostdinc_plus = 0;
378+ }
379+ }
06dd9bf8 380+#endif
0a954816
AM
381+ break;
382+ case 's':
383+ if (strstr(argv[i],static_linking) != NULL) {
384+ use_static_linking = 1;
385+ }
386+ if (strcmp("-shared",argv[i]) == 0) {
387+ use_start = 0;
388+ use_pic = 1;
389+ }
390+ break;
391+ case 'W': /* -static could be passed directly to ld */
392+ if (strncmp("-Wl,",argv[i],4) == 0) {
393+ if (strstr(argv[i],static_linking) != 0) {
394+ use_static_linking = 1;
395+ }
396+ if (strstr(argv[i],"--dynamic-linker") != 0) {
397+ dlstr = 0;
398+ }
399+ }
400+ break;
06dd9bf8
AM
401+#ifdef __UCLIBC_PROFILING__
402+ case 'p':
403+ if (strcmp("-pg",argv[i]) == 0) {
404+ profile = 1;
405+ }
0a954816 406+ break;
06dd9bf8 407+#endif
0a954816
AM
408+ case 'f':
409+ /* Check if we are doing PIC */
410+ if (strcmp("-fPIC",argv[i]) == 0) {
411+ use_pic = 1;
412+ } else if (strcmp("-fpic",argv[i]) == 0) {
413+ use_pic = 1;
06dd9bf8
AM
414+ }
415+#ifdef __UCLIBC_PROFILING__
416+ else if (strcmp("-fprofile-arcs",argv[i]) == 0) {
0a954816
AM
417+ profile = 1;
418+ }
06dd9bf8 419+#endif
0a954816
AM
420+ break;
421+
422+ case '-':
06dd9bf8 423+ if (strstr(argv[i]+1,static_linking) != NULL) {
0a954816
AM
424+ use_static_linking = 1;
425+ argv[i]='\0';
426+ } else if (strcmp("--uclibc-use-build-dir",argv[i]) == 0) {
427+ use_build_dir = 1;
428+ argv[i]='\0';
429+ } else if (strcmp("--uclibc-use-rpath",argv[i]) == 0) {
430+ use_rpath = 1;
431+ argv[i]='\0';
432+ } else if (strcmp ("--uclibc-cc", argv[i]) == 0 && argv[i + 1]) {
433+ cc = argv[i + 1];
434+ argv[i] = 0;
435+ argv[i + 1] = 0;
436+ } else if (strncmp ("--uclibc-cc=", argv[i], 12) == 0) {
437+ cc = argv[i] + 12;
438+ argv[i] = 0;
06dd9bf8
AM
439+ }
440+#ifdef __UCLIBC_CTOR_DTOR__
441+ else if (strcmp("--uclibc-no-ctors",argv[i]) == 0) {
0a954816
AM
442+ ctor_dtor = 0;
443+ argv[i]='\0';
444+ }
06dd9bf8 445+#endif
0a954816
AM
446+ break;
447+ }
448+ } else { /* assume it is an existing source file */
449+ ++source_count;
450+ }
451+ }
452+
06dd9bf8
AM
453+ gcc_argv = __builtin_alloca(sizeof(char*) * (argc + 64));
454+ gcc_argument = __builtin_alloca(sizeof(char*) * (argc + 20));
0a954816 455+
06dd9bf8
AM
456+ i = 0; k = 0;
457+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 458+ if (ctor_dtor) {
06dd9bf8
AM
459+ struct stat statbuf;
460+ if (findlibgcc==1 || stat(LIBGCC_DIR, &statbuf)!=0 ||
461+ !S_ISDIR(statbuf.st_mode))
462+ {
463+ /* Bummer, gcc is hiding from us. This is going
464+ * to really slow things down... bummer. */
465+ int status, gcc_pipe[2];
466+ pid_t pid, wpid;
467+
468+ pipe(gcc_pipe);
469+ if (!(pid = fork())) {
470+ char *argv[4];
471+ close(gcc_pipe[0]);
472+ close(1);
473+ close(2);
474+ dup2(gcc_pipe[1], 1);
475+ dup2(gcc_pipe[1], 2);
476+ argv[0] = cc;
477+ argv[1] = "-print-libgcc-file-name";
478+ argv[2] = NULL;
479+ execvp(cc, argv);
480+ close(gcc_pipe[1]);
481+ _exit(EXIT_FAILURE);
482+ }
483+ wpid=0;
484+ while (wpid != pid) {
485+ wpid = wait(&status);
486+ }
487+ close(gcc_pipe[1]);
488+ if (WIFEXITED(status) && WEXITSTATUS(status)) {
489+crash_n_burn:
490+ fprintf(stderr, "Unable to locale crtbegin.o provided by gcc");
491+ exit(EXIT_FAILURE);
492+ }
493+ if (WIFSIGNALED(status)) {
494+ fprintf(stderr, "%s exited because of uncaught signal %d", cc, WTERMSIG(status));
495+ exit(EXIT_FAILURE);
496+ }
497+
498+ {
499+ char buf[1024], *dir;
500+ status = read(gcc_pipe[0], buf, sizeof(buf));
501+ close(gcc_pipe[0]);
502+ if (status < 0) {
503+ goto crash_n_burn;
504+ }
505+ buf[(status == sizeof(buf)) ? status-1 : status] = 0;
506+ dir = dirname(buf);
507+ xstrcat(&(crtbegin_path[0]), dir, "/crtbegin.o", NULL);
508+ xstrcat(&(crtbegin_path[1]), dir, "/crtbeginS.o", NULL);
509+ xstrcat(&(crtend_path[0]), dir, "/crtend.o", NULL);
510+ xstrcat(&(crtend_path[1]), dir, "/crtendS.o", NULL);
511+ }
512+
513+ } else {
514+ xstrcat(&(crtbegin_path[0]), LIBGCC_DIR, "crtbegin.o", NULL);
515+ xstrcat(&(crtbegin_path[1]), LIBGCC_DIR, "crtbeginS.o", NULL);
516+ xstrcat(&(crtend_path[0]), LIBGCC_DIR, "crtend.o", NULL);
517+ xstrcat(&(crtend_path[1]), LIBGCC_DIR, "crtendS.o", NULL);
518+ }
0a954816
AM
519+ }
520+
06dd9bf8
AM
521+ if (cplusplus && cpp)
522+ gcc_argv[i++] = cpp;
523+ else
524+#endif
525+ gcc_argv[i++] = cc;
0a954816 526+
06dd9bf8
AM
527+ for ( j = 1 ; j < argc ; j++ ) {
528+ if (argv[j]=='\0') {
529+ continue;
530+ } else {
531+ gcc_argument[k++] = argv[j];
532+ gcc_argument[k] = '\0';
533+ }
534+ }
0a954816
AM
535+
536+ if (linking && source_count) {
06dd9bf8
AM
537+ gcc_argv[i++] = "-Wl,--hash-style=sysv";
538+#if defined __HAVE_ELF__ && ! defined __UCLIBC_HAS_MMU__
539+ gcc_argv[i++] = "-Wl,-elf2flt";
540+#endif
541+ gcc_argv[i++] = nostdlib;
0a954816 542+ if (use_static_linking) {
06dd9bf8
AM
543+ gcc_argv[i++] = static_linking;
544+ }
545+ if (!use_static_linking) {
0a954816 546+ if (dlstr && use_build_dir) {
06dd9bf8 547+ gcc_argv[i++] = build_dlstr;
0a954816 548+ } else if (dlstr) {
06dd9bf8 549+ gcc_argv[i++] = dlstr;
0a954816
AM
550+ }
551+ if (use_rpath) {
06dd9bf8 552+ gcc_argv[i++] = rpath[use_build_dir];
0a954816
AM
553+ }
554+ }
06dd9bf8
AM
555+ for ( l = 0 ; l < n ; l++ ) {
556+ if (libpath[l]) gcc_argv[i++] = libpath[l];
557+ }
558+ gcc_argv[i++] = rpath_link[use_build_dir]; /* just to be safe */
0a954816 559+ if( libstr )
06dd9bf8
AM
560+ gcc_argv[i++] = libstr;
561+ gcc_argv[i++] = our_lib_path[use_build_dir];
562+ if (!use_build_dir) {
563+ gcc_argv[i++] = our_usr_lib_path;
564+ }
0a954816
AM
565+ }
566+ if (use_stdinc && source_count) {
06dd9bf8
AM
567+ gcc_argv[i++] = nostdinc;
568+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 569+ if (cplusplus) {
06dd9bf8 570+ char *cppinc;
0a954816 571+ if (use_nostdinc_plus) {
06dd9bf8 572+ gcc_argv[i++] = nostdinc_plus;
0a954816 573+ }
06dd9bf8
AM
574+ xstrcat(&cppinc, uClibc_inc[use_build_dir], "g++/", NULL);
575+ gcc_argv[i++] = "-isystem";
576+ gcc_argv[i++] = cppinc;
577+ xstrcat(&cppinc, uClibc_inc[use_build_dir], "g++-v3/", NULL);
578+ gcc_argv[i++] = "-isystem";
579+ gcc_argv[i++] = cppinc;
0a954816 580+ }
06dd9bf8
AM
581+#endif
582+ gcc_argv[i++] = "-isystem";
583+ gcc_argv[i++] = uClibc_inc[use_build_dir];
584+ gcc_argv[i++] = "-iwithprefix";
585+ gcc_argv[i++] = "include";
586+ if( incstr )
587+ gcc_argv[i++] = incstr;
0a954816
AM
588+ }
589+
590+ if (linking && source_count) {
591+
06dd9bf8 592+#ifdef __UCLIBC_PROFILING__
0a954816 593+ if (profile) {
06dd9bf8 594+ gcc_argv[i++] = gcrt1_path[use_build_dir];
0a954816 595+ }
06dd9bf8
AM
596+#endif
597+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 598+ if (ctor_dtor) {
06dd9bf8 599+ gcc_argv[i++] = crti_path[use_build_dir];
0a954816 600+ if (use_pic) {
06dd9bf8 601+ gcc_argv[i++] = crtbegin_path[1];
0a954816 602+ } else {
06dd9bf8 603+ gcc_argv[i++] = crtbegin_path[0];
0a954816
AM
604+ }
605+ }
06dd9bf8 606+#endif
0a954816 607+ if (use_start) {
06dd9bf8
AM
608+#ifdef __UCLIBC_PROFILING__
609+ if (!profile)
610+#endif
611+ {
612+ gcc_argv[i++] = crt0_path[use_build_dir];
0a954816
AM
613+ }
614+ }
06dd9bf8
AM
615+ for ( l = 0 ; l < k ; l++ ) {
616+ if (gcc_argument[l]) gcc_argv[i++] = gcc_argument[l];
617+ }
0a954816 618+ if (use_stdlib) {
06dd9bf8
AM
619+ //gcc_argv[i++] = "-Wl,--start-group";
620+ gcc_argv[i++] = "-lgcc";
621+ }
622+ for ( l = 0 ; l < m ; l++ ) {
623+ if (libraries[l]) gcc_argv[i++] = libraries[l];
0a954816
AM
624+ }
625+ if (use_stdlib) {
06dd9bf8 626+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 627+ if (cplusplus) {
06dd9bf8
AM
628+ gcc_argv[ i++ ] = "-lstdc++";
629+ gcc_argv[ i++ ] = "-lm";
0a954816 630+ }
06dd9bf8
AM
631+#endif
632+ gcc_argv[i++] = "-lc";
633+ gcc_argv[i++] = "-lgcc";
634+ //gcc_argv[i++] = "-Wl,--end-group";
0a954816 635+ }
06dd9bf8 636+#ifdef __UCLIBC_CTOR_DTOR__
0a954816 637+ if (ctor_dtor) {
06dd9bf8
AM
638+ if (use_pic) {
639+ gcc_argv[i++] = crtend_path[1];
640+ } else {
641+ gcc_argv[i++] = crtend_path[0];
642+ }
ec09a558 643+
06dd9bf8
AM
644+ gcc_argv[i++] = crtn_path[use_build_dir];
645+ }
646+#endif
647+ } else {
648+ for ( l = 0 ; l < k ; l++ ) {
649+ if (gcc_argument[l]) gcc_argv[i++] = gcc_argument[l];
650+ }
651+ }
652+ gcc_argv[i++] = NULL;
0a954816
AM
653+
654+ if (verbose) {
06dd9bf8
AM
655+ for ( j = 0 ; gcc_argv[j] ; j++ ) {
656+ printf("arg[%2i] = %s\n", j, gcc_argv[j]);
0a954816
AM
657+ }
658+ fflush(stdout);
659+ }
06dd9bf8
AM
660+ //no need to free memory from xstrcat because we never return...
661+#ifdef __UCLIBC_CTOR_DTOR__
662+ if (cplusplus && cpp) {
663+ execvp(cpp, gcc_argv);
664+ fprintf(stderr, "%s: %s\n", cpp, strerror(errno));
665+ } else
666+#endif
667+ {
668+ execvp(cc, gcc_argv);
669+ fprintf(stderr, "%s: %s\n", cc, strerror(errno));
0a954816
AM
670+ }
671+ exit(EXIT_FAILURE);
672+}
ec09a558
AM
673diff -urN uClibc-0.9.29.org/extra/gcc-uClibc/Makefile uClibc-0.9.29/extra/gcc-uClibc/Makefile
674--- uClibc-0.9.29.org/extra/gcc-uClibc/Makefile 1970-01-01 01:00:00.000000000 +0100
06dd9bf8 675+++ uClibc-0.9.29/extra/gcc-uClibc/Makefile 2007-06-03 22:10:14.593807939 +0200
9119c9cd 676@@ -0,0 +1,93 @@
0a954816
AM
677+# Makefile for building a fake gcc/binutils toolchain
678+# that simply spoofs the location of the C library
679+#
680+# Copyright (C) 2000-2002 Erik Andersen <andersen@uclibc.org>
681+#
682+
683+TOPDIR = ../../
684+include $(TOPDIR)Rules.mak
a6527d51 685+include $(TOPDIR)/.config
0a954816
AM
686+
687+UCLIBC_DIR = $(shell (cd ../.. ; /bin/pwd))
688+GCC_BIN = $(shell which $(CC))
689+LD_BIN = $(shell which $(LD))
690+GCCINCDIR:= ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
691+
692+all: gcc-uClibc ld-uClibc
693+
694+gcc-uClibc.h: Makefile $(TOPDIR)/.config
695+ @echo "/* this file was autogenerated by make */" > gcc-uClibc.h
696+ @echo "#define UCLIBC_TARGET_PREFIX " \"$(TARGET_PREFIX)\" >> gcc-uClibc.h
697+ @echo "#define UCLIBC_DEVEL_PREFIX " \"$(DEVEL_PREFIX)\" >> gcc-uClibc.h
9119c9cd 698+ @echo "#define UCLIBC_RUNTIME_PREFIX " \"$(RUNTIME_PREFIX)\" >> gcc-uClibc.h
0a954816
AM
699+ @echo "#define UCLIBC_BUILD_DIR " \"$(UCLIBC_DIR)\" >> gcc-uClibc.h
700+ @echo "#define GCC_BIN " \"$(GCC_BIN)\" >> gcc-uClibc.h
701+ @echo "#define LIBGCC_DIR " \"$(LIBGCC_DIR)\" >> gcc-uClibc.h
702+ @echo "#define TARGET_ARCH " \"$(TARGET_ARCH)\" >> gcc-uClibc.h
a6527d51 703+ @echo "#define DYNAMIC_LINKER " \"$(RUNTIME_PREFIX)/lib/$(UCLIBC_LDSO)\" >> gcc-uClibc.h
0a954816
AM
704+ @echo "#define BUILD_DYNAMIC_LINKER " \"$(UCLIBC_DIR)/lib/$(UCLIBC_LDSO)\" >> gcc-uClibc.h
705+ifeq ($(strip $(HAVE_SHARED)),y)
706+ @echo "#define __UCLIBC_HAS_SHARED__ 1" >> gcc-uClibc.h
707+else
708+ @echo "#undef __UCLIBC_HAS_SHARED__" >> gcc-uClibc.h
709+endif
710+ifeq ($(strip $(UCLIBC_HAS_MMU)),y)
711+ @echo "#define __UCLIBC_HAS_MMU__ 1" >> gcc-uClibc.h
712+else
713+ @echo "#undef __UCLIBC_HAS_MMU__" >> gcc-uClibc.h
714+endif
715+ifeq ($(strip $(HAS_ELF)),y)
716+ @echo "#define __HAS_ELF__ 1" >> gcc-uClibc.h
717+else
718+ @echo "#undef __HAS_ELF__" >> gcc-uClibc.h
719+endif
720+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
721+ @echo "#define __UCLIBC_CTOR_DTOR__ 1" >> gcc-uClibc.h
722+ifeq ($(strip $(UCLIBC_PROFILING)),y)
723+ @echo "#define __UCLIBC_PROFILING__ 1" >> gcc-uClibc.h
724+else
725+ @echo "#undef __UCLIBC_PROFILING__" >> gcc-uClibc.h
726+endif
727+else
728+ @echo "#undef __UCLIBC_CTOR_DTOR__" >> gcc-uClibc.h
729+endif
730+
731+gcc-uClibc: gcc-uClibc.h gcc-uClibc.c
732+ $(HOSTCC) $(HOSTCFLAGS) -s gcc-uClibc.c -o $(TARGET_ARCH)-uclibc-gcc
90de3b5b 733+ touch gcc-uClibc
0a954816
AM
734+
735+ld-uClibc:
736+ @echo "#!/bin/sh" > $(TARGET_ARCH)-uclibc-ld
737+ @echo "# This file was autogenerated by make" >> $(TARGET_ARCH)-uclibc-ld
a6527d51 738+ @echo "exec $(LD_BIN) \$$@ -L$(DEVEL_PREFIX)/lib" >> $(TARGET_ARCH)-uclibc-ld
0a954816 739+ chmod a+x $(TARGET_ARCH)-uclibc-ld
90de3b5b 740+ touch ld-uClibc
0a954816
AM
741+
742+install: all
743+ install -d $(PREFIX)$(DEVEL_PREFIX)/bin;
744+ install -d $(PREFIX)$(RUNTIME_PREFIX)/bin;
745+ install -m 755 $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(RUNTIME_PREFIX)/bin/
746+ install -m 755 $(TARGET_ARCH)-uclibc-ld $(PREFIX)$(RUNTIME_PREFIX)/bin/
747+ ln -fs $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-cc
748+ ln -fs $(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/gcc
749+ ln -fs $(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/cc
750+ ln -fs $(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-ld $(PREFIX)$(DEVEL_PREFIX)/bin/ld
751+ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
752+ ln -fs $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-g++
753+ ln -fs $(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-c++
754+ ln -fs $(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/c++
755+ ln -fs $(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-gcc $(PREFIX)$(DEVEL_PREFIX)/bin/g++
756+endif
757+ for app in addr2line ar as cpp gasp nm objcopy \
758+ objdump ranlib size strings strip; do \
759+ APPNAME=`which $(CROSS)$${app}`; \
760+ if [ -x "$$APPNAME" ] ; then \
761+ ln -fs "$$APPNAME" $(PREFIX)$(DEVEL_PREFIX)/bin/$${app}; \
762+ ln -fs "$$APPNAME" $(PREFIX)$(RUNTIME_PREFIX)/bin/$(TARGET_ARCH)-uclibc-$${app}; \
763+ fi; \
764+ done
765+
766+clean:
767+ rm -f gcc-uClibc.h *-uclibc-gcc *-uclibc-ld core
768+
769+
ec09a558
AM
770diff -urN uClibc-0.9.29.org/Makefile.in uClibc-0.9.29/Makefile.in
771--- uClibc-0.9.29.org/Makefile.in 2007-03-19 10:49:04.000000000 +0100
06dd9bf8 772+++ uClibc-0.9.29/Makefile.in 2007-06-03 22:10:14.593807939 +0200
ec09a558 773@@ -17,7 +17,7 @@
0a954816 774
a6527d51 775 ifeq ($(HAVE_DOT_CONFIG),y)
0a954816 776
a6527d51
JB
777-all: pregen libs
778+all: pregen libs toolchain
0a954816 779
a6527d51
JB
780 # In this section, we need .config
781 -include .config.cmd
ec09a558 782@@ -108,7 +108,7 @@
0a954816 783
a6527d51 784 pregen: headers
0a954816 785
a6527d51
JB
786-install: install_runtime install_dev
787+install: install_runtime install_dev install_toolchain
0a954816
AM
788
789
a6527d51 790 RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
ec09a558 791@@ -272,6 +272,12 @@
a6527d51
JB
792 fi
793 endif
0a954816 794
a6527d51
JB
795+toolchain:
796+ $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C extra/gcc-uClibc
0a954816 797+
a6527d51
JB
798+install_toolchain: toolchain
799+ $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C extra/gcc-uClibc install
800+
801 utils:
ec09a558 802 $(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
a6527d51 803
06dd9bf8
AM
804diff -urN uClibc-0.9.29.org/Makefile.in.orig uClibc-0.9.29/Makefile.in.orig
805--- uClibc-0.9.29.org/Makefile.in.orig 1970-01-01 01:00:00.000000000 +0100
806+++ uClibc-0.9.29/Makefile.in.orig 2007-03-19 10:49:04.000000000 +0100
807@@ -0,0 +1,363 @@
808+# Makefile for uClibc
809+#
810+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
811+#
812+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
813+#
814+
815+#--------------------------------------------------------------
816+# You shouldn't need to mess with anything beyond this point...
817+#--------------------------------------------------------------
818+noconfig_targets := menuconfig config oldconfig silentoldconfig randconfig \
819+ defconfig allyesconfig allnoconfig clean distclean \
820+ release dist tags
821+
822+include $(top_builddir)Rules.mak
823+sub_headers := headers
824+
825+ifeq ($(HAVE_DOT_CONFIG),y)
826+
827+all: pregen libs
828+
829+# In this section, we need .config
830+-include .config.cmd
831+
832+include $(top_srcdir)ldso/Makefile.in
833+include $(top_srcdir)libcrypt/Makefile.in
834+include $(top_srcdir)libintl/Makefile.in
835+include $(top_srcdir)libm/Makefile.in
836+include $(top_srcdir)libnsl/Makefile.in
837+include $(top_srcdir)libresolv/Makefile.in
838+include $(top_srcdir)libutil/Makefile.in
839+include $(top_srcdir)libpthread/Makefile.in
840+include $(top_srcdir)librt/Makefile.in
841+include $(top_srcdir)extra/locale/Makefile.in
842+
843+# last included to catch all the objects added by others (locales/threads)
844+include $(top_srcdir)libc/Makefile.in
845+
846+include/bits/uClibc_config.h: extra/config/conf .config
847+ $(Q)$(INSTALL) -d $(dir $@)
848+ $(Q)@$< -o $(top_srcdir)extra/Configs/Config.in
849+ $(top_srcdir)extra/scripts/conf-header.sh .config > include/bits/uClibc_config.h
850+
851+
852+# For the moment, we have to keep re-running this target
853+# because the fix includes scripts rely on pre-processers
854+# in order to generate the headers correctly :(. That
855+# means we can't use the $(HOSTCC) in order to get the
856+# correct output.
857+ifeq ($(ARCH_USE_MMU),y)
858+export header_extra_args =
859+else
860+export header_extra_args = -n
861+endif
862+HEADERS_BITS_COMMON := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/common/bits/*.h))
863+HEADERS_BITS_ARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/*.h))
864+HEADERS_BITS_SUBARCH := $(notdir $(wildcard $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/*.h))
865+HEADERS_BITS_COMMON := $(filter-out $(HEADERS_BITS_ARCH) $(HEADERS_BITS_SUBARCH),$(HEADERS_BITS_COMMON))
866+headers: include/bits/uClibc_config.h
867+ $(Q)$(MAKE) headers-y
868+ $(Q)\
869+ set -e; \
870+ if [ -e libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h ] ; then \
871+ $(LN) -fs ../libc/sysdeps/linux/$(TARGET_ARCH)/fpu_control.h include/ ; \
872+ else \
873+ $(LN) -fs ../libc/sysdeps/linux/common/fpu_control.h include/ ; \
874+ fi; \
875+ for f in dl-osinfo.h hp-timing.h ; do \
876+ $(LN) -fs ../libc/sysdeps/linux/common/$$f include/ ; \
877+ done
878+ $(Q)\
879+ cd include/bits; \
880+ set -e; \
881+ for i in $(HEADERS_BITS_COMMON) ; do \
882+ $(LN) -fs ../../libc/sysdeps/linux/common/bits/$$i .; \
883+ done; \
884+ for i in $(HEADERS_BITS_ARCH) ; do \
885+ $(LN) -fs ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$$i .; \
886+ done; \
887+ for i in $(HEADERS_BITS_SUBARCH) ; do \
888+ $(LN) -fs ../../libc/sysdeps/linux/$(TARGET_ARCH)/bits/$(TARGET_SUBARCH)/$$i .; \
889+ done
890+ $(Q)\
891+ cd include/sys; \
892+ set -e; \
893+ for i in `ls ../../libc/sysdeps/linux/common/sys/*.h` ; do \
894+ $(LN) -fs $$i .; \
895+ done; \
896+ if [ -d ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
897+ for i in `ls ../../libc/sysdeps/linux/$(TARGET_ARCH)/sys/*.h` ; do \
898+ $(LN) -fs $$i .; \
899+ done; \
900+ fi
901+ $(Q)\
902+ set -e; \
903+ cd $(top_builddir); \
904+ tmp=`mktemp include/bits/sysnum.h.XXXXXX 2>/dev/null`; \
905+ [ -z "$$tmp" ] && tmp='include/bits/sysnum.h.new'; \
906+ KERNEL_HEADERS="${KERNEL_HEADERS}" top_builddir=. CC="$(CC) $(CPU_CFLAGS)" $(SHELL) extra/scripts/gen_bits_syscall_h.sh > $$tmp; \
907+ if cmp include/bits/sysnum.h $$tmp >/dev/null 2>&1; then \
908+ $(RM) $$tmp; \
909+ else \
910+ mv -f $$tmp include/bits/sysnum.h; \
911+ fi
912+ifeq ($(UCLIBC_HAS_LOCALE),y)
913+ $(MAKE) locale_headers
914+endif
915+
916+pregen: headers
917+
918+install: install_runtime install_dev
919+
920+
921+RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB=$(shell $(top_srcdir)extra/scripts/relative_path.sh $(DEVEL_PREFIX)lib $(RUNTIME_PREFIX)lib)
922+
923+# Installs header files.
924+install_headers:
925+ $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)include
926+ printf ".svn\n.cvsignore\nCVS\n" > tar_exclude ; \
927+ $(TAR) -chf - -X tar_exclude include \
928+ | $(TAR) -xf - -C $(PREFIX)$(DEVEL_PREFIX)
929+ rm -f tar_exclude
930+ printf '#ifndef _LIBC_INTERNAL_H\n#define _LIBC_INTERNAL_H 1\n#endif\n' > \
931+ $(PREFIX)$(DEVEL_PREFIX)include/libc-internal.h
932+ echo '/* Dont use _syscall#() macros; use the syscall() function */' > \
933+ $(PREFIX)$(DEVEL_PREFIX)include/bits/syscalls.h
934+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/dl-osinfo.h
935+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/_lfs_64.h
936+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_uintmaxtostr.h
937+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_sigaction.h
938+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/kernel_stat.h
939+ifneq ($(UCLIBC_HAS_FLOATS),y)
940+ # Remove floating point related headers since float support is disabled.
941+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/complex.h
942+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/fpu_control.h
943+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ieee754.h
944+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/math.h
945+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tgmath.h
946+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/uClibc_fpmax.h
947+endif
948+ifneq ($(UCLIBC_HAS_WCHAR),y)
949+ # Remove wide char headers since wide char support is disabled.
950+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wctype.h
951+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wchar.h
952+endif
953+ifneq ($(UCLIBC_HAS_LOCALE),y)
954+ # Remove iconv header since locale support is disabled.
955+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/iconv.h
956+endif
957+ifneq ($(UCLIBC_HAS_GLIBC_CUSTOM_PRINTF),y)
958+ # Remove printf header since custom print specifier support is disabled.
959+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/printf.h
960+endif
961+ifneq ($(UCLIBC_HAS_XLOCALE),y)
962+ # Remove xlocale header since extended locale support is disabled.
963+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/xlocale.h
964+endif
965+ifneq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
966+ # Remove libintl header since gettext support is disabled.
967+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/libintl.h
968+endif
969+ifneq ($(UCLIBC_HAS_REGEX),y)
970+ # Remove regex headers since regex support is disabled.
971+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regex.h
972+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/regexp.h
973+endif
974+ifneq ($(UCLIBC_HAS_WORDEXP),y)
975+ # Remove wordexp header since wordexp support is disabled.
976+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/wordexp.h
977+endif
978+ifneq ($(UCLIBC_HAS_FTW),y)
979+ # Remove ftw header since ftw support is disabled.
980+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/ftw.h
981+endif
982+ifneq ($(UCLIBC_HAS_GLOB),y)
983+ # Remove glob header since glob support is disabled.
984+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/glob.h
985+endif
986+ifneq ($(UCLIBC_HAS_GNU_GETOPT),y)
987+ifneq ($(UCLIBC_HAS_GETOPT_LONG),y)
988+ # Remove getopt header since gnu getopt support is disabled.
989+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/getopt.h
990+endif
991+endif
992+ifneq ($(UCLIBC_HAS_SHADOW),y)
993+ # Remove shadow header since shadow password support is disabled.
994+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/shadow.h
995+endif
996+ifneq ($(PTHREADS_DEBUG_SUPPORT),y)
997+ # Remove thread_db header since thread debug support is disabled.
998+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/thread_db.h
999+endif
1000+ifneq ($(UCLIBC_HAS_THREADS),y)
1001+ # Remove pthread headers since thread support is disabled.
1002+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/*thread*.h
1003+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/semaphore.h
1004+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/bits/*thread*.h
1005+endif
1006+ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
1007+ # Remove this as it is only used internally.
1008+ $(RM) $(PREFIX)$(DEVEL_PREFIX)include/tls.h
1009+endif
1010+ -@for i in `find $(PREFIX)$(DEVEL_PREFIX)include -type d` ; do \
1011+ chmod 755 $$i; chmod 644 $$i/*.h > /dev/null 2>&1; \
1012+ done
1013+ -chown -R `id | sed 's/^uid=\([0-9]*\).*gid=\([0-9]*\).*$$/\1:\2/'` $(PREFIX)$(DEVEL_PREFIX)include
1014+
1015+# Installs development library links.
1016+install_dev: install_headers
1017+ $(INSTALL) -d $(PREFIX)$(DEVEL_PREFIX)lib
1018+ -$(INSTALL) -m 644 lib/*.[ao] $(PREFIX)$(DEVEL_PREFIX)lib/
1019+ifeq ($(HAVE_SHARED),y)
1020+ for i in `find lib/ -type l -name 'lib[a-zA-Z]*.so' | \
1021+ sed -e 's/lib\///'` ; do \
1022+ $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)$$i.$(MAJOR_VERSION) \
1023+ $(PREFIX)$(DEVEL_PREFIX)lib/$$i; \
1024+ done
1025+ if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME) ] ; then \
1026+ $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
1027+ sed -e 's:$(NONSHARED_LIBNAME):$(DEVEL_PREFIX)lib/$(NONSHARED_LIBNAME):' \
1028+ -e 's:$(SHARED_MAJORNAME):$(RUNTIME_PREFIX)lib/$(SHARED_MAJORNAME):' \
1029+ -e 's:$(UCLIBC_LDSO):$(RUNTIME_PREFIX)lib/$(UCLIBC_LDSO):' \
1030+ $(top_builddir)lib/libc.so > $(PREFIX)$(DEVEL_PREFIX)lib/libc.so; \
1031+ fi
1032+ifeq ($(UCLIBC_HAS_THREADS),y)
1033+ifneq ($(LINUXTHREADS_OLD),y)
1034+ if [ -f $(top_builddir)lib/libpthread.so -a -f $(PREFIX)$(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) ] ; then \
1035+ $(RM) $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
1036+ cp $(top_srcdir)extra/scripts/format.lds $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
1037+ echo "GROUP ( $(RUNTIME_PREFIX)lib/libpthread.so.$(MAJOR_VERSION) $(DEVEL_PREFIX)lib/libpthread_nonshared.a )" \
1038+ >> $(PREFIX)$(DEVEL_PREFIX)lib/libpthread.so; \
1039+ fi
1040+endif
1041+endif
1042+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
1043+ $(LN) -sf $(RUNTIME_PREFIX_LIB_FROM_DEVEL_PREFIX_LIB)libthread_db.so.1 \
1044+ $(PREFIX)$(DEVEL_PREFIX)lib/libthread_db.so
1045+endif
1046+ifeq ($(DOPIC),y)
1047+# # If we build shared libraries then the static libs are PIC...
1048+# # Make _pic.a symlinks to make mklibs.py and similar tools happy.
1049+ if [ -d lib ] ; then \
1050+ for i in `find lib/ -type f -name 'lib*.a' | sed -e 's/lib\///'` ; do \
1051+ $(LN) -sf $$i $(PREFIX)$(DEVEL_PREFIX)lib/`echo $$i \
1052+ | sed -e 's/\.a$$/_pic.a/'`; \
1053+ done ; \
1054+ fi
1055+endif
1056+endif
1057+ifeq ($(UCLIBC_FORMAT_SHARED_FLAT),y)
1058+ for file in lib/lib*.gdb; do \
1059+ if test -f $$file; then \
1060+ $(INSTALL) -m 755 $$file $(PREFIX)$(DEVEL_PREFIX)lib; \
1061+ $(INSTALL) -m 755 `echo $$file | sed 's/\.gdb$$//'` \
1062+ $(PREFIX)$(DEVEL_PREFIX)lib; \
1063+ fi; \
1064+ done
1065+endif
1066+
1067+# Installs run-time libraries
1068+install_runtime:
1069+ifeq ($(HAVE_SHARED),y)
1070+ $(INSTALL) -d $(PREFIX)$(RUNTIME_PREFIX)lib
1071+ $(INSTALL) -m 644 lib/lib*-$(VERSION).so \
1072+ $(PREFIX)$(RUNTIME_PREFIX)lib
1073+ cd lib && $(TAR) -cf - *.so.* | $(TAR) -xf - -C $(PREFIX)$(RUNTIME_PREFIX)lib
1074+ @if [ -x lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so ] ; then \
1075+ set -e; \
1076+ $(SHELL_SET_X); \
1077+ $(INSTALL) -m 755 lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so \
1078+ $(PREFIX)$(RUNTIME_PREFIX)lib; \
1079+ fi
1080+endif
1081+
1082+utils:
1083+ $(Q)$(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils
1084+
1085+# Installs helper applications, such as 'ldd' and 'ldconfig'
1086+install_utils: utils
1087+ $(MAKE) CROSS="$(CROSS)" CC="$(CC)" -C utils utils_install
1088+
1089+else # ifeq ($(HAVE_DOT_CONFIG),y)
1090+
1091+all: menuconfig
1092+
1093+headers:
1094+ @echo "Need to make a config file first, run: make menuconfig"
1095+ @false
1096+
1097+endif # ifeq ($(HAVE_DOT_CONFIG),y)
1098+
1099+include/bits:
1100+ $(INSTALL) -d include/bits
1101+
1102+# configuration
1103+# ---------------------------------------------------------------------------
1104+extra/config/conf extra/config/mconf: include/bits
1105+ $(Q)$(MAKE) -C extra/config $(notdir $@)
1106+
1107+menuconfig: extra/config/mconf include/bits
1108+ $(Q)./extra/config/mconf extra/Configs/Config.in
1109+
1110+config: extra/config/conf include/bits
1111+ $(Q)./extra/config/conf extra/Configs/Config.in
1112+
1113+oldconfig: extra/config/conf include/bits
1114+ $(Q)./extra/config/conf -o extra/Configs/Config.in
1115+
1116+silentoldconfig: extra/config/conf include/bits
1117+ $(Q)./extra/config/conf -s extra/Configs/Config.in
1118+
1119+randconfig: extra/config/conf include/bits
1120+ $(Q)./extra/config/conf -r extra/Configs/Config.in
1121+
1122+allyesconfig: extra/config/conf include/bits
1123+ $(Q)./extra/config/conf -y extra/Configs/Config.in
1124+ sed -i -e "s/^DODEBUG=.*/# DODEBUG is not set/" .config
1125+ sed -i -e "s/^DOASSERTS=.*/# DOASSERTS is not set/" .config
1126+ sed -i -e "s/^SUPPORT_LD_DEBUG_EARLY=.*/# SUPPORT_LD_DEBUG_EARLY is not set/" .config
1127+ sed -i -e "s/^SUPPORT_LD_DEBUG=.*/# SUPPORT_LD_DEBUG is not set/" .config
1128+ sed -i -e "s/^UCLIBC_MJN3_ONLY=.*/# UCLIBC_MJN3_ONLY is not set/" .config
1129+ $(Q)./extra/config/conf -o extra/Configs/Config.in
1130+
1131+allnoconfig: extra/config/conf include/bits
1132+ $(Q)./extra/config/conf -n extra/Configs/Config.in
1133+
1134+defconfig: extra/config/conf include/bits
1135+ $(Q)./extra/config/conf -d extra/Configs/Config.in
1136+
1137+clean:
1138+ $(Q)$(RM) -r lib include/bits
1139+ $(RM) lib*/*.a ldso/*/*.a libpthread/*/*.a
1140+ $(RM) include/fpu_control.h include/dl-osinfo.h include/hp-timing.h
1141+ $(MAKE) -C extra/locale locale_clean
1142+ $(MAKE) headers_clean-y
1143+ $(MAKE) -s -C test clean
1144+ $(MAKE) -C utils utils_clean
1145+ @set -e; \
1146+ for i in `(cd libc/sysdeps/linux/common/sys; ls *.h)` ; do \
1147+ $(RM) include/sys/$$i; \
1148+ done; \
1149+ if [ -d libc/sysdeps/linux/$(TARGET_ARCH)/sys ] ; then \
1150+ for i in `(cd libc/sysdeps/linux/$(TARGET_ARCH)/sys; ls *.h)` ; do \
1151+ $(RM) include/sys/$$i; \
1152+ done; \
1153+ fi
1154+ @$(RM) include/linux include/asm*
1155+ -find . \( -name \*.o -o -name \*.os -o -name \*.oS \) -exec $(RM) {} \;
1156+
1157+distclean: clean
1158+ -find . \( -name core -o -name \*.orig -o -name \*~ \) -exec $(RM) {} \;
1159+ $(RM) .config .config.old .config.cmd
1160+ $(RM) extra/locale/*.tgz
1161+ $(MAKE) -C extra/config distclean
1162+
1163+dist release:
1164+ $(RM) -r ../uClibc-$(VERSION) ../uClibc-$(VERSION).tar.bz2
1165+ svn -q export . ../uClibc-$(VERSION)
1166+ $(TAR) cjf ../uClibc-$(VERSION).tar.bz2 -C .. uClibc-$(VERSION)
1167+ du -b ../uClibc-$(VERSION).tar.bz2
1168+
1169+test check:
1170+ $(Q)$(MAKE) -C test
This page took 0.172021 seconds and 4 git commands to generate.