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