-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
81 lines (71 loc) · 2.08 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# PREFIX should be set manually or will be selected during make install
DATADIR = $(PREFIX)/share/rsget.pl
BINDIR = $(PREFIX)/bin
VER =
PKGDIR = rsget.pl-$(VER)
PERL =
ifneq ($(PERL),)
SETINTERPRETER = 1s|^\(..\).*|\1$(PERL)|;
endif
PLUGIN_DIRS = Get Video Audio Image Link Direct
DIRS = RSGet $(PLUGIN_DIRS) data
Q = @
export LC_ALL=C
all: rsget.pl
ifeq ($(VER),)
pkg:
$(MAKE) VER="$$(svn up | sed '/At revision /!d; s/At revision //; s/\.//')" pkg
else
pkg: clean
@echo "**********************************************"
@echo "*** There should be no new packages, check ***"
@echo "*** http://rsget.pl/about/new-core/ ***"
@echo "**********************************************"
$(IGNORE_DISCONTINUATION_WARNING)@false
rm -rf $(PKGDIR)
for DIR in $(DIRS); do \
install -d $(PKGDIR)/$$DIR; \
done
install rsget.pl $(PKGDIR)
cp Makefile README README.config README.requirements $(PKGDIR)
cp RSGet/*.pm $(PKGDIR)/RSGet
for DIR in $(PLUGIN_DIRS); do \
cp $$DIR/* $(PKGDIR)/$$DIR || exit 1; \
cp $$DIR/.template $(PKGDIR)/$$DIR || exit 1; \
done
cp data/* $(PKGDIR)/data
tar -cjf $(PKGDIR).tar.bz2 $(PKGDIR)
endif
ifeq ($(PREFIX),)
install:
$(Q)if [ -r /usr/bin/rsget.pl ]; then \
echo "*** Current rsget.pl instalation found in /usr/bin, using /usr as PREFIX"; \
$(MAKE) PREFIX="/usr" install; \
else \
$(MAKE) PREFIX="/usr/local" install; \
fi
else
install: clean
$(Q)echo "*** Installing in $(PREFIX)"
for DIR in $(DIRS); do \
install -d $(DESTDIR)$(DATADIR)/$$DIR; \
done
install -d $(DESTDIR)$(BINDIR)
sed '$(SETINTERPRETER) s#\($$install_path\) =.*;#\1 = "$(DATADIR)";#' \
< rsget.pl > rsget.pl.datadir
install rsget.pl.datadir $(DESTDIR)$(BINDIR)/rsget.pl
cp RSGet/*.pm $(DESTDIR)$(DATADIR)/RSGet
cp data/* $(DESTDIR)$(DATADIR)/data
for DIR in $(PLUGIN_DIRS); do \
cp $$DIR/* $(DESTDIR)$(DATADIR)/$$DIR || exit 1; \
grep -l "status:\s*BROKEN" $(DESTDIR)$(DATADIR)/$$DIR/* | xargs -r rm -v; \
done
endif
.PHONY: clean
clean:
$(Q)for DIR in $(DIRS) .; do \
rm -fv $$DIR/*~; \
rm -fv $$DIR/.*~; \
rm -fv $$DIR/svn-commit.tmp*; \
done
rm -fv rsget.pl.datadir