1 # 2 ## Optional prefixes: 3 # 4 5 # common 'packaging' directoty 6 7 FAKEROOT=$(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 15 ifndef lib 16 lib=$(shell ldd /usr/bin/ld|egrep "ld-linux|ld.so"|cut -d/ -f2) 17 endif 18 19 ifdef prefix 20 exec_prefix=$(prefix) 21 lib_prefix=$(exec_prefix) 22 inc_prefix=$(lib_prefix) 23 man_prefix=$(prefix)/share 24 else 25 prefix=/usr 26 exec_prefix= 27 lib_prefix=$(exec_prefix) 28 inc_prefix=$(prefix) 29 man_prefix=$(prefix)/share 30 endif 31 32 # Target directories 33 34 MANDIR=$(man_prefix)/man 35 SBINDIR=$(exec_prefix)/sbin 36 INCDIR=$(inc_prefix)/include 37 LIBDIR=$(lib_prefix)/$(lib) 38 PKGCONFIGDIR=$(prefix)/$(lib)/pkgconfig 39 40 # common defines for libcap 41 LIBTITLE=libcap 42 VERSION=2 43 MINOR=24 44 # 45 46 # Compilation specifics 47 48 KERNEL_HEADERS := $(topdir)/libcap/include/uapi 49 IPATH += -fPIC -I$(KERNEL_HEADERS) -I$(topdir)/libcap/include 50 51 CC := gcc 52 CFLAGS := -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 53 BUILD_CC := $(CC) 54 BUILD_CFLAGS := $(CFLAGS) $(IPATH) 55 AR := ar 56 RANLIB := ranlib 57 DEBUG = -g #-DDEBUG 58 WARNINGS=-Wall -Wwrite-strings \ 59 -Wpointer-arith -Wcast-qual -Wcast-align \ 60 -Wstrict-prototypes -Wmissing-prototypes \ 61 -Wnested-externs -Winline -Wshadow 62 LD=$(CC) -Wl,-x -shared 63 LDFLAGS := #-g 64 BUILD_GPERF := $(shell which gperf >/dev/null 2>/dev/null && echo yes) 65 66 SYSTEM_HEADERS = /usr/include 67 INCS=$(topdir)/libcap/include/sys/capability.h 68 LDFLAGS += -L$(topdir)/libcap 69 CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) 70 PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi) 71 INDENT := $(shell if [ -n "$$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi) 72 DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi) 73 LIBATTR := 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 # 83 RAISE_SETFCAP := $(LIBATTR) 84 85 # Global cleanup stuff 86 87 LOCALCLEAN=rm -f *~ core 88 DISTCLEAN=@find . \( -name '*.orig' -o -name '*.rej' \) | xargs rm -f 89