File: Makefile

package info (click to toggle)
multipath-tools 0.8.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,308 kB
  • sloc: ansic: 55,153; perl: 1,622; sh: 775; makefile: 672; pascal: 127
file content (91 lines) | stat: -rw-r--r-- 2,420 bytes parent folder | download | duplicates (2)
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
86
87
88
89
90
91
# Makefile
#
# Copyright (C) 2015 - 2016 Red Hat, Inc.
# Gris Ge <fge@redhat.com>
#
include ../Makefile.inc

LIBDMMP_VERSION=0.2.0
SONAME=$(LIBDMMP_VERSION)
DEVLIB = libdmmp.so
LIBS = $(DEVLIB).$(SONAME)
PKGFILE = libdmmp.pc
EXTRA_MAN_FILES = libdmmp.h.3
HEADERS = libdmmp/libdmmp.h

OBJS = libdmmp.o libdmmp_mp.o libdmmp_pg.o libdmmp_path.o libdmmp_misc.o

CFLAGS += $(LIB_CFLAGS) -fvisibility=hidden -I$(libdmmpdir) -I$(mpathcmddir) \
	  $(shell $(PKG_CONFIG) --cflags json-c)

LIBDEPS += $(shell $(PKG_CONFIG) --libs json-c) -L$(mpathcmddir) -lmpathcmd -lpthread

all: $(LIBS) doc

$(LIBS): $(OBJS)
	$(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
	$(LN) $@ $(DEVLIB)

install:
	mkdir -p $(DESTDIR)$(usrlibdir)
	$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
	$(INSTALL_PROGRAM) -m 644 -D \
		$(HEADERS) $(DESTDIR)$(includedir)/$(HEADERS)
	$(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
	$(INSTALL_PROGRAM) -m 644 -D \
		$(PKGFILE).in $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
	perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
	perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
	perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
	@for file in docs/man/*.3.gz; do \
		$(INSTALL_PROGRAM) -m 644 -D \
			$$file \
			$(DESTDIR)$(man3dir)/ || exit $?; \
	done

uninstall:
	$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
	$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
	$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
	@for file in $(DESTDIR)$(man3dir)/dmmp_*; do \
		$(RM) $$file; \
	done
	$(RM) $(DESTDIR)$(man3dir)/libdmmp.h*
	$(RM) $(DESTDIR)$(pkgconfdir)/$(PKGFILE)

clean: dep_clean
	$(RM) core *.a *.o *.gz *.so *.so.*
	$(RM) -r docs/man
	$(MAKE) -C test clean

include $(wildcard $(OBJS:.o=.d))

check: all
	$(MAKE) -C test check

speed_test: all
	$(MAKE) -C test speed_test

doc: docs/man/$(EXTRA_MAN_FILES).gz

TEMPFILE := $(shell mktemp)

docs/man/$(EXTRA_MAN_FILES).gz: $(HEADERS)
	@for file in $(EXTRA_MAN_FILES); do \
		$(INSTALL_PROGRAM) -v -m 644 -D docs/$$file docs/man/$$file; \
	done
	cat $(HEADERS) | \
	    perl docs/doc-preclean.pl > "$(TEMPFILE)"
	perl docs/kernel-doc -man "$(TEMPFILE)" | \
	    perl docs/split-man.pl docs/man
	-rm -f "$(TEMPFILE)"
	@for file in docs/man/*.3; do \
		gzip -f $$file; \
	done
	find docs/man -type f -name \*[0-9].gz

dep_clean:
	$(RM) $(OBJS:.o=.d)