-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (47 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/make -f
ifdef DESTDIR
prefix ?= /usr
sysconfdir ?= /etc
else
prefix ?= /usr/local
sysconfdir ?= $(prefix)/etc
endif
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
datadir ?= $(prefix)/share
bashrc ?= $(datadir)/git-bd.bashrc
profiledir = $(sysconfdir)/profile.d
profile = $(profiledir)/git-bd.sh
mandir = $(prefix)/share/man
PROFILE_SH=\
'if [ -n "$${BASH_VERSION}" ]\n'\
'then\n'\
'source $(bashrc)\n'\
'fi'
build:
clean:
git-bd.1: git-bd.md
@pandoc -s -t man git-bd.md -o git-bd.1
docs: git-bd.1
caveats:
@echo 'If $(profiledir)/*.sh are not already automatically sourced you should add the following to your ~/.bash_profile:'
@echo
@echo ' for script in $(profiledir)/*.sh; do'
@echo ' if [ -r $$script ]; then'
@echo ' source $$script'
@echo ' fi'
@echo ' done'
@echo
@echo "This will enable the use of the 'bd' command which makes it easy to switch between a repo's branchdirs. 'git-bd' is available regardless of whether you choose to do this."
install:
@install -d $(DESTDIR)$(bindir)
@install git-bd $(DESTDIR)$(bindir)/git-bd
@install git-new-workdir $(DESTDIR)$(bindir)/git-new-workdir
@install -d $(DESTDIR)$(datadir)
@install git-bd.bashrc $(DESTDIR)$(bashrc)
@install -d $(DESTDIR)$(profiledir)
@echo $(PROFILE_SH) | sed 's/^ *//' > $(DESTDIR)$(profile)
install-docs: docs
@install git-bd.1 $(DESTDIR)$(mandir)/man1/git-bd.1
all: install caveats
.PHONY: all caveats install build clean docs install-docs