Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
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, write to the Free Software
18 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #
20
21 PROJECT = utempter
22 VERSION = $(shell sed '/^Version: */!d;s///;q' libutempter.spec)
23 MAJOR = 0
24
25 SHAREDLIB = lib$(PROJECT).so
26 SONAME = $(SHAREDLIB).$(MAJOR)
27 STATICLIB = lib$(PROJECT).a
28 MAP = lib$(PROJECT).map
29
30 TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB)
31
32 INSTALL = install
33 libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
34 libexecdir = /usr/lib/$(DEB_HOST_MULTIARCH)
35 includedir = /usr/include
36 mandir = /usr/share/man
37 man3dir = $(mandir)/man3
38 DESTDIR =
39
40 WARNINGS = -W -Wall -Waggregate-return -Wcast-align -Wconversion \
41 -Wdisabled-optimization -Wmissing-declarations \
42 -Wmissing-format-attribute -Wmissing-noreturn \
43 -Wmissing-prototypes -Wpointer-arith -Wredundant-decls \
44 -Wshadow -Wstrict-prototypes -Wwrite-strings
45 COMPILE_DIALECT = -std=gnu99
46 COMPILE_LFS =
47 COMPILE_PIC = -fPIC
48 COMPILE_PIE = -fPIE
49 LINK_PIE = -pie
50 LINK_NOW = -Wl,-z,now
51 LINK_RELRO = -Wl,-z,relro
52 LINK_STATS = -Wl,-stats
53 override CPPFLAGS := $(COMPILE_DIALECT) $(COMPILE_LFS) -DLIBEXECDIR=\"$(libexecdir)\" $(CPPFLAGS)
54 override CFLAGS := $(WARNINGS) $(CFLAGS) $(RPM_OPT_FLAGS)
55 override LDFLAGS := $(LINK_RELRO) $(LINK_STATS) $(LDFLAGS)
56 LDLIBS =
57
58 all: $(TARGETS)
59
60 %.os: %.c
61 $(COMPILE.c) $(COMPILE_PIC) $< $(OUTPUT_OPTION)
62
63 $(PROJECT): utempter.c diag.h
64 $(LINK.c) $(COMPILE_PIE) $(LINK_PIE) $(LINK_NOW) $(LDLIBS) $< $(OUTPUT_OPTION)
65
66 $(SHAREDLIB): iface.os $(MAP)
67 $(LINK.o) -shared \
68 -Wl,-soname,$(SONAME),--version-script=$(MAP),-z,defs \
69 -lc $< $(OUTPUT_OPTION)
70
71 $(STATICLIB): iface.o
72 $(AR) $(ARFLAGS) $@ $<
73 -ranlib $@
74
75 iface.os: iface.c utempter.h diag.h
76
77 iface.o: iface.c utempter.h diag.h
78
79 install:
80 mkdir -p $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/$(PROJECT) \
81 $(DESTDIR)$(includedir) $(DESTDIR)$(man3dir)
82 $(INSTALL) -p -m2711 $(PROJECT) $(DESTDIR)$(libexecdir)/$(PROJECT)/
83 $(INSTALL) -p -m644 $(PROJECT).h $(DESTDIR)$(includedir)/
84 $(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SHAREDLIB).$(VERSION)
85 $(INSTALL) -p -m644 $(STATICLIB) $(DESTDIR)$(libdir)/
86 ln -s $(SHAREDLIB).$(VERSION) $(DESTDIR)$(libdir)/$(SONAME)
87 ln -s $(SONAME) $(DESTDIR)$(libdir)/$(SHAREDLIB)
88 $(INSTALL) -p -m644 $(PROJECT).3 $(DESTDIR)$(man3dir)/
89 for n in lib$(PROJECT) utempter_add_record utempter_remove_record \
90 utempter_remove_added_record utempter_set_helper; do \
91 ln -s $(PROJECT).3 $(DESTDIR)$(man3dir)/$$n.3; \
92 done
93
94 clean:
95 $(RM) $(TARGETS) iface.o iface.os core *~