diff --git a/Makefile b/Makefile index 3b88792..0c9f18c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ # Makefile for symlinks -CC := gcc +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 -MANDIR = /usr/man/man8/symlinks.8 -BINDIR = /usr/local/bin +PREFIX ?= /usr/local +MANDIR ?= $(PREFIX)/share/man/man8 +BINDIR ?= $(PREFIX)/bin + .PHONY: all all: symlinks @@ -13,8 +15,14 @@ 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) + +uninstall: + -rm -i $(BINDIR)/symlinks + -rm -i $(MANDIR)/symlinks.8 .PHONY: clean clean: diff --git a/Readme.md b/Readme.md index 7aaa5c5..342eb6b 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`, 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 + +### 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