-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathMakefile
110 lines (95 loc) · 3.44 KB
/
Makefile
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
include /etc/os-release
# De-quote, if quoted.
OS_ID=$(shell echo $(ID))
OS_VER=$(shell echo $(VERSION_ID))
OS_MAJ=$(shell OS_VER=$(OS_VER) && echo $${OS_VER/.*/})
# RHEL & rebuilds: if we match one of these, we do a version comparison.
ifneq (,$(findstring $(OS_ID),rhel centos rocky almalinux))
# If version 9 or greater, add extra targets
ifeq ($(OS_MAJ),9)
EXTRA_TARGETS?=os-ovs-el9
endif # version 9
endif # RHEL clones
TARGETS?=os-ovs os-swift os-nova os-neutron os-mysql os-glance os-rsync os-rabbitmq os-keepalived os-keystone os-haproxy os-ipxe os-redis os-cinder os-httpd os-gnocchi os-collectd os-virt os-dnsmasq os-octavia os-podman os-rsyslog os-barbican os-logrotate os-certmonger os-timemaster os-ceilometer $(EXTRA_TARGETS)
MODULES?=${TARGETS:=.pp.bz2}
DATADIR?=/usr/share
LOCALDIR?=/usr/share/openstack-selinux/master
INSTALL?=install
MODULE_TYPE?=services
all: ${TARGETS:=.pp.bz2} local_settings.sh
%.pp.bz2: %.pp
@echo Compressing $^ -\> $@
bzip2 -9 $^
%.pp: %.te
make -f ${DATADIR}/selinux/devel/Makefile $@
local_settings.sh: local_settings.sh.in
sed -e 's/@MODULES@/${TARGETS}/' $^ > $@
chmod 0755 $@
clean:
rm -f *~ *.if *.tc *.pp *.pp.bz2 local_settings.sh
rm -rf tmp *.tar.gz
tarball: .git/config
#
# Downloading tarball. Note: this only works if the
# current HEAD matches a previously-pushed tag.
#
@RELEASE=$$(git tag --points-at=$$(git log -1 | awk '/^commit/ { print $$2 }')) ;\
if [ -z "$$RELEASE" ]; then \
echo "Failed. Try 'git tag' first." ;\
else \
rm -f openstack-selinux-$$RELEASE.tar.gz ;\
wget -O openstack-selinux-$$RELEASE.tar.gz \
https://github.com/redhat-openstack/openstack-selinux/archive/$$RELEASE.tar.gz ;\
fi
local-tarball: .git/config
#
# Creating local tarball. Note: this only works if the
# current HEAD matches a tag.
#
@RELEASE=$$(git tag --points-at=$$(git log -1 | awk '/^commit/ { print $$2 }')) ;\
if [ -z "$$RELEASE" ]; then \
echo "Failed. Try 'git tag' first." ;\
else \
TMPDIR=$$(mktemp /tmp/os-XXXXXX) ;\
rm -f openstack-selinux-$$RELEASE.tar.gz ;\
make clean ;\
rm -f $$TMPDIR ;\
mkdir -p $$TMPDIR/openstack-selinux-$$RELEASE ;\
cp -a . $$TMPDIR/openstack-selinux-$$RELEASE ;\
if pushd $$TMPDIR/openstack-selinux-$$RELEASE; then \
rm -rf .git .git* ;\
cd .. ;\
tar -czvf openstack-selinux-$$RELEASE.tar.gz openstack-selinux-$$RELEASE ;\
popd ;\
cp $$TMPDIR/*.tar.gz . ;\
rm -rf $$TMPDIR ;\
else \
false ;\
fi ;\
fi
install:
# Install the setup script
${INSTALL} -d ${LOCALDIR}
${INSTALL} -m 0755 local_settings.sh ${LOCALDIR}
# Install tests
${INSTALL} -d ${LOCALDIR}/tests
${INSTALL} -m 0644 tests/bz* tests/lp* tests/osprh* tests/rdo* ${LOCALDIR}/tests
${INSTALL} -m 0755 tests/check_all ${LOCALDIR}/tests
# Install interfaces
${INSTALL} -d ${DATADIR}/selinux/devel/include/${MODULE_TYPE}
${INSTALL} -m 0644 ${TARGETS:=.if} ${DATADIR}/selinux/devel/include/${MODULE_TYPE}
# Install policy modules
${INSTALL} -d ${DATADIR}/selinux/packages
${INSTALL} -m 0644 ${TARGETS:=.pp.bz2} ${DATADIR}/selinux/packages
# Note: You can't run this in a build system unless the build
# system has access to change the kernel SELinux policies
check:
cd ${LOCALDIR} && ./local_settings.sh ;\
cd ${LOCALDIR}/tests && ./check_all ;\
RET=$$? ;\
cd ${LOCALDIR} && ./local_settings.sh -x ;\
if [[ "$$RET" -ne 0 ]]; then \
/bin/false ;\
else \
/bin/true ;\
fi