summaryrefslogtreecommitdiff
path: root/Makefile.orig
blob: 67ac85ff5dc0b4b6239a3c8ee6d0e5c566371d6d (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
# rvs Makefile
# 
# 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>.


# Make Programs #####################################################
RM = rm -f
CP = cp
MKDIR = mkdir -p
INSTALL = install
PRE = @@pre@@ # code pre-processor

# Variables ########################################################
SHELL = $$SHELL$$
prefix = $$prefix$$
bindir = $$bindir$$
libdir = $$libdir$$
sourcedir = @@sourcedir@@

# Targets ##########################################################

rvs : wrapper core

.PHONY : rvs install clean remove  wrapper i-wrapper core i-core
.SUFFIXES :

wrapper : out/rvs

core : shellScripts

srcFiles = $(shell find $(sourcedir)/src/rvs-core/ -type f)
outFiles = $(patsubst   $(sourcedir)/src/%,out/%,${basename $(srcFiles)})
libFiles = $(patsubst   out/rvs-core/%,$(libdir)/%,         $(outFiles) )
shellScripts : $(outFiles)

# install

install : rvs i-wrapper i-core

i-wrapper : $(prefix)/$(bindir)/rvs


i-core : $(libFiles)

# clean/remove

clean :
	$(RM) -r tmp
	$(RM) -r out
	$(RM) Makefile

remove :
	$(RM) $(prefix)/$(bindir)/rvs
	$(RM) -r $(libdir)

# implicit rules

out/% : $(sourcedir)/src/%.sh $(PRE)
	$(MKDIR) $(dir $@)
	$(PRE) <$< > $@

$(prefix)/$(bindir)/% : out/%
	$(INSTALL) -m 755 -o root -g root -T $< $@

$(libdir)/% : out/rvs-core/%
	$(INSTALL) -m 755 -o root -g root -d $(dir $@)
	$(INSTALL) -m 755 -o root -g root -T $< $@