forked from oVirt/ovirt-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
132 lines (115 loc) · 4.27 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# ====================================================================
# Copyright 2017 Red Hat, Inc. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ====================================================================
#
# CUSTOMIZATION-BEGIN
#
PACKAGE_NAME=ovirt-ansible-roles
PREFIX=/usr/local
SYSCONF_DIR=$(PREFIX)/etc
DATAROOT_DIR=$(PREFIX)/share
DOC_DIR=$(DATAROOT_DIR)/doc
PKG_DATA_DIR=$(DATAROOT_DIR)/$(PACKAGE_NAME)
PKG_DOC_DIR=$(DATAROOT_DIR)/doc/${PACKAGE_NAME}
PKG_SYSCONF_DIR=$(SYSCONF_DIR)/$(PACKAGE_NAME)
ANSIBLE_DOC_DIR=$(DATAROOT_DIR)/doc/ansible/roles
ANSIBLE_DATA_DIR=${PKG_DATA_DIR}/roles
#
# CUSTOMIZATION-END
#
include version.mak
RPM_VERSION=$(VERSION)
PACKAGE_VERSION=$(VERSION)$(if $(MILESTONE),_$(MILESTONE))
DISPLAY_VERSION=$(PACKAGE_VERSION)
TARBALL=$(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
.SUFFIXES:
.SUFFIXES: .in
.in:
sed \
-e "s|@DATAROOT_DIR@|$(DATAROOT_DIR)|g" \
-e "s|@PKG_DATA_DIR=@|$(PKG_DATA_DIR=)|g" \
-e "s|@RPM_VERSION@|$(RPM_VERSION)|g" \
-e "s|@RPM_RELEASE@|$(RPM_RELEASE)|g" \
-e "s|@PACKAGE_NAME@|$(PACKAGE_NAME)|g" \
-e "s|@PACKAGE_VERSION@|$(PACKAGE_VERSION)|g" \
-e "s|@DISPLAY_VERSION@|$(DISPLAY_VERSION)|g" \
-e "s|@VERSION_MAJOR@|$(VERSION_MAJOR)|g" \
-e "s|@VERSION_MINOR@|$(VERSION_MINOR)|g" \
-e "s|@VERSION_PATCH_LEVEL@|$(VERSION_PATCH_LEVEL)|g" \
$< > $@
.PHONY: ovirt-ansible-roles.spec.in
dist: ovirt-ansible-roles.spec
git ls-files | tar --files-from /proc/self/fd/0 -czf "$(TARBALL)" ovirt-ansible-roles.spec
@echo
@echo For distro specific packaging refer to http://www.ovirt.org/Build_Binary_Package
@echo
copy-recursive:
( cd "$(SOURCEDIR)" && find . -type d -printf '%P\n' ) | while read d; do \
install -d -m 755 "$(TARGETDIR)/$${d}"; \
done
( \
cd "$(SOURCEDIR)" && find . -type f -printf '%P\n' | \
while read f; do echo "$${f}"; done \
) | while read f; do \
src="$(SOURCEDIR)/$${f}"; \
dst="$(TARGETDIR)/$${f}"; \
[ -x "$${src}" ] && MASK=0755 || MASK=0644; \
install -T -m "$${MASK}" "$${src}" "$${dst}"; \
done
copy-doc:
( cd "$(SOURCEDIR)" && find . -maxdepth 1 -type d -printf '%P\n' ) | while read d; do \
install -d -m 755 "$(TARGETDIR)/$${d}"; \
done
( \
cd "$(SOURCEDIR)" && find . -maxdepth 2 -name README.md -type f -printf '%P\n' | \
while read f; do echo "$${f}"; done \
) | while read f; do \
src="$(SOURCEDIR)/$${f}"; \
dst="$(TARGETDIR)/$${f}"; \
[ -x "$${src}" ] && MASK=0755 || MASK=0644; \
install -T -m "$${MASK}" "$${src}" "$${dst}"; \
done
copy-examples:
( cd "$(SOURCEDIR)" && find . -maxdepth 1 -type d -printf '%P\n' ) | while read d; do \
install -d -m 755 "$(TARGETDIR)/$${d}"; \
done
( \
cd "$(SOURCEDIR)" && find . -maxdepth 1 -name '*yml' -type f -printf '%P\n' | \
while read f; do echo "$${f}"; done \
) | while read f; do \
src="$(SOURCEDIR)/$${f}"; \
dst="$(TARGETDIR)/$${f}"; \
[ -x "$${src}" ] && MASK=0755 || MASK=0644; \
install -T -m "$${MASK}" "$${src}" "$${dst}"; \
done
create-license:
cp -f LICENSE "${DESTDIR}$(PKG_DOC_DIR)/"
create-readme:
cp -f README.md "${DESTDIR}$(PKG_DOC_DIR)/"
create-symlink:
mkdir -p ${DESTDIR}$(PKG_DATA_DIR)/playbooks/
ln -fs "$(ANSIBLE_DATA_DIR)" "${DESTDIR}$(PKG_DATA_DIR)/playbooks/"
create-post-tasks:
install -d -m 0755 "$(DESTDIR)$(PKG_SYSCONF_DIR)"
touch "$(DESTDIR)$(PKG_SYSCONF_DIR)/$(POST_TASKS_FILE)"
install: $(NULL)
$(MAKE) copy-recursive SOURCEDIR=roles TARGETDIR="${DESTDIR}$(ANSIBLE_DATA_DIR)"
$(MAKE) copy-recursive SOURCEDIR=playbooks TARGETDIR="${DESTDIR}$(PKG_DATA_DIR)/playbooks"
$(MAKE) copy-doc SOURCEDIR=roles TARGETDIR="${DESTDIR}$(ANSIBLE_DOC_DIR)"
$(MAKE) copy-examples SOURCEDIR=examples TARGETDIR="${DESTDIR}$(PKG_DOC_DIR)/examples"
$(MAKE) create-license
$(MAKE) create-readme
$(MAKE) create-symlink
$(MAKE) create-post-tasks