blob: cc457bb64579ca1853df1d312db5b31fc4d8339f [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
16runtests:
17 @$(MAKE) -C test runtests
Jens Axboe4fb3c9e2019-10-24 19:19:49 -060018runtests-loop:
19 @$(MAKE) -C test runtests-loop
Jens Axboef93c84e2019-01-08 06:51:07 -070020
Jens Axboef16b83b2019-01-15 11:14:43 -070021config-host.mak: configure
22 @if [ ! -e "$@" ]; then \
23 echo "Running configure ..."; \
24 ./configure; \
25 else \
26 echo "$@ is out-of-date, running configure"; \
27 sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \
28 fi
29
30ifneq ($(MAKECMDGOALS),clean)
31include config-host.mak
32endif
33
Stefan Hajnoczi3af7ea12019-07-24 09:24:47 +010034%.pc: %.pc.in config-host.mak
Stefan Hajnoczi1b049c12019-05-25 09:58:29 +010035 sed -e "s%@prefix@%$(prefix)%g" \
36 -e "s%@libdir@%$(libdir)%g" \
37 -e "s%@includedir@%$(includedir)%g" \
38 -e "s%@NAME@%$(NAME)%g" \
39 -e "s%@VERSION@%$(VERSION)%g" \
40 $< >$@
41
42install: $(NAME).pc
Jens Axboef93c84e2019-01-08 06:51:07 -070043 @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
Stefan Hajnoczi1b049c12019-05-25 09:58:29 +010044 $(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdir)/pkgconfig/$(NAME).pc
Shenghui Wang6cd873c2019-04-26 11:35:42 +080045 $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
46 $(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
Jens Axboef93c84e2019-01-08 06:51:07 -070047
48clean:
Stefan Hajnoczi1b049c12019-05-25 09:58:29 +010049 @rm -f config-host.mak config-host.h cscope.out $(NAME).pc
Jens Axboef93c84e2019-01-08 06:51:07 -070050 @$(MAKE) -C src clean
Jens Axboebaa8d242019-01-08 15:48:57 -070051 @$(MAKE) -C test clean
Weiping Zhang2e719822019-05-22 00:50:13 +080052 @$(MAKE) -C examples clean
Jens Axboef93c84e2019-01-08 06:51:07 -070053
Jens Axboeb080d062019-03-05 16:19:59 -070054cscope:
55 @cscope -b -R
56
Jens Axboef93c84e2019-01-08 06:51:07 -070057tag-archive:
58 @git tag $(TAG)
59
60create-archive:
61 @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
62 @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
63
64archive: clean tag-archive create-archive
65
66srpm: create-archive
67 $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)