summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-07-21 07:13:21 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-07-21 07:13:21 -0700
commit35a0332d1dcf2dbd743e5a24cc6f7d2b15fb8b8c (patch)
tree03892007f5955361413aea32fea2ca7bacf66de3
parent14cb5835e5ecb14be8ecc6ac2a6811e4bb143354 (diff)
downloadtxr-35a0332d1dcf2dbd743e5a24cc6f7d2b15fb8b8c.tar.gz
txr-35a0332d1dcf2dbd743e5a24cc6f7d2b15fb8b8c.tar.bz2
txr-35a0332d1dcf2dbd743e5a24cc6f7d2b15fb8b8c.zip
Install a txrlisp hard link.
* Makefile (LN): New variable. On platforms where you can't hard link, this can be replaced with some other command. Possibly "true" not to have the alternative executable name created at all. (HARDLINK): New macro. (install): Use HARDLINK to create a link named txrlisp pointing to the same file as txr in the destination directory. * txr.c (txr_main): If the executable ends with "lisp" (or "lisp.exe" on Windows), then default the txr_lisp_p variable to t, which has the effect as if --lisp had been processed. * txr.1: Documented.
-rw-r--r--Makefile13
-rw-r--r--txr.127
-rw-r--r--txr.c5
3 files changed, 45 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 4ca6058f..6aa30b3a 100644
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,8 @@ $(call SH,$(TXR) --in-package=sys --compile=$<:$@.tmp)
$(call SH,mv $@.tmp $@)
endef
+LN := ln
+
ifneq ($(top_srcdir),)
dbg/%.o: $(top_srcdir)%.c
$(call COMPILE_C_WITH_DEPS,$(DBG_ONLY_FLAGS))
@@ -514,12 +516,23 @@ define INSTALL
done)
endef
+define HARDLINK
+ $(call ABBREV3,HARDLINK,$(1),$(2))
+ $(call SH,$(LN) -f $(1) $(2))
+endef
+
PREINSTALL := :
.PHONY: install
install: $(PROG)
$(V)$(PREINSTALL)
$(call INSTALL,0755,txr$(EXE),$(DESTDIR)$(bindir))
+ $(call HARDLINK,\
+ $(DESTDIR)$(bindir)/txr$(EXE),\
+ $(DESTDIR)$(bindir)/txrlisp$(EXE))
+ $(call HARDLINK,\
+ $(DESTDIR)$(bindir)/txr$(EXE),\
+ $(DESTDIR)$(bindir)/txrvm$(EXE))
$(call INSTALL,0444,$(top_srcdir)LICENSE,$(DESTDIR)$(datadir))
$(call INSTALL,0444,$(top_srcdir)METALICENSE,$(DESTDIR)$(datadir))
$(call INSTALL,0444,$(top_srcdir)txr.1,$(DESTDIR)$(mandir)/man1)
diff --git a/txr.1 b/txr.1
index 09312ed2..b90aade3 100644
--- a/txr.1
+++ b/txr.1
@@ -501,6 +501,17 @@ description of this mode. When \*(TX enters interactive mode this
way, it prints a one-line banner announcing the program name and version,
and one line of help text instructing the user how to exit.
+If \*(TX is invoked under the name
+.codn txrlisp ,
+it behaves as if the
+.code --lisp
+option had been specified before any other option.
+Similarly, if \*(TX is invoked under the name
+.codn txrvm ,
+it behaves as if the
+.code --compiled
+option had been given.
+
Unless the
.code -c
or
@@ -88685,6 +88696,22 @@ directory is a direct subdirectory of the executable directory.
If one of these structures is not observed, the application
may fail due to the failure of a library file to load.
+If the executable discovers that its name ends in the suffix
+.str lisp
+(or else
+.str lisp.exe
+on the MS Windows platform) then the behavior is as if the
+.code --lisp
+command line option had been given.
+Similarly, if the executable finds that its name ends in
+.str vm
+(or
+.str vm.exe
+on MS Windows)
+it behaves as if the
+.code --compiled
+option had been given.
+
.coSS Function @ save-exe
.synb
.mets (save-exe < path << arg-string )
diff --git a/txr.c b/txr.c
index 78f7b042..36750a8e 100644
--- a/txr.c
+++ b/txr.c
@@ -587,6 +587,11 @@ int txr_main(int argc, char **argv)
static char alt_args_buf[128 + 7] = "@(txr):", *alt_args = alt_args_buf + 7;
+ if (ends_with(lit("lisp" EXE_SUFF), prog_path, nil, nil))
+ txr_lisp_p = t;
+ else if (ends_with(lit("vm" EXE_SUFF), prog_path, nil, nil))
+ txr_lisp_p = chr('o');
+
setvbuf(stderr, 0, _IOLBF, 0);
if (compat_val && length(compat_val) != zero) {