-
Notifications
You must be signed in to change notification settings - Fork 52
/
Makefile
48 lines (38 loc) · 1.23 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
PREFIX=/usr/local
DESTDIR=
BUILDDIR=build
BINDIR=$(PREFIX)/bin
LIBEXECDIR=$(PREFIX)/lib
GITHGEXECDIR=$(LIBEXECDIR)/git-hg
FASTEXPORTDIR=$(GITHGEXECDIR)/fast-export
# INSTALL=$$(which install) -c # Shell in makefiles must use $$, not $. But
# SED=$$(which sed) # <--- this is redundant, since make will use the first
# utility of that name in the $PATH anyway.
# SED = gsed # <-- The reason to set these (at all) would be to allow this.
# Also, you can't quote arguments in an assignment or they aren't expanded.
INSTALL = install -c
SED = sed
GITHG_S=bin/git-hg
GITHG_F=$(BUILDDIR)/git-hg
HGFE_D=fast-export
HGFE_F=$(HGFE_D)/hg-fast-export.sh $(HGFE_D)/hg-fast-export.py $(HGFE_D)/hg2git.py
all: $(GITHG_F)
clean:
rm -rf $(BUILDDIR)
distclean: clean
rm -rf $(HGFE_D)
git clean -dxf
$(GITHG_F): $(HGFE_D)
rm -rf $(HGFE_D)
git submodule update --init
mkdir -p $(BUILDDIR)
$(SED) 's|GITHG_HOME=.*|GITHG_HOME=$(GITHGEXECDIR)|' $(GITHG_S) > $@
chmod a+rx $@
$(HGFE_D):
rm -rf $(HGFE_D)
git submodule update --init
install: all
$(INSTALL) -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m 755 $(GITHG_F) $(DESTDIR)$(BINDIR)/
$(INSTALL) -d $(DESTDIR)$(FASTEXPORTDIR)
$(INSTALL) -m 755 $(HGFE_F) $(DESTDIR)$(FASTEXPORTDIR)/