xref: /aosp_15_r20/external/libcap/Makefile (revision 2810ac1b38eead2603277920c78344c84ddf3aff)
1#
2# Makefile for libcap
3#
4topdir=$(shell pwd)
5include Make.Rules
6
7#
8# flags
9#
10
11all test sudotest install clean: %: %-here
12	$(MAKE) -C libcap $@
13ifneq ($(PAM_CAP),no)
14	$(MAKE) -C pam_cap $@
15endif
16ifeq ($(GOLANG),yes)
17	$(MAKE) -C go $@
18	rm -f cap/go.sum
19endif
20	$(MAKE) -C tests $@
21	$(MAKE) -C progs $@
22	$(MAKE) -C doc $@
23
24all-here:
25
26test-here:
27
28sudotest-here:
29
30install-here:
31
32clean-here:
33	$(LOCALCLEAN)
34
35distclean: clean
36	$(DISTCLEAN)
37	@echo "CONFIRM Go package cap has right version dependency on cap/psx:"
38	for x in $$(find . -name go.mod); do $(BUILD_FGREP) -v "module" $$x | $(BUILD_FGREP) "kernel.org/pub/linux/libs/security/libcap" > /dev/null || continue ; $(BUILD_FGREP) "v$(GOMAJOR).$(VERSION).$(MINOR)" $$x  > /dev/null && continue ; echo "$$x is not updated. Try running: ./gomods.sh v$(GOMAJOR).$(VERSION).$(MINOR)" ; exit 1 ; done
39	@echo "ALL go.mod files updated"
40	@echo "Confirm headers export current version"
41	$(BUILD_FGREP) "#define LIBCAP_MAJOR $(VERSION)" libcap/include/sys/capability.h
42	$(BUILD_FGREP) "#define LIBCAP_MINOR $(MINOR)" libcap/include/sys/capability.h
43	@echo "Now validate that everything is checked in to a clean tree.."
44	test -z "$$(git status --ignored -s)"
45	@echo "All good!"
46
47release: distclean
48	cd .. && ln -s libcap libcap-$(VERSION).$(MINOR) && tar cvf libcap-$(VERSION).$(MINOR).tar --exclude patches libcap-$(VERSION).$(MINOR)/* && rm libcap-$(VERSION).$(MINOR)
49
50ktest: all
51	$(MAKE) -C kdebug test
52
53distcheck: distclean
54	./distcheck.sh
55	$(MAKE) DYNAMIC=no COPTS="-D_FORTIFY_SOURCE=2 -O1 -g" clean test
56	$(MAKE) DYNAMIC=yes clean all test sudotest
57	$(MAKE) DYNAMIC=no COPTS="-O2 -std=c89" clean all test sudotest
58	$(MAKE) PAM_CAP=no CC=musl-gcc clean all test sudotest
59	$(MAKE) CC=clang clean all test sudotest
60	$(MAKE) clean all test sudotest
61	$(MAKE) distclean
62
63morgangodoc:
64	@echo "Now the release is made, you want to remember to run one of:"
65	@echo
66	@echo "  GOPROXY=https://proxy.golang.org GO111MODULE=on go get kernel.org/pub/linux/libs/security/libcap/cap@v$(GOMAJOR).$(VERSION).$(MINOR)"
67	@echo
68	@echo or press the request button on this page:
69	@echo
70	@echo "  https://pkg.go.dev/kernel.org/pub/linux/libs/security/libcap/cap@v$(GOMAJOR).$(VERSION).$(MINOR)"
71	@echo
72	@echo "This will cause a go.dev documentation update."
73
74morganrelease: distcheck
75	@echo "sign the main library tag twice: older DSA key; and newer RSA (kernel.org) key"
76	git tag -u D41A6DF2 -s libcap-$(VERSION).$(MINOR) -m "This is libcap-$(VERSION).$(MINOR)"
77	git tag -u E2CCF3F4 -s libcap-korg-$(VERSION).$(MINOR) -m "This is libcap-$(VERSION).$(MINOR)"
78	@echo "The following are for the Go module tracking."
79	git tag -u D41A6DF2 -s v$(GOMAJOR).$(VERSION).$(MINOR) -m "This is the version tag for the 'libcap' Go base directory associated with libcap-$(VERSION).$(MINOR)."
80	git tag -u D41A6DF2 -s psx/v$(GOMAJOR).$(VERSION).$(MINOR) -m "This is the (stable) version tag for the 'psx' Go package associated with libcap-$(VERSION).$(MINOR)."
81	git tag -u D41A6DF2 -s cap/v$(GOMAJOR).$(VERSION).$(MINOR) -m "This is the (stable) version tag for the 'cap' Go package associated with libcap-$(VERSION).$(MINOR)."
82	$(MAKE) release
83	@echo "sign the tar file using korg key"
84	cd .. && gpg -sba -u E2CCF3F4 libcap-$(VERSION).$(MINOR).tar
85	$(MAKE) morgangodoc
86