From b929650262ddf885f660f542875713972e0148d9 Mon Sep 17 00:00:00 2001 From: Kevin Ernst Date: Fri, 24 Sep 2021 11:42:11 -0400 Subject: [PATCH 1/5] Makefile: allow PREFIX, MANDIR, BINDIR override - fixes brandt/symlinks#9 - partially address concerns about lack of a `./configure` script in brandt/symlinks#4 --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3b88792..211c397 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ # Makefile for symlinks -CC := gcc +CC = gcc +INSTALL = install CFLAGS += $(shell getconf LFS_CFLAGS 2>/dev/null) OWNER = root GROUP = root -MANDIR = /usr/man/man8/symlinks.8 -BINDIR = /usr/local/bin +PREFIX ?= /usr/local +MANDIR ?= $(PREFIX)/share/man/man8/symlinks.8 +BINDIR ?= $(PREFIX)/bin + .PHONY: all all: symlinks From 5819b437234b0a9e60df531494f1deb50adca5a3 Mon Sep 17 00:00:00 2001 From: Kevin Ernst Date: Fri, 24 Sep 2021 11:57:13 -0400 Subject: [PATCH 2/5] readme: clarify installation; note about binaries - closes brandt/symlinks#4 --- Readme.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 7aaa5c5..4767208 100644 --- a/Readme.md +++ b/Readme.md @@ -16,9 +16,19 @@ Installation ### Source: - $ ./configure + $ cd path/to/the/extracted/source $ make - $ make install + $ make install # or 'sudo make install' if you get an error + +If you would like to install to some other location besides the default of `/usr/local/bin`, which usually requires admin privileges, then add `PREFIX=/some/other/path` to the end of your `make install`. For example: + + $ make install PREFIX=$HOME/.local/bin + +### Pre-compiled binaries: + +Many Linux distributions already have a version of Mark Lord's original `symlinks` in their repositories; see https://pkgs.org/search/?q=symlinks for details. + +If you use MacPorts, you can `sudo port install symlinks`. Usage From 64d40969268e0e4f19d32b250f02f32eed9e1a06 Mon Sep 17 00:00:00 2001 From: Kevin Ernst Date: Fri, 24 Sep 2021 12:02:06 -0400 Subject: [PATCH 3/5] readme: remove extraneous 'bin' --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 4767208..342eb6b 100644 --- a/Readme.md +++ b/Readme.md @@ -20,9 +20,9 @@ Installation $ make $ make install # or 'sudo make install' if you get an error -If you would like to install to some other location besides the default of `/usr/local/bin`, which usually requires admin privileges, then add `PREFIX=/some/other/path` to the end of your `make install`. For example: +If you would like to install to some other location besides the default of `/usr/local`, which usually requires admin privileges, then add `PREFIX=/some/other/path` to the end of your `make install`. For example: - $ make install PREFIX=$HOME/.local/bin + $ make install PREFIX=$HOME/.local ### Pre-compiled binaries: From d7a90338869e4659839ab58d21445b11782d78ab Mon Sep 17 00:00:00 2001 From: Kevin Ernst Date: Fri, 24 Sep 2021 13:03:39 -0400 Subject: [PATCH 4/5] Makefile: fix MANDIR, fix for macOS - MANDIR was not a directory before; now it is - macOS has no "root" group, and -g/-o are rarely needed anyway - hat tip to osmcode/libosmium#18 - fairly-recent macOS (Mojave) still does not have 'install -D' so do 'install -d' explicitly for the parent directories, particularly for 'man8', since that probably won't exist in most people's /usr/local/share/man to begin with --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 211c397..5212507 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ # Makefile for symlinks CC = gcc +# append options like `-o owner -g group` here if desired INSTALL = install CFLAGS += $(shell getconf LFS_CFLAGS 2>/dev/null) -OWNER = root -GROUP = root PREFIX ?= /usr/local -MANDIR ?= $(PREFIX)/share/man/man8/symlinks.8 +MANDIR ?= $(PREFIX)/share/man/man8 BINDIR ?= $(PREFIX)/bin @@ -16,8 +15,10 @@ symlinks: symlinks.c $(CC) -Wall -Wstrict-prototypes -O2 $(CFLAGS) -o symlinks symlinks.c install: all symlinks.8 - $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 755 symlinks $(BINDIR) - $(INSTALL) -c -o $(OWNER) -g $(GROUP) -m 644 symlinks.8 $(MANDIR) + $(INSTALL) -d $(BINDIR) + $(INSTALL) -m 755 symlinks $(BINDIR) + $(INSTALL) -d $(MANDIR) + $(INSTALL) -m 644 symlinks.8 $(MANDIR) .PHONY: clean clean: From 62742d1fa37d7bed77c4932b583a63e1172fb02e Mon Sep 17 00:00:00 2001 From: Kevin Ernst Date: Fri, 24 Sep 2021 13:07:48 -0400 Subject: [PATCH 5/5] Makefile: add "uninstall" because why not --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 5212507..0c9f18c 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ install: all symlinks.8 $(INSTALL) -d $(MANDIR) $(INSTALL) -m 644 symlinks.8 $(MANDIR) +uninstall: + -rm -i $(BINDIR)/symlinks + -rm -i $(MANDIR)/symlinks.8 + .PHONY: clean clean: rm -f symlinks *.o core