blob: c0f8b55554ae7e4f626bddee258c88b8f5d768db [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?/.
12
Andrew Morgan5216fff2007-07-10 22:38:22 -070013ifndef lib
Andrew G. Morgan7d068bb2008-10-26 12:57:29 -070014lib=$(shell ldd /usr/bin/ld|fgrep ld-linux|cut -d/ -f2)
Andrew Morgan5216fff2007-07-10 22:38:22 -070015endif
16
Andrew Morgan2c9c0532007-07-10 20:50:21 -070017ifdef prefix
18exec_prefix=$(prefix)
19lib_prefix=$(exec_prefix)
20inc_prefix=$(lib_prefix)
Andrew Morgan5216fff2007-07-10 22:38:22 -070021man_prefix=$(prefix)/share
Andrew Morgan2c9c0532007-07-10 20:50:21 -070022else
23prefix=/usr
24exec_prefix=
25lib_prefix=$(exec_prefix)
26inc_prefix=$(prefix)
Andrew Morgan5216fff2007-07-10 22:38:22 -070027man_prefix=$(prefix)/share
Andrew Morgan2c9c0532007-07-10 20:50:21 -070028endif
29
30# Target directories
31
32MANDIR=$(FAKEROOT)$(man_prefix)/man
33SBINDIR=$(FAKEROOT)$(exec_prefix)/sbin
34INCDIR=$(FAKEROOT)$(inc_prefix)/include
Andrew Morgan5216fff2007-07-10 22:38:22 -070035LIBDIR=$(FAKEROOT)$(lib_prefix)/$(lib)
Andrew Morgan2c9c0532007-07-10 20:50:21 -070036
Andrew Morgan370a70f2007-07-17 21:50:12 -070037# common defines for libcap
38LIBTITLE=libcap
Andrew Morganf782a972007-11-07 22:14:24 -080039VERSION=2
Andrew G. Morgan4a4b9db2010-01-13 18:05:29 -080040MINOR=19
Andrew Morgan2c9c0532007-07-10 20:50:21 -070041#
42
43# Compilation specifics
44
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070045KERNEL_HEADERS := $(topdir)/libcap/include
Torsten Werner7ebd7c52009-09-30 21:23:15 +020046IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS)
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070047
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070048CC := gcc
49CFLAGS := -O2
50BUILD_CC := $(CC)
Andrew G. Morgan8bdd0ef2008-09-10 19:50:50 -070051BUILD_CFLAGS := $(CFLAGS) $(IPATH)
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070052AR := ar
53RANLIB := ranlib
54DEBUG = -g #-DDEBUG
Torsten Werner7ebd7c52009-09-30 21:23:15 +020055WARNINGS=-Wall -Wwrite-strings \
Andrew Morgan2c9c0532007-07-10 20:50:21 -070056 -Wpointer-arith -Wcast-qual -Wcast-align \
Andrew Morgan5216fff2007-07-10 22:38:22 -070057 -Wstrict-prototypes -Wmissing-prototypes \
58 -Wnested-externs -Winline -Wshadow
Andrew Morgancd45c572007-08-13 23:16:50 -070059LD=$(CC) -Wl,-x -shared
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070060LDFLAGS := #-g
Andrew Morgan2c9c0532007-07-10 20:50:21 -070061
Andrew Morgan54f055e2007-07-21 22:18:02 -070062SYSTEM_HEADERS = /usr/include
Andrew Morgan2c9c0532007-07-10 20:50:21 -070063INCS=$(topdir)/libcap/include/sys/capability.h
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070064LDFLAGS += -L$(topdir)/libcap
Torsten Werner7ebd7c52009-09-30 21:23:15 +020065CFLAGS += -Dlinux $(WARNINGS) $(DEBUG)
Andrew G. Morgan953e7f12008-06-02 22:02:01 -070066PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi)
Mike Frysingerf4e98362008-11-17 22:08:30 -080067INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi)
Andrew G. Morgan0a42b492008-10-19 19:37:28 -070068DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi)
Andrew G. Morgan1b5fb7e2008-11-10 18:00:28 -080069LIBATTR := yes
Andrew G. Morgan0a42b492008-10-19 19:37:28 -070070
Andrew Morgan2c9c0532007-07-10 20:50:21 -070071# Global cleanup stuff
72
73LOCALCLEAN=rm -f *~ core
74DISTCLEAN=@find . \( -name '*.orig' -o -name '*.rej' \) | xargs rm -f