-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile.am
211 lines (173 loc) · 5.22 KB
/
Makefile.am
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
AUTOMAKE_OPTIONS = foreign
SUBDIRS = . packages/app/ packages/test/
MAINTAINERCLEANFILES = \
aclocal.m4 \
autoconf \
autoheader \
automake \
autoscan.log \
compile \
config.guess \
config.sub \
configure \
configure.scan \
depcomp \
install-sh \
libtool \
libtoolize \
ltmain.sh \
Makefile.in \
missing
EXTRA_DIST = \
autogen.sh \
.bin/check-no-nexus.sh \
.bin/init_nexus.sh \
.bin/init.sh \
.bin/lint.sh \
.bin/npm_install.sh \
.bin/pre-commit.sh \
.bin/render-spec.sh \
.browserslistrc \
rpm/pcs-web-ui.spec.in \
COPYING \
.gitlab-ci.yml \
make/git-version-gen \
README.md \
typos.toml
$(PACKAGE_NAME)-node-modules-$(VERSION).tar.xz\
.version
CLEANFILES = \
$(PACKAGE_NAME)-node-modules-$(VERSION).tar.xz
TARFILES = \
$(PACKAGE_NAME)-$(VERSION).tar.bz2 \
$(PACKAGE_NAME)-$(VERSION).tar.gz \
$(PACKAGE_NAME)-$(VERSION).tar.xz \
$(PACKAGE_NAME)-node-modules-$(VERSION).tar.xz
SPEC = rpm/$(PACKAGE_NAME).spec
NEXUS = "https://repository.engineering.redhat.com/nexus/repository/registry.npmjs.org"
PROJECT_DIR = $(shell pwd)
APP_MODULES_DIR = $(shell realpath ${PROJECT_DIR}/packages/app/node_modules)
APP_SRC = $(abs_top_srcdir)/packages/app
APP_BUILD = $(abs_top_builddir)/packages/app
RPM_DIR = $(abs_top_builddir)/rpm
BUILD_DIR = $(abs_top_builddir)/build
app:
if [ ! -d $(APP_BUILD)/node_modules ]; then \
npm ci --no-progress --prefix $(APP_BUILD); \
fi
@$(abs_top_srcdir)/packages/dev/.bin/dev-server.sh \
${APP_SRC} \
$(APP_BUILD)/node_modules \
$(BUILD_DIR)
build:
if [ "${abs_top_builddir}" != "${abs_top_srcdir}" ]; then \
mkdir -p $(APP_BUILD); \
cp $(APP_SRC)/package-build.json $(APP_BUILD)/package.json; \
cp $(APP_SRC)/package-build-lock.json $(APP_BUILD)/package-lock.json; \
fi
if [ ! -d $(APP_BUILD)/node_modules ]; then \
npm ci --no-progress --prefix $(APP_BUILD); \
fi
$(abs_top_srcdir)/packages/app/.bin/build/main.sh \
${APP_SRC} \
$(APP_BUILD)/node_modules \
$(BUILD_DIR) \
$(PCSD_UNIX_SOCKET)
dev:
@cd ./packages/dev-backend && .bin/dev-backend.sh
test:
@cd ./packages/test && .bin/run-dev-tests.sh
test-modules-prepare:
@cd ./packages/test && npm ci
@cd ./packages/dev-backend && npm ci
ci-cluster-test:
@cd ./packages/test && .bin/run-jest.sh -s -p src/test/realBackend
clean:
rm -rf build
rm -f pcs-web-ui-node-modules-*.tar.xz
init_nexus:
@[ "${NEXUS_CERT_PATH}" ] || ( \
echo "Specify path of nexus certificate via NEXUS_CERT_PATH parameter, please"; \
exit 1 )
@.bin/init_nexus.sh ./packages ${NEXUS} ${NEXUS_CERT_PATH}
init:
@if [ "${NEXUS_REPO}" ] && [ "${NEXUS_REPO}" = "false" ]; then \
echo "Use \`make init NEXUS_REPO=false\` not to use the Nexus repo."; \
.bin/init.sh ${NEXUS}; \
else \
echo "If you will need reinit with the Nexus repo run \`make init\`"
.bin/init.sh
fi
check_sources:
@.bin/check-no-nexus.sh
lint:
@.bin/lint.sh ./packages
fmt:
npx prettier "packages/app/src/" --write
packages/app/node_modules/.bin/eslint --fix --ext .js,.ts,.tsx packages/app/src/
.PHONY: bump-version
bump-version:
@node .bin/bump-version.js $(version)
@packages/app/.bin/package-build/generate.sh packages/app
@git commit -a -m "bump new version ($(version))"
@git tag -a -m "$(version) release" $(version) HEAD
dist-hook:
$(abs_top_srcdir)/packages/app/.bin/package-build/fetch-and-pack.sh \
$(APP_SRC) \
packages/app \
$(PACKAGE_NAME)-node-modules-$(VERSION).tar.xz
echo $(VERSION) > $(distdir)/.tarball-version
echo $(SOURCE_EPOCH) > $(distdir)/source_epoch
install-exec-local:
if ENABLE_STANDALONE
mkdir -p $(DESTDIR)/$(PCSD_WEBUI_DIR)
cp -r $(BUILD_DIR)/for-standalone/* $(DESTDIR)/$(PCSD_WEBUI_DIR)
endif
if ENABLE_COCKPIT
mkdir -p $(DESTDIR)/$(COCKPIT_DIR)/ha-cluster
cp -r $(BUILD_DIR)/for-cockpit/* $(DESTDIR)/$(COCKPIT_DIR)/ha-cluster
endif
clean-local:
if [ "${abs_top_builddir}" != "${abs_top_srcdir}" ]; then \
rm -rf $(APP_BUILD)/node_modules; \
rm -rf $(APP_BUILD)//package*.json; \
rm -rf $(BUILD_DIR); \
rm -f ${abs_top_builddir}/.version; \
fi
generate-package-build:
@packages/app/.bin/package-build/generate.sh packages/app
npm_install:
@.bin/npm_install.sh ./packages
all: build
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@
VERSIONGENOPTS = \
--fallback $(VERSION) .tarball-version .gitarchivever --prefix ""
$(SPEC): $(SPEC).in .version config.status
rm -f $@-t $@
date="`LC_ALL=C $(UTC_DATE_AT)$(SOURCE_EPOCH) "+%a %b %d %Y"`" && \
full_version="`cd $(abs_srcdir); make/git-version-gen $(VERSIONGENOPTS)`" && \
.bin/render-spec.sh \
[email protected] $$full_version "$$date" \
$(PCSD_WEBUI_DIR) $(COCKPIT_DIR) $(PCSD_UNIX_SOCKET) \
> $@-t
chmod a-w $@-t
mv $@-t $@
rm -f $@-t*
RPMBUILDOPTS = \
--define "_sourcedir $(RPM_DIR)" \
--define "_specdir $(RPM_DIR)" \
--define "_builddir $(RPM_DIR)" \
--define "_srcrpmdir $(RPM_DIR)" \
--define "_rpmdir $(RPM_DIR)"
$(TARFILES):
$(MAKE) dist
cp $(TARFILES) $(RPM_DIR)
srpm: clean
$(MAKE) $(SPEC) $(TARFILES)
rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
rpm: clean
$(MAKE) $(SPEC) $(TARFILES)
rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
.PHONY: test build