xref: /aosp_15_r20/external/liburing/Makefile (revision 25da2bea747f3a93b4c30fd9708b0618ef55a0e6)
1include Makefile.common
2
3RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
4
5INSTALL=install
6
7default: all
8
9all:
10	@$(MAKE) -C src
11	@$(MAKE) -C test
12	@$(MAKE) -C examples
13
14.PHONY: all install default clean test
15.PHONY: FORCE cscope
16
17partcheck: all
18	@echo "make partcheck => TODO add tests with out kernel support"
19
20runtests: all
21	@$(MAKE) -C test runtests
22runtests-loop: all
23	@$(MAKE) -C test runtests-loop
24runtests-parallel: all
25	@$(MAKE) -C test runtests-parallel
26
27config-host.mak: configure
28	@if [ ! -e "$@" ]; then					\
29	  echo "Running configure ...";				\
30	  ./configure;						\
31	else							\
32	  echo "$@ is out-of-date, running configure";		\
33	  sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh;	\
34	fi
35
36ifneq ($(MAKECMDGOALS),clean)
37include config-host.mak
38endif
39
40%.pc: %.pc.in config-host.mak $(SPECFILE)
41	sed -e "s%@prefix@%$(prefix)%g" \
42	    -e "s%@libdir@%$(libdir)%g" \
43	    -e "s%@includedir@%$(includedir)%g" \
44	    -e "s%@NAME@%$(NAME)%g" \
45	    -e "s%@VERSION@%$(VERSION)%g" \
46	    $< >$@
47
48install: $(NAME).pc
49	@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) \
50		includedir=$(DESTDIR)$(includedir) \
51		libdir=$(DESTDIR)$(libdir) \
52		libdevdir=$(DESTDIR)$(libdevdir) \
53		relativelibdir=$(relativelibdir)
54	$(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdevdir)/pkgconfig/$(NAME).pc
55	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
56	$(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
57	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
58	$(INSTALL) -m 644 man/*.3 $(DESTDIR)$(mandir)/man3
59	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man7
60	$(INSTALL) -m 644 man/*.7 $(DESTDIR)$(mandir)/man7
61
62install-tests:
63	@$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir)
64
65clean:
66	@rm -f config-host.mak config-host.h cscope.out $(NAME).pc test/*.dmesg
67	@$(MAKE) -C src clean
68	@$(MAKE) -C test clean
69	@$(MAKE) -C examples clean
70
71cscope:
72	@cscope -b -R
73
74tag-archive:
75	@git tag $(TAG)
76
77create-archive:
78	@git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
79	@echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
80
81archive: clean tag-archive create-archive
82
83srpm: create-archive
84	$(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)
85