Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3
4 PREFIX ?= /usr/local
5 MANDIR ?= /share/man/man1
6 BINDIR ?= /bin
7 LIBDIR ?= /lib
8 mandir = $(DESTDIR)$(PREFIX)$(MANDIR)
9 bindir = $(DESTDIR)$(PREFIX)$(BINDIR)
10 libdir = $(DESTDIR)$(PREFIX)$(LIBDIR)
11
12 CACHE_BINS=cachedel cachestats
•13 NOCACHE_BINS=nocache.o fcntl_helpers.o pageinfo.o wrappers.o
14 MANPAGES=$(wildcard man/*.1)
15
16 CC ?= gcc
•17 CFLAGS+= -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
18 COMPILE = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
19
20 .PHONY: all
21 all: $(CACHE_BINS) nocache.so nocache
22
23 $(CACHE_BINS):
24 $(COMPILE) -o $@ [email protected]
25
26 $(NOCACHE_BINS): $(NOCACHE_BINS:.o=.c)
27 $(COMPILE) -fPIC -c -o $@ $(@:.o=.c)
28
29 nocache.global: nocache.in
30 sed 's!##libdir##!$(subst $(DESTDIR),,$(libdir))!' <nocache.in >$@
31
32 nocache: nocache.in
33 sed 's!##libdir##!$$(dirname "$$0")!' <nocache.in >$@
34 chmod a+x $@
35
36 nocache.so: $(NOCACHE_BINS)
37 $(COMPILE) -pthread -shared -Wl,-soname,nocache.so -o nocache.so $(NOCACHE_BINS) -ldl
38
39 $(mandir) $(libdir) $(bindir):
40 mkdir -v -p $@
41
42 install: all $(mandir) $(libdir) $(bindir) nocache.global
43 install -pm 0644 nocache.so $(libdir)
44 install -pm 0755 nocache.global $(bindir)/nocache
45 install -pm 0755 $(CACHE_BINS) $(bindir)
46 install -pm 0644 $(MANPAGES) $(mandir)
47
48 .PHONY: uninstall
49 uninstall:
50 cd $(mandir) && $(RM) -v $(notdir $(MANPAGES))
51 $(RM) -v $(bindir)/nocache $(libdir)/nocache.so
52
53 .PHONY: clean distclean
54 clean distclean:
55 $(RM) -v $(CACHE_BINS) $(NOCACHE_BINS) nocache.so nocache nocache.global
56
57 .PHONY: test
58 test: all
59 cd t; prove -v .