File: Makefile

package info (click to toggle)
android-platform-external-libselinux 8.1.0%2Br23-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 33,252 kB
  • sloc: ansic: 142,533; python: 23,929; makefile: 1,760; yacc: 1,367; sh: 1,108; lex: 448; xml: 176
file content (85 lines) | stat: -rw-r--r-- 2,377 bytes parent folder | download
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
85
# Installation directories.
PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
ETCDIR ?= $(DESTDIR)/etc
LOCALEDIR = /usr/share/locale
PAMH ?= $(shell test -f /usr/include/security/pam_appl.h && echo y)
AUDITH ?= $(shell test -f /usr/include/libaudit.h && echo y)
# Enable capabilities to permit newrole to generate audit records.
# This will make newrole a setuid root program.
# The capabilities used are: CAP_AUDIT_WRITE.
AUDIT_LOG_PRIV ?= n
# Enable capabilities to permit newrole to utilitize the pam_namespace module.
# This will make newrole a setuid root program.
# The capabilities used are: CAP_SYS_ADMIN, CAP_CHOWN, CAP_FOWNER and
# CAP_DAC_OVERRIDE. 
NAMESPACE_PRIV ?= n
# If LSPP_PRIV is y, then newrole will be made into setuid root program.
# Enabling this option will force AUDIT_LOG_PRIV and NAMESPACE_PRIV to be y.
LSPP_PRIV ?= n
VERSION = $(shell cat ../VERSION)

CFLAGS ?= -Werror -Wall -W
EXTRA_OBJS =
override CFLAGS += -DVERSION=\"$(VERSION)\" -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
LDLIBS += -lselinux
ifeq ($(PAMH), y)
	override CFLAGS += -DUSE_PAM
	EXTRA_OBJS += hashtab.o
	LDLIBS += -lpam -lpam_misc
else
	override CFLAGS += -D_XOPEN_SOURCE=500
	LDLIBS += -lcrypt
endif
ifeq ($(AUDITH), y)
	override CFLAGS += -DUSE_AUDIT
	LDLIBS += -laudit
endif
ifeq ($(LSPP_PRIV),y)
	override AUDIT_LOG_PRIV=y
	override NAMESPACE_PRIV=y
endif
ifeq ($(AUDIT_LOG_PRIV),y)
	override CFLAGS += -DAUDIT_LOG_PRIV
	IS_SUID=y
endif
ifeq ($(NAMESPACE_PRIV),y)
	override CFLAGS += -DNAMESPACE_PRIV
	IS_SUID=y
endif
ifeq ($(IS_SUID),y)
	MODE := 4555
	LDLIBS += -lcap-ng
else
	MODE := 0555
endif

all: newrole

newrole: newrole.o $(EXTRA_OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

install: all
	test -d $(BINDIR)      || install -m 755 -d $(BINDIR)
	test -d $(ETCDIR)/pam.d || install -m 755 -d $(ETCDIR)/pam.d
	test -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1
	install -m $(MODE) newrole $(BINDIR)
	install -m 644 newrole.1 $(MANDIR)/man1/
ifeq ($(PAMH), y)
	test -d $(ETCDIR)/pam.d || install -m 755 -d $(ETCDIR)/pam.d
ifeq ($(LSPP_PRIV),y)
	install -m 644 newrole-lspp.pamd $(ETCDIR)/pam.d/newrole
else
	install -m 644 newrole.pamd $(ETCDIR)/pam.d/newrole
endif
endif

clean:
	rm -f newrole *.o 

indent:
	../../scripts/Lindent $(wildcard *.[ch])

relabel: install
	/sbin/restorecon $(BINDIR)/newrole