summaryrefslogtreecommitdiffstats
path: root/src/Makefile.am
blob: 452b494aee056c8bae5947ade4dea952d33acd2d (plain)
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
BUILT_SOURCES =
bin_PROGRAMS =
libexec_PROGRAMS =
libexec_SCRIPTS =
sbin_PROGRAMS =

# -----------------------------------------------------------------------------
#  Python

# Will only be honoured if pytest-timeout plugin is installed
export PYTEST_TIMEOUT = 120

.PHONY: pytest
pytest: $(BUILT_SOURCES) $(DIST_STAMP) $(MANIFESTS)
	$(MAKE) test-server
	cd '$(srcdir)' && abs_builddir='$(abs_builddir)' pytest

.PHONY: pytest-cov
pytest-cov: $(BUILT_SOURCES) $(DIST_STAMP) $(MANIFESTS)
	$(MAKE) test-server
	cd '$(srcdir)' && abs_builddir='$(abs_builddir)' pytest --cov

if !WITH_OLD_BRIDGE
INSTALL_DATA_LOCAL_TARGETS += install-python
install-python:
	@# wheel-based installation with .dist-info.
	@# This needs to work on RHEL8 up through modern Fedora, offline, with
	@# system packages available to the build.
	python3 -m pip install --no-index --force-reinstall --root='$(DESTDIR)/' --prefix='$(prefix)' \
		"$$(python3 '$(srcdir)'/src/build_backend.py --wheel '$(srcdir)' tmp/wheel)"
	mkdir -p $(DESTDIR)$(libexecdir)
	mv -t $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir)/cockpit-askpass

UNINSTALL_LOCAL_TARGETS += uninstall-python
uninstall-python:
	rm -rf tmp/wheel
	rm -f $(DESTDIR)$(libexecdir)/cockpit-askpass
	rm -f $(DESTDIR)$(bindir)/cockpit-bridge
	@# HACK: pip uninstall does not know about --root and --prefix
	rm -r $(DESTDIR)$(prefix)/lib/python*/*-packages/cockpit \
	      $(DESTDIR)$(prefix)/lib/python*/*-packages/cockpit-*.dist-info
endif


# -----------------------------------------------------------------------------
#  C

AM_CPPFLAGS = \
	-I$(top_srcdir)/src \
	-DDATADIR=\"$(datadir)\" \
	-DLIBEXECDIR=\""$(libexecdir)"\" \
	-DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
	$(NULL)

AM_CFLAGS = \
	-std=gnu18 \
	-pthread \
	-Wall \
	-Werror=strict-prototypes \
	-Werror=missing-prototypes \
	-Werror=implicit-function-declaration \
	-Werror=implicit-int \
	-Werror=int-conversion \
	-Werror=old-style-definition \
	-Werror=pointer-arith \
	-Werror=init-self \
	-Werror=format=2 \
	-Werror=return-type \
	-Werror=missing-include-dirs \
	$(NULL)

# -----------------------------------------------------------------------------
#  AppStream metadata
#
%.metainfo.xml: %.metainfo.xml.in
	$(AM_V_GEN) mkdir -p $(dir $@) && msgfmt --xml -d $(top_srcdir)/po --template $< --output $@

metainfodir = ${datarootdir}/metainfo
nodist_metainfo_DATA = \
	src/appstream/org.cockpit-project.cockpit-sosreport.metainfo.xml \
	src/appstream/org.cockpit-project.cockpit-kdump.metainfo.xml \
	src/appstream/org.cockpit-project.cockpit-selinux.metainfo.xml \
	src/appstream/org.cockpit-project.cockpit-storaged.metainfo.xml \
	src/appstream/org.cockpit-project.cockpit-networkmanager.metainfo.xml \
	$(NULL)

metainfo_in = $(patsubst %,%.in,$(nodist_metainfo_DATA))
EXTRA_DIST += $(metainfo_in)
CLEANFILES += $(nodist_metainfo_DATA)