mirror-cockpit-project-cockpit/Makefile.am

189 lines
6.6 KiB
Text
Raw Normal View History

2013-11-01 09:42:29 -08:00
NULL =
CLEANFILES =
dist_noinst_DATA =
man_MANS =
noinst_DATA =
noinst_LIBRARIES =
2013-11-01 09:42:29 -08:00
noinst_PROGRAMS =
PYTHON3 ?= python3
2013-11-01 09:42:29 -08:00
# See https://www.gnu.org/software/make/manual/html_node/Force-Targets.html
FORCE:
# -----------------------------------------------------------------------------
# node_modules/package-lock.json dependency
V_NODE_MODULES = $(V_NODE_MODULES_$(V))
V_NODE_MODULES_ = $(V_NODE_MODULES_$(AM_DEFAULT_VERBOSITY))
V_NODE_MODULES_0 = @V=0
# We want tools/node-modules to run every time package-lock.json is requested
$(srcdir)/package-lock.json: FORCE
$(V_NODE_MODULES) $(srcdir)/tools/node-modules make_package_lock_json
# -----------------------------------------------------------------------------
# make dist
EXTRA_DIST = README.md LICENSES/BSD-3-Clause.txt LICENSES/GPL-3.0.txt LICENSES/LGPL-2.1.txt LICENSES/MIT.txt
build: change approach to versioning Currently, we choose the version number that we use at the time that ./autogen.sh is first run. That means that if you configure your tree and hack on it for a while, making commits as you go, the overly-specific version number will soon be out of date. This version number is the number used when building tarballs for testing. Even switching to old branches on previous versions can result in the version number not being updated. Let's move to automake's suggested approach[1] to dynamic versioning by introducing a `version.m4` file. We write that file from two places: - `./autogen.sh` writes an approximate version number (the last release) appended by +git (eg. "270+git") - from `make dist` we write the value we find in `$(VERSION)` and call autoreconf to update the configure script accordingly The expectation is now that anyone who calls `make dist` should specify the VERSION explicitly. That's two places: - from `tools/make-dist` we specify the full `git describe` style version - from the release workflow we specify the tag name Since the only thing that uses `make dump-dist` anymore is `tools/make-dist`, and since it now provides its own version number, we can drop the rule and print the filename directly. Since we move to `version.m4`-style versioning, our tarballs will no longer contain the `.tarball` file. Finally, since we're going to end up having more tarballs created, with various version numbers, add `cockpit-*.tar.xz` to `CLEANFILES` to help keep things under control. [1] https://www.gnu.org/software/automake/manual/html_node/Rebuilding.html
2022-06-01 00:03:30 -08:00
CLEANFILES += cockpit-*.tar.xz
# We override distdir as we want to dist some git-tracked files and dist/ without explicitly listing.
# The spec also gets patched to declare bundled NPM dependencies.
build: drop tar tricks in dist-hook We use a dist-hook combined with tar for some fairly complicated reasons, constituting one of the most non-obvious corners of the build system. The main reasons for that are: 1) directly adding a list of files in git to EXTRA_DIST is not something that can be done reasonably in make syntax, and particularly when we also need it to work when building from tar 2) (and this is complicated) we support typing `make dist` directly after configuring the package in order to get a .tar release, containing the files built by webpack (which will be implicitly built as a part of `make dist`). We know what files to ship because `webpack-make` writes a set of `Makefile.deps` files, setting the `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS` variables. At the time of the first `make dist` invocation on the freshly-configured project, we immediately call `make distdir-am` which is what invokes webpack-make. However: this invocation of make doesn't get a chance to include the Makefiles that weren't present at the time it was invoked, and as a result, doesn't have access to the final values of `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS`. We've solved this by using `dist-hook` (which gets a fresh recursive make invocation, and a new chance to read the Makefiles.deps). 3) we want to make some minor adjustments to the distdir (adding a .tarball file, adjusting timestamps, etc). Our use of tar is pretty evil here, though, and it breaks badly when combined with out-of-tree builds. It turns out that automake has quite some logic for dealing with VPATH demangling, if only we can get the files that we want to ship into `EXTRA_DIST` at the time of the `make distdir-am` invocation. We achieve this by using our (already existing) `distdir:` target override to gain more control over the `make distdir-am` invocation. The three points above are addressed, as follows: 1) If we're in a git tree, we create (or update) a .committed_files file on `make dist` and pass its contents to be added to `EXTRA_DIST` in the `make distdir-am` invocation. We add this file itself to the dist, avoiding the need to use `find` in the "non-git" case. 2) By adding `$(DISTFILES)` as a dependency of the `distdir:` target, we can be sure our webpack (and other things in parallel) will be built by the time we do the recursive `make distdir-am` invocation. This specifically means that the Makfefile.deps will be available to be included, allowing `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS` to be added to `EXTRA_DIST` in the usual way. 3) We can make our minor adjustments to the distdir directly from the `distdir:` target, after the `make distdir-am` invocation. In addition to working with out-of-tree builds, the new approach is, to my eye, much easier to understand in depth.
2022-03-09 02:38:50 -09:00
EXTRA_DIST += $(EXTRA_FILES)
distdir: $(DISTFILES)
@if [ -e '$(srcdir)/.git' ]; then \
git -C '$(srcdir)' ls-files -x test/reference .fmf .cockpit-ci plans pkg test tools > .extra_dist.tmp && \
build: drop tar tricks in dist-hook We use a dist-hook combined with tar for some fairly complicated reasons, constituting one of the most non-obvious corners of the build system. The main reasons for that are: 1) directly adding a list of files in git to EXTRA_DIST is not something that can be done reasonably in make syntax, and particularly when we also need it to work when building from tar 2) (and this is complicated) we support typing `make dist` directly after configuring the package in order to get a .tar release, containing the files built by webpack (which will be implicitly built as a part of `make dist`). We know what files to ship because `webpack-make` writes a set of `Makefile.deps` files, setting the `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS` variables. At the time of the first `make dist` invocation on the freshly-configured project, we immediately call `make distdir-am` which is what invokes webpack-make. However: this invocation of make doesn't get a chance to include the Makefiles that weren't present at the time it was invoked, and as a result, doesn't have access to the final values of `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS`. We've solved this by using `dist-hook` (which gets a fresh recursive make invocation, and a new chance to read the Makefiles.deps). 3) we want to make some minor adjustments to the distdir (adding a .tarball file, adjusting timestamps, etc). Our use of tar is pretty evil here, though, and it breaks badly when combined with out-of-tree builds. It turns out that automake has quite some logic for dealing with VPATH demangling, if only we can get the files that we want to ship into `EXTRA_DIST` at the time of the `make distdir-am` invocation. We achieve this by using our (already existing) `distdir:` target override to gain more control over the `make distdir-am` invocation. The three points above are addressed, as follows: 1) If we're in a git tree, we create (or update) a .committed_files file on `make dist` and pass its contents to be added to `EXTRA_DIST` in the `make distdir-am` invocation. We add this file itself to the dist, avoiding the need to use `find` in the "non-git" case. 2) By adding `$(DISTFILES)` as a dependency of the `distdir:` target, we can be sure our webpack (and other things in parallel) will be built by the time we do the recursive `make distdir-am` invocation. This specifically means that the Makfefile.deps will be available to be included, allowing `WEBPACK_INPUTS` and `WEBPACK_OUTPUTS` to be added to `EXTRA_DIST` in the usual way. 3) We can make our minor adjustments to the distdir directly from the `distdir:` target, after the `make distdir-am` invocation. In addition to working with out-of-tree builds, the new approach is, to my eye, much easier to understand in depth.
2022-03-09 02:38:50 -09:00
mv .extra_dist.tmp '$(srcdir)/.extra_dist'; fi
$(MAKE) $(AM_MAKEFLAGS) distdir-am EXTRA_FILES="$$(tr '\n' ' ' < $(srcdir)/.extra_dist) .extra_dist"
sed -i "s/[@]VERSION@/$(VERSION)/" "$(distdir)/src/client/org.cockpit_project.CockpitClient.metainfo.xml"
$(srcdir)/tools/fix-spec $(distdir)/tools/cockpit.spec $(VERSION)
sed -i "/^pkgver=/ s/0/$(VERSION)/" "$(distdir)/tools/arch/PKGBUILD"
sed -i "1 s/0/$(VERSION)/" "$(distdir)/tools/debian/changelog"
cp -r "$(srcdir)/dist" "$(srcdir)/runtime-npm-modules.txt" "$(distdir)"
$(srcdir)/tools/adjust-distdir-timestamps "$(distdir)"
@echo ' DIST $(DIST_ARCHIVES)'
build: change approach to versioning Currently, we choose the version number that we use at the time that ./autogen.sh is first run. That means that if you configure your tree and hack on it for a while, making commits as you go, the overly-specific version number will soon be out of date. This version number is the number used when building tarballs for testing. Even switching to old branches on previous versions can result in the version number not being updated. Let's move to automake's suggested approach[1] to dynamic versioning by introducing a `version.m4` file. We write that file from two places: - `./autogen.sh` writes an approximate version number (the last release) appended by +git (eg. "270+git") - from `make dist` we write the value we find in `$(VERSION)` and call autoreconf to update the configure script accordingly The expectation is now that anyone who calls `make dist` should specify the VERSION explicitly. That's two places: - from `tools/make-dist` we specify the full `git describe` style version - from the release workflow we specify the tag name Since the only thing that uses `make dump-dist` anymore is `tools/make-dist`, and since it now provides its own version number, we can drop the rule and print the filename directly. Since we move to `version.m4`-style versioning, our tarballs will no longer contain the `.tarball` file. Finally, since we're going to end up having more tarballs created, with various version numbers, add `cockpit-*.tar.xz` to `CLEANFILES` to help keep things under control. [1] https://www.gnu.org/software/automake/manual/html_node/Rebuilding.html
2022-06-01 00:03:30 -08:00
# Needed to ensure the tarball is correct for $(VERSION) override
dist-hook: $(distdir)/src/cockpit/_version.py
$(distdir)/src/cockpit/_version.py: FORCE
$(PYTHON3) '$(srcdir)'/src/build_backend.py --copy '$(srcdir)' '$(distdir)'
@rm -f $(distdir)/src/cockpit/_version.py
$(AM_V_GEN) echo "__version__ = '$(VERSION)'" > $@
build: change approach to versioning Currently, we choose the version number that we use at the time that ./autogen.sh is first run. That means that if you configure your tree and hack on it for a while, making commits as you go, the overly-specific version number will soon be out of date. This version number is the number used when building tarballs for testing. Even switching to old branches on previous versions can result in the version number not being updated. Let's move to automake's suggested approach[1] to dynamic versioning by introducing a `version.m4` file. We write that file from two places: - `./autogen.sh` writes an approximate version number (the last release) appended by +git (eg. "270+git") - from `make dist` we write the value we find in `$(VERSION)` and call autoreconf to update the configure script accordingly The expectation is now that anyone who calls `make dist` should specify the VERSION explicitly. That's two places: - from `tools/make-dist` we specify the full `git describe` style version - from the release workflow we specify the tag name Since the only thing that uses `make dump-dist` anymore is `tools/make-dist`, and since it now provides its own version number, we can drop the rule and print the filename directly. Since we move to `version.m4`-style versioning, our tarballs will no longer contain the `.tarball` file. Finally, since we're going to end up having more tarballs created, with various version numbers, add `cockpit-*.tar.xz` to `CLEANFILES` to help keep things under control. [1] https://www.gnu.org/software/automake/manual/html_node/Rebuilding.html
2022-06-01 00:03:30 -08:00
$(distdir)/version.m4: FORCE
@rm -f $(distdir)/version.m4
$(AM_V_GEN) echo 'm4_define(VERSION_NUMBER, [$(VERSION)])' > $@
# be careful not to include autotools cache into dist tarballs
build: change approach to versioning Currently, we choose the version number that we use at the time that ./autogen.sh is first run. That means that if you configure your tree and hack on it for a while, making commits as you go, the overly-specific version number will soon be out of date. This version number is the number used when building tarballs for testing. Even switching to old branches on previous versions can result in the version number not being updated. Let's move to automake's suggested approach[1] to dynamic versioning by introducing a `version.m4` file. We write that file from two places: - `./autogen.sh` writes an approximate version number (the last release) appended by +git (eg. "270+git") - from `make dist` we write the value we find in `$(VERSION)` and call autoreconf to update the configure script accordingly The expectation is now that anyone who calls `make dist` should specify the VERSION explicitly. That's two places: - from `tools/make-dist` we specify the full `git describe` style version - from the release workflow we specify the tag name Since the only thing that uses `make dump-dist` anymore is `tools/make-dist`, and since it now provides its own version number, we can drop the rule and print the filename directly. Since we move to `version.m4`-style versioning, our tarballs will no longer contain the `.tarball` file. Finally, since we're going to end up having more tarballs created, with various version numbers, add `cockpit-*.tar.xz` to `CLEANFILES` to help keep things under control. [1] https://www.gnu.org/software/automake/manual/html_node/Rebuilding.html
2022-06-01 00:03:30 -08:00
dist-hook: $(distdir)/configure
$(distdir)/configure: $(distdir)/version.m4
@rm -f $(distdir)/configure
$(AM_V_GEN) autoreconf $(distdir)
@rm -r $(distdir)/autom4te.cache
build: change approach to versioning Currently, we choose the version number that we use at the time that ./autogen.sh is first run. That means that if you configure your tree and hack on it for a while, making commits as you go, the overly-specific version number will soon be out of date. This version number is the number used when building tarballs for testing. Even switching to old branches on previous versions can result in the version number not being updated. Let's move to automake's suggested approach[1] to dynamic versioning by introducing a `version.m4` file. We write that file from two places: - `./autogen.sh` writes an approximate version number (the last release) appended by +git (eg. "270+git") - from `make dist` we write the value we find in `$(VERSION)` and call autoreconf to update the configure script accordingly The expectation is now that anyone who calls `make dist` should specify the VERSION explicitly. That's two places: - from `tools/make-dist` we specify the full `git describe` style version - from the release workflow we specify the tag name Since the only thing that uses `make dump-dist` anymore is `tools/make-dist`, and since it now provides its own version number, we can drop the rule and print the filename directly. Since we move to `version.m4`-style versioning, our tarballs will no longer contain the `.tarball` file. Finally, since we're going to end up having more tarballs created, with various version numbers, add `cockpit-*.tar.xz` to `CLEANFILES` to help keep things under control. [1] https://www.gnu.org/software/automake/manual/html_node/Rebuilding.html
2022-06-01 00:03:30 -08:00
# Various downstream packaging assets
NODE_CACHE = $(CURDIR)/cockpit-node-$(VERSION).tar.xz
$(NODE_CACHE): $(srcdir)/package-lock.json
$(AM_V_GEN) $(srcdir)/tools/node-modules runtime-tar $(NODE_CACHE)
dist-hook: $(distdir)/tools/debian/copyright
# when building from a git checkout, we need to generate the copyright file
# when building from tarball (also separate build tree, dist-git), we can't
# rely on node_modules, so just copy the existing file
$(distdir)/tools/debian/copyright: $(srcdir)/tools/debian/copyright.template $(DIST_STAMP) $(if $(wildcard $(srcdir)/node_modules/.package-lock.json),$(NODE_CACHE))
$(AM_V_GEN) if [ -e "$(srcdir)/node_modules/.package-lock.json" ]; then \
$(srcdir)/tools/build-debian-copyright $< $(NODE_CACHE) > $@; \
else \
cp "$(srcdir)/tools/debian/copyright" $@; \
fi
DISTCHECK_CONFIGURE_FLAGS = --enable-prefix-only $(EXTRA_DISTCHECK_CONFIGURE_FLAGS)
2013-11-01 09:42:29 -08:00
# Validate our AppStream metadata
distcheck-hook::
find $(distdir) -name '*.metainfo.xml' -o -name '*.appdata.xml' | xargs appstream-util validate --nonet
# validate that we don't bundle the embedded patternfly font files, we use them from /static/fonts/
distcheck-hook::
! grep --color=auto -rn "\.\./fonts/OpenSans\|fonts/.*eot\|truetype" $(distdir)/dist
# -----------------------------------------------------------------------------
TESTS = \
test/common/static-code \
$(NULL)
clean-local::
find $(builddir) -name '*.gc??' -delete
find $(srcdir) -name '*.pyc' -delete
# required for running integration tests
node_modules/%: $(srcdir)/package-lock.json
@true
check: export VERBOSE=1
TEST_EXTENSIONS = .sh
VALGRIND = valgrind --trace-children=yes --quiet --error-exitcode=33 --gen-suppressions=all \
$(foreach file,$(wildcard $(srcdir)/tools/*.supp),--suppressions=$(file)) \
--num-callers=16 --leak-check=yes --show-leak-kinds=definite \
--errors-for-leak-kinds=definite --trace-children-skip='*mock*,/bin*,/usr/bin/*,/usr/local/bin'
check-memory:
$(MAKE) LOG_FLAGS="$(VALGRIND)" \
COCKPIT_SKIP_SLOW_TESTS=1 \
$(AM_MAKEFLAGS) check TESTS="$(filter-out test/% bots/%,$(TESTS))"
recheck-memory:
$(MAKE) LOG_FLAGS="$(VALGRIND_ARGS)" \
$(AM_MAKEFLAGS) recheck
# checkout Cockpit's bots for standard test VM images and API to launch them
# must be from main, as only that has current and existing images; but testvm.py API is stable
# support CI testing against a bots change
bots:
test/common/make-bots
.PHONY: rsync
RSYNC_HOST ?= c
RSYNC_DEST ?= $(RSYNC_HOST):/
rsync:
$(MAKE)
$(MAKE) install DESTDIR=tmp/rsync >/dev/null
rsync --recursive --links --checksum --verbose --inplace tmp/rsync/ $(RSYNC_DEST)
# We use these to add conditionally-enabled extra rules
# automake doesn't like mixing `::` and `if`
CHECK_LOCAL_TARGETS =
.PHONY: $(CHECK_LOCAL_TARGETS)
check-local:: $(CHECK_LOCAL_TARGETS)
CLEAN_LOCAL_TARGETS =
.PHONY: $(CLEAN_LOCAL_TARGETS)
clean-local:: $(CLEAN_LOCAL_TARGETS)
INSTALL_DATA_LOCAL_TARGETS =
.PHONY: $(INSTALL_DATA_LOCAL_TARGETS)
install-data-local:: $(INSTALL_DATA_LOCAL_TARGETS)
INSTALL_EXEC_HOOK_TARGETS =
.PHONY: $(INSTALL_EXEC_HOOK_TARGETS)
install-exec-hook:: $(INSTALL_EXEC_HOOK_TARGETS)
UNINSTALL_LOCAL_TARGETS =
.PHONY: $(UNINSTALL_LOCAL_TARGETS)
uninstall-local:: $(UNINSTALL_LOCAL_TARGETS)
# This Makefile includes several variable definitions that must come first
include src/testlib/Makefile.am
2022-01-10 05:02:30 -09:00
include containers/Makefile.am
include containers/flatpak/Makefile.am
include doc/Makefile-doc.am
include doc/Makefile-guide.am
include doc/Makefile-man.am
include pkg/Makefile.am
2022-01-10 05:02:30 -09:00
include po/Makefile.am
include selinux/Makefile.am
include src/Makefile.am
include src/branding/arch/Makefile.am
include src/branding/centos/Makefile.am
include src/branding/debian/Makefile.am
include src/branding/default/Makefile.am
include src/branding/fedora/Makefile.am
include src/branding/opensuse/Makefile.am
include src/branding/rhel/Makefile.am
include src/branding/ubuntu/Makefile.am
include src/client/Makefile.am
include src/common/Makefile-common.am
2022-01-10 05:02:30 -09:00
include src/pam-ssh-add/Makefile.am
include src/session/Makefile-session.am
include src/systemd/Makefile.am
include src/tls/Makefile-tls.am
2022-01-10 05:02:30 -09:00
include src/ws/Makefile-ws.am
include tools/Makefile-tools.am