mirror of
https://github.com/oasislinux/oasis.git
synced 2025-12-25 12:14:00 +01:00
Now, ar/lib rules can list static libraries or other .d files. These (as well as the target library) are written to a file called $lib.d. link/exe rules can list these .d files, causing them to be flattened into an RSP file and appear on the command line as @$rsp. The rule to generate the dependency list files depends on the libraries they contain, so they also act as a stamp file for the dependencies. This gives us dependency management for free.
35 lines
453 B
Awk
35 lines
453 B
Awk
function line() {
|
|
if (match($0, /\.d$/))
|
|
read($0)
|
|
else
|
|
libs[++n] = $0
|
|
}
|
|
|
|
function read(name) {
|
|
for (;;) {
|
|
ret = getline < name
|
|
if (ret < 0) {
|
|
print "failed to read line from " name > "/proc/self/fd/2"
|
|
exit(1)
|
|
}
|
|
if (ret == 0)
|
|
break
|
|
line()
|
|
}
|
|
close(name)
|
|
}
|
|
|
|
{line()}
|
|
|
|
END {
|
|
for (i = n; i > 0; --i) {
|
|
lib = libs[i]
|
|
if (lib in seen)
|
|
continue
|
|
seen[lib] = 1
|
|
uniq[++m] = lib
|
|
}
|
|
for (i = m; i > 0; --i)
|
|
print uniq[i]
|
|
}
|