diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-29 18:36:57 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-29 18:36:57 +0200 |
commit | 657104d7ff9ced7908a2dcf398ccee6b06fac3a6 (patch) | |
tree | ae740649dc87e3658f2a588783df271733a5ec5d | |
parent | bf32d48b0dce56f9fa1a57d1172b037dc284b3cf (diff) | |
download | xutil-657104d7ff9ced7908a2dcf398ccee6b06fac3a6.tar.gz |
Makefile: Fix link handling
Yes, it is a bit complex. But it works.
-rw-r--r-- | Makefile | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -1,3 +1,22 @@ +EXEC != ls -l | perl -ne ' \ + if (/^-\S*x\s/) { \ + s/.* //; \ + print; \ + $$x{$$_} = 1; \ + } elsif (/^l\S*x\s/) { \ + s/ -> (.*)//; \ + $$d = $$1; \ + s/.* //; \ + push @ln, [$$_ => "$$d\n"] \ + } \ + END { \ + for (@ln) { \ + print $$_->[0] if $$x{$$_->[1]}; \ + } \ + } \ +' + install: install -m 644 *.1 /usr/local/man/man1/ - install `ls -l | perl -ne 'next if not /^[-l]\S*x\s/; s/ -> .*//; s/.* //; print'` /usr/local/bin + install $(EXEC) /usr/local/bin + ./re! `echo $(EXEC) | sed -E 's,^| ,&/usr/local/bin/,g'` |