diff options
Diffstat (limited to 'EndoForge/Makefile')
-rw-r--r-- | EndoForge/Makefile | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/EndoForge/Makefile b/EndoForge/Makefile new file mode 100644 index 0000000..2501da9 --- /dev/null +++ b/EndoForge/Makefile | |||
@@ -0,0 +1,40 @@ | |||
1 | ifeq ($(shell id -u),0) | ||
2 | SUDO = | ||
3 | else | ||
4 | SUDO = sudo | ||
5 | endif | ||
6 | |||
7 | ROOT_INSTALL = $(SUDO) install | ||
8 | |||
9 | USER != echo "$${SUDO_USER:-$$(id -un)}" | ||
10 | |||
11 | SSH_CONFIG_DIR = /etc/ssh | ||
12 | SSHD_CONFIG_DIR = $(SSH_CONFIG_DIR)/sshd_config.d | ||
13 | SSH_LIB_DIR = /usr/lib/ssh | ||
14 | USER_SSH_CONFIG_DIR = ~$(USER)/.ssh | ||
15 | |||
16 | BROWSER != 2>/dev/null which xdg-open || which w3m || which links || which elinks | ||
17 | |||
18 | .PHONY: install shared doc test | ||
19 | |||
20 | doc: README.html | ||
21 | $(BROWSER) $< | ||
22 | |||
23 | shared: install | ||
24 | git config core.self-forge true | ||
25 | |||
26 | SRC = src | ||
27 | SOURCES = $(addprefix $(SRC), AnonymousAccessCommand anonymous-access.conf AuthorizedKeysCommand) | ||
28 | |||
29 | install: | ||
30 | install -t $(USER_SSH_CONFIG_DIR) $(SRC)/AnonymousAccessCommand | ||
31 | $(ROOT_INSTALL) -d "$(SSH_CONFIG_DIR)" "$(SSHD_CONFIG_DIR)" "$(SSH_LIB_DIR)" || true | ||
32 | $(ROOT_INSTALL) -m0644 -t "$(SSHD_CONFIG_DIR)" $(SRC)/anonymous-access.conf || true | ||
33 | $(ROOT_INSTALL) -t "$(SSH_LIB_DIR)" $(SRC)/AuthorizedKeysCommand || true | ||
34 | [ -e "$(SSH_LIB_DIR)"/AuthorizedKeysCommand ] || $(SUDO) ln -s -t /etc/ssh "$(SSH_LIB_DIR)"/AuthorizedKeysCommand | ||
35 | |||
36 | README.html: README.md | ||
37 | pandoc -t html $< > $@ | ||
38 | |||
39 | test: | ||
40 | make -C test | ||