Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 1 | NAME=liburing |
| 2 | SPECFILE=$(NAME).spec |
| 3 | VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE)) |
| 4 | TAG = $(NAME)-$(VERSION) |
| 5 | RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm") |
| 6 | |
Shenghui Wang | 6cd873c | 2019-04-26 11:35:42 +0800 | [diff] [blame] | 7 | INSTALL=install |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 8 | |
| 9 | default: all |
| 10 | |
| 11 | all: |
| 12 | @$(MAKE) -C src |
Jens Axboe | baa8d24 | 2019-01-08 15:48:57 -0700 | [diff] [blame] | 13 | @$(MAKE) -C test |
Jens Axboe | 4916320 | 2019-04-17 17:38:14 +0000 | [diff] [blame] | 14 | @$(MAKE) -C examples |
| 15 | |
Stefan Metzmacher | b57dbc2 | 2020-02-06 18:07:56 +0100 | [diff] [blame] | 16 | partcheck: all |
| 17 | @echo "make partcheck => TODO add tests with out kernel support" |
| 18 | |
Jackie Liu | 2e7d744 | 2019-11-20 11:14:22 +0800 | [diff] [blame] | 19 | runtests: all |
Jens Axboe | 4916320 | 2019-04-17 17:38:14 +0000 | [diff] [blame] | 20 | @$(MAKE) -C test runtests |
Jens Axboe | 4fb3c9e | 2019-10-24 19:19:49 -0600 | [diff] [blame] | 21 | runtests-loop: |
| 22 | @$(MAKE) -C test runtests-loop |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 23 | |
Jens Axboe | f16b83b | 2019-01-15 11:14:43 -0700 | [diff] [blame] | 24 | config-host.mak: configure |
| 25 | @if [ ! -e "$@" ]; then \ |
| 26 | echo "Running configure ..."; \ |
| 27 | ./configure; \ |
| 28 | else \ |
| 29 | echo "$@ is out-of-date, running configure"; \ |
| 30 | sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \ |
| 31 | fi |
| 32 | |
| 33 | ifneq ($(MAKECMDGOALS),clean) |
| 34 | include config-host.mak |
| 35 | endif |
| 36 | |
Stefan Hajnoczi | 9f4714c | 2019-11-05 08:39:16 +0100 | [diff] [blame] | 37 | %.pc: %.pc.in config-host.mak $(SPECFILE) |
Stefan Hajnoczi | 1b049c1 | 2019-05-25 09:58:29 +0100 | [diff] [blame] | 38 | sed -e "s%@prefix@%$(prefix)%g" \ |
| 39 | -e "s%@libdir@%$(libdir)%g" \ |
| 40 | -e "s%@includedir@%$(includedir)%g" \ |
| 41 | -e "s%@NAME@%$(NAME)%g" \ |
| 42 | -e "s%@VERSION@%$(VERSION)%g" \ |
| 43 | $< >$@ |
| 44 | |
| 45 | install: $(NAME).pc |
Stefan Metzmacher | 3e63af4 | 2020-02-07 15:42:12 +0100 | [diff] [blame] | 46 | @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) \ |
| 47 | includedir=$(DESTDIR)$(includedir) \ |
| 48 | libdir=$(DESTDIR)$(libdir) \ |
| 49 | libdevdir=$(DESTDIR)$(libdevdir) \ |
| 50 | relativelibdir=$(relativelibdir) |
Stefan Metzmacher | b57dbc2 | 2020-02-06 18:07:56 +0100 | [diff] [blame] | 51 | $(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdevdir)/pkgconfig/$(NAME).pc |
Shenghui Wang | 6cd873c | 2019-04-26 11:35:42 +0800 | [diff] [blame] | 52 | $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2 |
| 53 | $(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2 |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 54 | |
Johannes Thumshirn | 6e3f6f3 | 2019-11-28 11:26:06 +0100 | [diff] [blame] | 55 | install-tests: |
| 56 | @$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir) |
| 57 | |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 58 | clean: |
Jens Axboe | 26ac732 | 2020-06-15 10:49:27 -0600 | [diff] [blame] | 59 | @rm -f config-host.mak config-host.h cscope.out $(NAME).pc test/*.dmesg |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 60 | @$(MAKE) -C src clean |
Jens Axboe | baa8d24 | 2019-01-08 15:48:57 -0700 | [diff] [blame] | 61 | @$(MAKE) -C test clean |
Weiping Zhang | 2e71982 | 2019-05-22 00:50:13 +0800 | [diff] [blame] | 62 | @$(MAKE) -C examples clean |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 63 | |
Jens Axboe | b080d06 | 2019-03-05 16:19:59 -0700 | [diff] [blame] | 64 | cscope: |
| 65 | @cscope -b -R |
| 66 | |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 67 | tag-archive: |
| 68 | @git tag $(TAG) |
| 69 | |
| 70 | create-archive: |
| 71 | @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG) |
| 72 | @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz." |
| 73 | |
| 74 | archive: clean tag-archive create-archive |
| 75 | |
| 76 | srpm: create-archive |
| 77 | $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE) |