File: Makefile

package info (click to toggle)
topgit 0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 336 kB
  • sloc: sh: 1,573; makefile: 38
file content (43 lines) | stat: -rw-r--r-- 1,203 bytes parent folder | download | duplicates (2)
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
prefix ?= $(HOME)
bindir := $(prefix)/bin
cmddir := $(prefix)/share/topgit
docdir := $(prefix)/share/doc/topgit
hooksdir := $(cmddir)/hooks


commands_in := $(wildcard tg-*.sh)
hooks_in = hooks/pre-commit.sh

commands_out := $(patsubst %.sh,%,$(commands_in))
hooks_out := $(patsubst %.sh,%,$(hooks_in))
help_out := $(patsubst %.sh,%.txt,$(commands_in))

all::	tg $(commands_out) $(hooks_out) $(help_out)

tg $(commands_out) $(hooks_out): % : %.sh Makefile
	@echo "[SED] $@"
	@sed -e 's#@cmddir@#$(cmddir)#g;' \
		-e 's#@hooksdir@#$(hooksdir)#g' \
		-e 's#@bindir@#$(bindir)#g' \
		-e 's#@docdir@#$(docdir)#g' \
		[email protected] >$@  && \
	chmod  x $@  && \
	mv $@  $@

$(help_out): README
	@CMD=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \
	echo '[HELP]' $$CMD && \
	./create-help.sh $$CMD

install:: all
	install -d -m 755 "$(DESTDIR)$(bindir)"
	install tg "$(DESTDIR)$(bindir)"
	install -d -m 755 "$(DESTDIR)$(cmddir)"
	install $(commands_out) "$(DESTDIR)$(cmddir)"
	install -d -m 755 "$(DESTDIR)$(hooksdir)"
	install $(hooks_out) "$(DESTDIR)$(hooksdir)"
	install -d -m 755 "$(DESTDIR)$(docdir)"
	install -m 644 $(help_out) "$(DESTDIR)$(docdir)"

clean::
	rm -f tg $(commands_out) $(hooks_out) $(help_out)