summaryrefslogtreecommitdiff
path: root/myrbuild
diff options
context:
space:
mode:
authorOri Bernstein <orib@google.com>2012-10-24 14:21:05 -0400
committerOri Bernstein <orib@google.com>2012-10-24 14:21:05 -0400
commitb635e2c01451f39c4468f2b6a43e57902dee99f1 (patch)
treefef660e93d4e2b4153c1bf11ca5fdf45efc1ec5c /myrbuild
parentbd389067cb68d0d7b4c55db95f1b8021f1d95524 (diff)
downloadmc-b635e2c01451f39c4468f2b6a43e57902dee99f1.tar.gz
Search local libs before system libs.
Diffstat (limited to 'myrbuild')
-rw-r--r--myrbuild/myrbuild.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/myrbuild/myrbuild.c b/myrbuild/myrbuild.c
index 965a1d7..0469f68 100644
--- a/myrbuild/myrbuild.c
+++ b/myrbuild/myrbuild.c
@@ -275,9 +275,13 @@ void linkobj(char **files, size_t nfiles)
args = NULL;
nargs = 0;
+
+ /* ld -o outfile */
lappend(&args, &nargs, strdup(ld));
lappend(&args, &nargs, strdup("-o"));
lappend(&args, &nargs, strdup(binname));
+
+ /* ld -o outfile foo.o bar.o baz.o */
for (i = 0; i < nfiles; i++) {
if (hassuffix(files[i], ".myr"))
swapsuffix(buf, sizeof buf, files[i], ".myr", ".o");
@@ -287,12 +291,16 @@ void linkobj(char **files, size_t nfiles)
die("Unknown file type %s", files[i]);
lappend(&args, &nargs, strdup(buf));
}
- snprintf(buf, sizeof buf, "-L%s%s", Instroot, "/lib/myr");
- lappend(&args, &nargs, strdup(buf));
+
+ /* ld -o outfile foo.o bar.o baz.o -L/path1 -L/path2 */
for (i = 0; i < nincpaths; i++) {
snprintf(buf, sizeof buf, "-L%s", incpaths[i]);
lappend(&args, &nargs, strdup(buf));
}
+ snprintf(buf, sizeof buf, "-L%s%s", Instroot, "/lib/myr");
+ lappend(&args, &nargs, strdup(buf));
+
+ /* ld -o outfile foo.o bar.o baz.o -L/path1 -L/path2 -llib1 -llib2*/
for (i = 0; i < nlibs; i++) {
snprintf(buf, sizeof buf, "-l%s", libs[i]);
lappend(&args, &nargs, strdup(buf));