1#
2## Optional prefixes:
3#
4
5# common 'packaging' directoty
6
7FAKEROOT=$(DESTDIR)
8
9# Autoconf-style prefixes are activated when $(prefix) is defined.
10# Otherwise binaries and libraries are installed in /{lib,sbin}/,
11# header files in /usr/include/ and documentation in /usr/man/man?/.
12# These choices are motivated by the fact that getcap and setcap are
13# administrative operations that could be needed to recover a system.
14
15ifndef lib
16lib=$(shell ldd /usr/bin/ld|egrep "ld-linux|ld.so"|cut -d/ -f2)
17endif
18
19ifdef prefix
20exec_prefix=$(prefix)
21lib_prefix=$(exec_prefix)
22inc_prefix=$(lib_prefix)
23man_prefix=$(prefix)/share
24else
25prefix=/usr
26exec_prefix=
27lib_prefix=$(exec_prefix)
28inc_prefix=$(prefix)
29man_prefix=$(prefix)/share
30endif
31
32# Target directories
33
34MANDIR=$(man_prefix)/man
35SBINDIR=$(exec_prefix)/sbin
36INCDIR=$(inc_prefix)/include
37LIBDIR=$(lib_prefix)/$(lib)
38PKGCONFIGDIR=$(prefix)/$(lib)/pkgconfig
39
40# common defines for libcap
41LIBTITLE=libcap
42VERSION=2
43MINOR=24
44#
45
46# Compilation specifics
47
48KERNEL_HEADERS := $(topdir)/libcap/include/uapi
49IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include
50
51CC := gcc
52CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
53BUILD_CC := $(CC)
54BUILD_CFLAGS := $(CFLAGS) $(IPATH)
55AR := ar
56RANLIB := ranlib
57DEBUG = -g #-DDEBUG
58WARNINGS=-Wall -Wwrite-strings \
59        -Wpointer-arith -Wcast-qual -Wcast-align \
60        -Wstrict-prototypes -Wmissing-prototypes \
61        -Wnested-externs -Winline -Wshadow
62LD=$(CC) -Wl,-x -shared
63LDFLAGS := #-g
64BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes)
65
66SYSTEM_HEADERS = /usr/include
67INCS=$(topdir)/libcap/include/sys/capability.h
68LDFLAGS += -L$(topdir)/libcap
69CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
70PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
71INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
72DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
73LIBATTR := yes
74
75# When installing setcap, set its inheritable bit to be able to place
76# capabilities on files. It can be used in conjunction with pam_cap
77# (associated with su and certain users say) to make it useful for
78# specially blessed users. If you wish to drop this install feature,
79# use this command when running install
80#
81#    make RAISE_SETFCAP=no install
82#
83RAISE_SETFCAP := $(LIBATTR)
84
85# Global cleanup stuff
86
87LOCALCLEAN=rm -f *~ core
88DISTCLEAN=@find . \( -name '*.orig' -o -name '*.rej' \) | xargs rm -f
89