blob: 8393738b7297e636c6f2163f0a90b19d461f7d5f [file] [log] [blame]
Andrew Morgan2c9c0532007-07-10 20:50:21 -07001#
Andrew Morgan2c9c0532007-07-10 20:50:21 -07002## Optional prefixes:
3#
4
5# common 'packaging' directoty
6
Mike Frysinger76f6f0a2008-02-16 16:52:31 -05007FAKEROOT=$(DESTDIR)
Andrew Morgan2c9c0532007-07-10 20:50:21 -07008
9# Autoconf-style prefixes are activated when $(prefix) is defined.
10# Otherwise binaries and libraraies are installed in /{lib,sbin}/,
11# header files in /usr/include/ and documentation in /usr/man/man?/.
Andrew G. Morgan85748f42010-08-08 17:42:11 -070012# These choices are motivated by the fact that getcap and setcap are
13# administrative operations that could be needed to recover a system.
Andrew Morgan2c9c0532007-07-10 20:50:21 -070014
Andrew Morgan5216fff2007-07-10 22:38:22 -070015ifndef lib
Andrew G. Morgan7d068bb2008-10-26 12:57:29 -070016lib=$(shell ldd /usr/bin/ld|fgrep ld-linux|cut -d/ -f2)
Andrew Morgan5216fff2007-07-10 22:38:22 -070017endif
18
Andrew Morgan2c9c0532007-07-10 20:50:21 -070019ifdef prefix
20exec_prefix=$(prefix)
21lib_prefix=$(exec_prefix)
22inc_prefix=$(lib_prefix)
Andrew Morgan5216fff2007-07-10 22:38:22 -070023man_prefix=$(prefix)/share
Andrew Morgan2c9c0532007-07-10 20:50:21 -070024else
25prefix=/usr
26exec_prefix=
27lib_prefix=$(exec_prefix)
28inc_prefix=$(prefix)
Andrew Morgan5216fff2007-07-10 22:38:22 -070029man_prefix=$(prefix)/share
Andrew Morgan2c9c0532007-07-10 20:50:21 -070030endif
31
32# Target directories
33
34MANDIR=$(FAKEROOT)$(man_prefix)/man
35SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin
36INCDIR=$(FAKEROOT)$(inc_prefix)/include
Andrew Morgan5216fff2007-07-10 22:38:22 -070037LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib)
Andrew Morgan2c9c0532007-07-10 20:50:21 -070038
Andrew Morgan370a70f2007-07-17 21:50:12 -070039# common defines for libcap
40LIBTITLE=libcap
Andrew Morganf782a972007-11-07 22:14:24 -080041VERSION=2
Andrew G. Morgana613b002011-07-24 19:24:16 -070042MINOR=22
Andrew Morgan2c9c0532007-07-10 20:50:21 -070043#
44
45# Compilation specifics
46
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070047KERNEL_HEADERS := $(topdir)/libcap/include
Torsten Werner7ebd7c52009-09-30 21:23:15 +020048IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070049
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070050CC := gcc
Andrew G. Morganf464aa72011-06-12 18:44:37 -070051CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070052BUILD_CC := $(CC)
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070053BUILD_CFLAGS := $(CFLAGS) $(IPATH)
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070054AR := ar
55RANLIB := ranlib
56DEBUG = -g #-DDEBUG
Torsten Werner7ebd7c52009-09-30 21:23:15 +020057WARNINGS=-Wall -Wwrite-strings \
Andrew Morgan2c9c0532007-07-10 20:50:21 -070058 -Wpointer-arith -Wcast-qual -Wcast-align \
Andrew Morgan5216fff2007-07-10 22:38:22 -070059 -Wstrict-prototypes -Wmissing-prototypes \
60 -Wnested-externs -Winline -Wshadow
Andrew Morgancd45c572007-08-13 23:16:50 -070061LD=$(CC) -Wl,-x -shared
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070062LDFLAGS := #-g
Andrew Morgan2c9c0532007-07-10 20:50:21 -070063
Andrew Morgan54f055e2007-07-21 22:18:02 -070064SYSTEM_HEADERS = /usr/include
Andrew Morgan2c9c0532007-07-10 20:50:21 -070065INCS=$(topdir)/libcap/include/sys/capability.h
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070066LDFLAGS += -L$(topdir)/libcap
Torsten Werner7ebd7c52009-09-30 21:23:15 +020067CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070068PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
Mike Frysingerf4e98362008-11-17 22:08:30 -080069INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
Andrew G. Morgan0a42b492008-10-19 19:37:28 -070070DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
Andrew G. Morgan1b5fb7e2008-11-10 18:00:28 -080071LIBATTR := yes
Andrew G. Morgan0a42b492008-10-19 19:37:28 -070072
Andrew G. Morgan85748f42010-08-08 17:42:11 -070073# When installing setcap, set its inheritable bit to be able to place
74# capabilities on files. It can be used in conjunction with pam_cap
75# (associated with su and certain users say) to make it useful for
76# specially blessed users. If you wish to drop this install feature,
77# use this command when running install
78#
79# make RAISE_SETFCAP=no install
80#
81RAISE_SETFCAP := $(LIBATTR)
82
Andrew Morgan2c9c0532007-07-10 20:50:21 -070083# Global cleanup stuff
84
85LOCALCLEAN=rm -f *~ core
86DISTCLEAN=@find . \( -name '*.orig' -o -name '*.rej' \) | xargs rm -f