-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
85 lines (73 loc) · 2.04 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
82
83
84
85
# ---------------------------------------------------------------------------- #
#
# Created : Fri 14 Apr 2006 07:20:44 PM CDT
# Modified : Sat 12 Mar 2011 03:26:05 PM EST
# Author : Gautam Iyer <[email protected]>
# Licence : GPL2
#
# ---------------------------------------------------------------------------- #
include config.mk
#
# Files installed by this package
#
inst_bins = src/xnots
inst_mans = doc/xnots.1
inst_docs = doc/examples/
inst_extras = README LICENCE
#
# Files packed into the source archive
#
dist_sources = src/Makefile src/*.c src/*.h
dist_mans = $(inst_mans)
dist_docs = $(inst_docs)
dist_extras = $(inst_extras)
dist_makefile = Makefile
dist_etc = etc/
#
# Directory variables
#
prefix = /usr/local
bindir = $(prefix)/bin
datadir = $(prefix)/share
mandir = $(datadir)/man
man1dir = $(mandir)/man1
docdir = $(datadir)/doc/xnots-$(VERSION)
#
# Programs
#
CC = gcc
INSTALL = install
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = ${INSTALL} -m 644
#
# Make rules
#
.PHONY: xnots
xnots:
cd src && $(MAKE)
.PHONY: clean
clean:
$(MAKE) -C src clean
.PHONY: install-strip
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
.PHONY: installdirs
installdirs:
mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) $(DESTDIR)$(docdir)
.PHONY: install
install: xnots installdirs $(inst_bins) $(inst_mans) $(inst_docs) $(inst_extras)
$(INSTALL) $(inst_bins) $(DESTDIR)$(bindir)
$(INSTALL_DATA) $(inst_mans) $(DESTDIR)$(man1dir)
$(INSTALL_DATA) $(inst_extras) $(DESTDIR)$(docdir)
cp -R $(inst_docs) $(DESTDIR)$(docdir)
.PHONY: dist
dist: $(dist_sources) $(dist_docs) $(dist_mans) $(dist_extras) \
$(dist_makefile) $(dist_etc)
export distdir=xnots-$(VERSION) \
&& mkdir -p $$distdir/doc $$distdir/src \
&& cp $(dist_sources) $$distdir/src \
&& cp -R $(dist_mans) $(dist_docs) $$distdir/doc \
&& cp $(dist_extras) $(dist_makefile) $$distdir/ \
&& cp -R $(dist_etc) $$distdir/ \
&& tar --exclude .svn -c $$distdir | gzip -9 > $$distdir.tar.gz \
&& rm -rf $$distdir