blob: c761604254fb345caf27ba0284d8c0127507c39c [file] [log] [blame]
Jens Axboef93c84e2019-01-08 06:51:07 -07001NAME=liburing
2SPECFILE=$(NAME).spec
3VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
4TAG = $(NAME)-$(VERSION)
5RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
6
Shenghui Wang6cd873c2019-04-26 11:35:42 +08007INSTALL=install
Jens Axboef93c84e2019-01-08 06:51:07 -07008
9default: all
10
11all:
12 @$(MAKE) -C src
Jens Axboebaa8d242019-01-08 15:48:57 -070013 @$(MAKE) -C test
Jens Axboe49163202019-04-17 17:38:14 +000014 @$(MAKE) -C examples
15
Jens Axboea29edc62020-09-28 16:33:28 -060016.PHONY: all install default clean test
17.PHONY: FORCE cscope
18
Stefan Metzmacherb57dbc22020-02-06 18:07:56 +010019partcheck: all
20 @echo "make partcheck => TODO add tests with out kernel support"
21
Jackie Liu2e7d7442019-11-20 11:14:22 +080022runtests: all
Jens Axboe49163202019-04-17 17:38:14 +000023 @$(MAKE) -C test runtests
Jens Axboe4fb3c9e2019-10-24 19:19:49 -060024runtests-loop:
25 @$(MAKE) -C test runtests-loop
Jens Axboef93c84e2019-01-08 06:51:07 -070026
Jens Axboef16b83b2019-01-15 11:14:43 -070027config-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
Stefan Hajnoczi9f4714c2019-11-05 08:39:16 +010040%.pc: %.pc.in config-host.mak $(SPECFILE)
Stefan Hajnoczi1b049c12019-05-25 09:58:29 +010041 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
Stefan Metzmacher3e63af42020-02-07 15:42:12 +010049 @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) \
50 includedir=$(DESTDIR)$(includedir) \
51 libdir=$(DESTDIR)$(libdir) \
52 libdevdir=$(DESTDIR)$(libdevdir) \
53 relativelibdir=$(relativelibdir)
Stefan Metzmacherb57dbc22020-02-06 18:07:56 +010054 $(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdevdir)/pkgconfig/$(NAME).pc
Shenghui Wang6cd873c2019-04-26 11:35:42 +080055 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
56 $(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
Paul Ewing71d3dbf2020-09-15 22:18:56 -070057 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
58 $(INSTALL) -m 644 man/*.3 $(DESTDIR)$(mandir)/man3
Jens Axboef93c84e2019-01-08 06:51:07 -070059
Johannes Thumshirn6e3f6f32019-11-28 11:26:06 +010060install-tests:
61 @$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir)
62
Jens Axboef93c84e2019-01-08 06:51:07 -070063clean:
Jens Axboe26ac7322020-06-15 10:49:27 -060064 @rm -f config-host.mak config-host.h cscope.out $(NAME).pc test/*.dmesg
Jens Axboef93c84e2019-01-08 06:51:07 -070065 @$(MAKE) -C src clean
Jens Axboebaa8d242019-01-08 15:48:57 -070066 @$(MAKE) -C test clean
Weiping Zhang2e719822019-05-22 00:50:13 +080067 @$(MAKE) -C examples clean
Jens Axboef93c84e2019-01-08 06:51:07 -070068
Jens Axboeb080d062019-03-05 16:19:59 -070069cscope:
70 @cscope -b -R
71
Jens Axboef93c84e2019-01-08 06:51:07 -070072tag-archive:
73 @git tag $(TAG)
74
75create-archive:
76 @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
77 @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
78
79archive: clean tag-archive create-archive
80
81srpm: create-archive
82 $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)