comparison Makefile @ 3:6d87242c537e

Add Makefile Use make to allow changing the tclsh path and for easy installation.
author Guido Berhoerster <guido+relmon@berhoerster.name>
date Mon, 20 Oct 2014 19:31:20 +0200
parents
children f28486666a4f
comparison
equal deleted inserted replaced
2:0203fffb4d74 3:6d87242c537e
1 #
2 # Copyright (C) 2014 Guido Berhoerster <guido+relmon@berhoerster.name>
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining
5 # a copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish,
8 # distribute, sublicense, and/or sell copies of the Software, and to
9 # permit persons to whom the Software is furnished to do so, subject to
10 # the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 #
23
24 PACKAGE = relmon
25 VERSION = 1
26 DISTNAME := $(PACKAGE)-$(VERSION)
27
28 INSTALL := install
29 INSTALL.exec := $(INSTALL) -D -m 0755
30 INSTALL.data := $(INSTALL) -D -m 0644
31 PAX := pax
32 GZIP := gzip
33 SED := sed
34 TCLSH_PATH := /usr/bin/tclsh
35
36 DESTDIR ?=
37 prefix ?= /usr/local
38 bindir ?= $(prefix)/bin
39
40 SCRIPTS = $(PACKAGE).tcl
41
42 .DEFAULT_TARGET = all
43
44 .PHONY: all clean clobber dist install
45
46 all: $(PACKAGE)
47
48 $(PACKAGE): $(SCRIPTS)
49 cp $< $@
50
51 %.tcl: %.tcl.in
52 $(SED) -e '1s,#!.*,#!$(TCLSH_PATH),' -e 's,@VERSION@,$(VERSION),' $< \
53 > $@
54
55 install:
56 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
57
58 clean:
59 rm -f $(PACKAGE) $(SCRIPTS)
60
61 clobber: clean
62
63 dist: clobber
64 $(PAX) -w -x ustar -s ',.*/\..*,,' -s ',./[^/]*\.tar\.gz,,' \
65 -s ',\./,$(DISTNAME)/,' . | $(GZIP) > $(DISTNAME).tar.gz