summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 7a3e131c9992ebad26a059b754ae627726753a9f (plain)
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
82
83
84
85
86
87
88
89
90
#!/usr/bin/make -f
# rvs Makefile
# version 0.7.0
# Copyright (C) 2009 Luke Shumaker
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# Originally written by Luke Shumaker <lukeshu@sbcglobal.net>.


# Variables ########################################################
RM = rm -f
CP = cp
SED = sed
INSTALL = install
MKDIR = $(INSTALL) -d #mkdir -p
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 644
TOUCH = touch
export RM CP SED INSTALL MKDIR INSTALL_PROGRAM INSTALL_DATA

SHELL = @SHELL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
rvsdir = @rvsdir@/rvs
srcdir = @srcdir@
export SHELL rvsdir srcdir

plugins = $(patsubst $(srcdir)/plugins/%,%,\
  $(shell find $(srcdir)/plugins/* -maxdepth 0 -type d))

# phony targets ####################################################
make-plugins    = $(addprefix         p-,$(plugins))
install-plugins = $(addprefix install-p-,$(plugins))
remove-plugins  = $(addprefix  remove-p-,$(plugins))
all-plugins = $(make-plugins) $(install-plugins) $(remove-plugins)
all : rvs $(make-plugins)
#.PHONY : install uninstall clean distclean $(all-plugins)
.PHONY : install uninstall clean distclean
.SUFFIXES :

# targets ##########################################################

$(rvsdir)/plugins :
	$(MKDIR) $(dir $@)
	$(TOUCH) $@

# install/clean/remove #############################################

install : $(bindir)/rvs $(rvsdir)/plugins $(install-plugins)

clean :

distclean : clean
	$(RM) var.sed
	$(RM) Makefile

uninstall :
	$(RM) $(prefix)/$(bindir)/rvs
	$(RM) -r $(rvsdir)

# implicit rules ###################################################

# 'build' shell scripts
b := @
% : $(srcdir)/%.sh
	$(MKDIR) $(dir $@)
	$(SED) -e 's/$bSHELL@/$(subst  /,\/,$(SHELL) )/g' \
    -e 's/$brvsdir@/$(subst /,\/,$(rvsdir))/g' <$< > $@

# install
$(bindir)/% : %
	$(MKDIR) $(dir $@)
	$(INSTALL_PROGRAM) $< $@

# make plugins
p-% : plugins/% plugins/%/Makefile $(srcdir)/plugins/%
	$(MAKE) -C $<

# install plugins
install-p-% : plugins/% plugins/%/Makefile $(srcdir)/plugins/% p-%
	$(MAKE) -C $< install

# uninstall plugins
uninstall-p-% : plugins/% plugins/%/Makefile
	$(MAKE) -C $< uninstall