File: Makefile

package info (click to toggle)
libutempter 1.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 196 kB
  • ctags: 93
  • sloc: ansic: 362; makefile: 216
file content (84 lines) | stat: -rw-r--r-- 2,907 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
#
# Copyright (C) 2001-2005,2010  Dmitry V. Levin <ldv@altlinux.org>
#
# Makefile for the libutempter project.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

PROJECT = utempter
VERSION = $(shell sed '/^Version: */!d;s///;q' libutempter.spec)
MAJOR = 0

SHAREDLIB = lib$(PROJECT).so
SONAME = $(SHAREDLIB).$(MAJOR)
STATICLIB = lib$(PROJECT).a
MAP = lib$(PROJECT).map

TARGETS = $(PROJECT) $(SHAREDLIB) $(STATICLIB)

INSTALL = install
libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
libexecdir = /usr/lib/$(DEB_HOST_MULTIARCH)
includedir = /usr/include
mandir = /usr/share/man
man3dir = $(mandir)/man3
DESTDIR =

WARNINGS = -W -Wall -Waggregate-return -Wcast-align -Wconversion \
	-Wdisabled-optimization -Wmissing-declarations \
	-Wmissing-format-attribute -Wmissing-noreturn \
	-Wmissing-prototypes -Wpointer-arith -Wredundant-decls \
	-Wshadow -Wstrict-prototypes -Wwrite-strings
CPPFLAGS += -std=gnu99 $(WARNINGS) -DLIBEXECDIR=\"$(libexecdir)\"
CFLAGS += $(RPM_OPT_FLAGS)
LDLIBS =

all: $(TARGETS)

%.os: %.c
	$(CC) $(CPPFLAGS) $(filter-out -fPIE,$(CFLAGS)) -c -fPIC $< $(OUTPUT_OPTION)

$(PROJECT): utempter.c
	$(LINK.c) -Wl,-z,now,-stats $(LDLIBS) $< $(OUTPUT_OPTION)

$(SHAREDLIB): iface.os $(MAP)
	$(CC) $(filter-out -fPIE -pie,$(LDFLAGS)) -shared \
		-Wl,-soname,$(SONAME),--version-script=$(MAP),-z,defs,-stats \
		-lc $< $(OUTPUT_OPTION) $(LDLIBS)

$(STATICLIB): iface.o
	$(AR) $(ARFLAGS) $@ $<
	-ranlib $@

iface.o: iface.c utempter.h

install:
	mkdir -p $(DESTDIR)$(libdir) $(DESTDIR)$(libexecdir)/$(PROJECT) \
		$(DESTDIR)$(includedir) $(DESTDIR)$(man3dir)
	$(INSTALL) -p -m2711 $(PROJECT) $(DESTDIR)$(libexecdir)/$(PROJECT)/
	$(INSTALL) -p -m644 $(PROJECT).h $(DESTDIR)$(includedir)/
	$(INSTALL) -p -m755 $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SHAREDLIB).$(VERSION)
	$(INSTALL) -p -m644 $(STATICLIB) $(DESTDIR)$(libdir)/
	ln -s $(SHAREDLIB).$(VERSION) $(DESTDIR)$(libdir)/$(SONAME)
	ln -s $(SONAME) $(DESTDIR)$(libdir)/$(SHAREDLIB)
	$(INSTALL) -p -m644 $(PROJECT).3 $(DESTDIR)$(man3dir)/
	for n in lib$(PROJECT) utempter_add_record utempter_remove_record \
	    utempter_remove_added_record utempter_set_helper; do \
		ln -s $(PROJECT).3 $(DESTDIR)$(man3dir)/$$n.3; \
	done

clean:
	$(RM) $(TARGETS) iface.o iface.os core *~