Debian Codegraph @

Makefile

raw ◀ ▶
2 Debian patches touch this file
1 #
2 # Copyright (C) 2001-2005,2010 Dmitry V. Levin <[email protected]>
3 #
4 # Makefile for the libutempter project.
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
•17 # License along with this library; if not, see <https://www.gnu.org/licenses/>.
18 #
19
20 PROJECT = utempter
21 VERSION = $(shell sed '/^Version: */!d;s///;q' libutempter.spec)
22 MAJOR = 0
23
24 SHAREDLIB = lib$(PROJECT).so
25 SONAME = $(SHAREDLIB).$(MAJOR)
26 STATICLIB = lib$(PROJECT).a
27 MAP = lib$(PROJECT).map
28
29 TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB)
30
31 INSTALL = install
•32 libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
33 libexecdir = /usr/lib/$(DEB_HOST_MULTIARCH)
34 includedir = /usr/include
35 mandir = /usr/share/man
36 man3dir = $(mandir)/man3
37 DESTDIR =
38
39 WARNINGS = -W -Wall -Waggregate-return -Wcast-align -Wconversion \
40 -Wdisabled-optimization -Wmissing-declarations \
41 -Wmissing-format-attribute -Wmissing-noreturn \
42 -Wmissing-prototypes -Wpointer-arith -Wredundant-decls \
43 -Wshadow -Wstrict-prototypes -Wwrite-strings
44 COMPILE_DIALECT = -std=gnu99
45 COMPILE_LFS =
46 COMPILE_PIC = -fPIC
47 COMPILE_PIE = -fPIE
48 LINK_PIE = -pie
49 LINK_NOW = -Wl,-z,now
50 LINK_RELRO = -Wl,-z,relro
51 LINK_STATS = -Wl,-stats
52 override CPPFLAGS := $(COMPILE_DIALECT) $(COMPILE_LFS) -DLIBEXECDIR=\"$(libexecdir)\" $(CPPFLAGS)
53 override CFLAGS := $(WARNINGS) $(CFLAGS) $(RPM_OPT_FLAGS)
54 override LDFLAGS := $(LINK_RELRO) $(LINK_STATS) $(LDFLAGS)
55 LDLIBS =
56
57 all: $(TARGETS)
58
59 %.os: %.c
60 $(COMPILE.c) $(COMPILE_PIC) $< $(OUTPUT_OPTION)
61
62 $(PROJECT): utempter.c diag.h
63 $(LINK.c) $(COMPILE_PIE) $(LINK_PIE) $(LINK_NOW) $(LDLIBS) $< $(OUTPUT_OPTION)
64
65 $(SHAREDLIB): iface.os $(MAP)
66 $(LINK.o) -shared \
67 -Wl,-soname,$(SONAME),--version-script=$(MAP),-z,defs \
68 -lc $< $(OUTPUT_OPTION)
69
70 $(STATICLIB): iface.o
71 $(AR) $(ARFLAGS) $@ $<
72 -ranlib $@
73
74 iface.os: iface.c utempter.h diag.h
75
76 iface.o: iface.c utempter.h diag.h
77
78 install:
79 mkdir -p $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/$(PROJECT) \
80 $(DESTDIR)$(includedir) $(DESTDIR)$(man3dir)
81 $(INSTALL) -p -m2711 $(PROJECT) $(DESTDIR)$(libexecdir)/$(PROJECT)/
82 $(INSTALL) -p -m644 $(PROJECT).h $(DESTDIR)$(includedir)/
83 $(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SHAREDLIB).$(VERSION)
84 $(INSTALL) -p -m644 $(STATICLIB) $(DESTDIR)$(libdir)/
85 ln -s $(SHAREDLIB).$(VERSION) $(DESTDIR)$(libdir)/$(SONAME)
86 ln -s $(SONAME) $(DESTDIR)$(libdir)/$(SHAREDLIB)
87 $(INSTALL) -p -m644 $(PROJECT).3 $(DESTDIR)$(man3dir)/
88 for n in lib$(PROJECT) utempter_add_record utempter_remove_record \
89 utempter_remove_added_record utempter_set_helper; do \
90 ln -s $(PROJECT).3 $(DESTDIR)$(man3dir)/$$n.3; \
91 done
92
93 clean:
94 $(RM) $(TARGETS) iface.o iface.os core *~