summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile17
-rw-r--r--package/targets.mak2
-rw-r--r--tools/convert-one5
-rwxr-xr-xtools/install-bins9
-rwxr-xr-xtools/link-bins12
-rw-r--r--tools/name-table16
-rwxr-xr-xtools/rename-bins5
7 files changed, 63 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 610dbb6..182b7c7 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,10 @@ ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS)
ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS)
ALL_INCLUDES := $(wildcard src/include/$(package)/*.h)
-all: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES)
+all: .built
+
+.built: $(ALL_LIBS) $(ALL_BINS) $(ALL_INCLUDES)
+ exec ./tools/rename-bins && touch .built
clean:
@exec rm -f $(ALL_LIBS) $(ALL_BINS) $(wildcard src/*/*.o src/*/*.lo) $(EXTRA_TARGETS)
@@ -85,7 +88,12 @@ endif
install: install-dynlib install-libexec install-bin install-lib install-include
install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so)
install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%)
-install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%)
+
+install-bin: .installed
+
+.installed: .built
+ exec ./tools/install-bins $(INSTALL) $(bindir) $(DESTDIR) && touch .installed
+
install-lib: $(STATIC_LIBS:lib%.a.xyzzy=$(DESTDIR)$(libdir)/lib%.a)
install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h)
install-data: $(ALL_DATA:src/etc/%=$(DESTDIR)$(datadir)/%)
@@ -97,7 +105,10 @@ $(DESTDIR)$(exthome): $(DESTDIR)$(home)
update: $(DESTDIR)$(exthome)
-global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M)) $(BIN_TARGETS:%=$(DESTDIR)$(sproot)/command/%)
+global-links: $(DESTDIR)$(exthome) $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(sproot)/library.so/lib%.so.$(version_M)) .linked
+
+.linked: .installed
+ exec ./tools/link-bins $(INSTALL) $(bindir) x$(sproot) x$(home) x$(exthome) $(DESTDIR) && touch .linked
$(DESTDIR)$(sproot)/command/%: $(DESTDIR)$(home)/command/%
exec $(INSTALL) -D -l ..$(subst $(sproot),,$(exthome))/command/$(<F) $@
diff --git a/package/targets.mak b/package/targets.mak
index 73ef16b..04eb36d 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -49,3 +49,5 @@ withstdinas
LIBEXEC_TARGETS :=
LIB_DEFS := EXECLINE=execline
+
+EXTRA_TARGETS := .built .installed '&' '`' '=' '$$@' '*' '>&-' '>&' '<>' ';' '!' '<<' '~' '&&' '$$' '|' '<'
diff --git a/tools/convert-one b/tools/convert-one
new file mode 100644
index 0000000..7b914ea
--- /dev/null
+++ b/tools/convert-one
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+old="$1"
+new="$2"
+html="$3"
diff --git a/tools/install-bins b/tools/install-bins
new file mode 100755
index 0000000..143843a
--- /dev/null
+++ b/tools/install-bins
@@ -0,0 +1,9 @@
+#!/bin/sh -e
+
+install="$1"
+bindir="$2"
+destdir="$3"
+
+while read old new html ; do
+ "$install" -D -m 600 "$new" "$destdir/$bindir/$new"
+done < ./tools/name-table
diff --git a/tools/link-bins b/tools/link-bins
new file mode 100755
index 0000000..5e45ec5
--- /dev/null
+++ b/tools/link-bins
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+install="$1"
+bindir="$2"
+sproot="${3#x}"
+home="${4#x}"
+exthome="${5#x}"
+destdir="$6"
+
+while read old new html ; do
+ "$install" -D -m 600 "$new" "$destdir/$bindir/$new"
+done < ./tools/name-table
diff --git a/tools/name-table b/tools/name-table
new file mode 100644
index 0000000..4494f01
--- /dev/null
+++ b/tools/name-table
@@ -0,0 +1,16 @@
+background & &amp;
+backtick ` `
+define = =
+dollarat $@ $@
+elglob * *
+fdclose >&- &gt;&amp;-
+fdmove >& &gt;&amp;
+fdswap <> &lt;&gt;
+foreground ; &semi;
+getpid ! !
+heredoc << &lt;&lt;
+homeof ~ ~
+if && &amp;&amp;
+importas $ $
+pipeline | |
+redirfd < &lt;
diff --git a/tools/rename-bins b/tools/rename-bins
new file mode 100755
index 0000000..a613278
--- /dev/null
+++ b/tools/rename-bins
@@ -0,0 +1,5 @@
+#!/bin/sh -e
+
+while read old new html ; do
+ mv -f "./$old" "./$new"
+done < ./tools/name-table