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 | |
Jens Axboe | a29edc6 | 2020-09-28 16:33:28 -0600 | [diff] [blame] | 16 | .PHONY: all install default clean test |
| 17 | .PHONY: FORCE cscope |
| 18 | |
Stefan Metzmacher | b57dbc2 | 2020-02-06 18:07:56 +0100 | [diff] [blame] | 19 | partcheck: all |
| 20 | @echo "make partcheck => TODO add tests with out kernel support" |
| 21 | |
Jackie Liu | 2e7d744 | 2019-11-20 11:14:22 +0800 | [diff] [blame] | 22 | runtests: all |
Jens Axboe | 4916320 | 2019-04-17 17:38:14 +0000 | [diff] [blame] | 23 | @$(MAKE) -C test runtests |
Jens Axboe | 4fb3c9e | 2019-10-24 19:19:49 -0600 | [diff] [blame] | 24 | runtests-loop: |
| 25 | @$(MAKE) -C test runtests-loop |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 26 | |
Jens Axboe | f16b83b | 2019-01-15 11:14:43 -0700 | [diff] [blame] | 27 | config-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 | |
| 36 | ifneq ($(MAKECMDGOALS),clean) |
| 37 | include config-host.mak |
| 38 | endif |
| 39 | |
Stefan Hajnoczi | 9f4714c | 2019-11-05 08:39:16 +0100 | [diff] [blame] | 40 | %.pc: %.pc.in config-host.mak $(SPECFILE) |
Stefan Hajnoczi | 1b049c1 | 2019-05-25 09:58:29 +0100 | [diff] [blame] | 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 | |
| 48 | install: $(NAME).pc |
Stefan Metzmacher | 3e63af4 | 2020-02-07 15:42:12 +0100 | [diff] [blame] | 49 | @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) \ |
| 50 | includedir=$(DESTDIR)$(includedir) \ |
| 51 | libdir=$(DESTDIR)$(libdir) \ |
| 52 | libdevdir=$(DESTDIR)$(libdevdir) \ |
| 53 | relativelibdir=$(relativelibdir) |
Stefan Metzmacher | b57dbc2 | 2020-02-06 18:07:56 +0100 | [diff] [blame] | 54 | $(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdevdir)/pkgconfig/$(NAME).pc |
Shenghui Wang | 6cd873c | 2019-04-26 11:35:42 +0800 | [diff] [blame] | 55 | $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2 |
| 56 | $(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2 |
Paul Ewing | 71d3dbf | 2020-09-15 22:18:56 -0700 | [diff] [blame] | 57 | $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3 |
| 58 | $(INSTALL) -m 644 man/*.3 $(DESTDIR)$(mandir)/man3 |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 59 | |
Johannes Thumshirn | 6e3f6f3 | 2019-11-28 11:26:06 +0100 | [diff] [blame] | 60 | install-tests: |
| 61 | @$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir) |
| 62 | |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 63 | clean: |
Jens Axboe | 26ac732 | 2020-06-15 10:49:27 -0600 | [diff] [blame] | 64 | @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] | 65 | @$(MAKE) -C src clean |
Jens Axboe | baa8d24 | 2019-01-08 15:48:57 -0700 | [diff] [blame] | 66 | @$(MAKE) -C test clean |
Weiping Zhang | 2e71982 | 2019-05-22 00:50:13 +0800 | [diff] [blame] | 67 | @$(MAKE) -C examples clean |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 68 | |
Jens Axboe | b080d06 | 2019-03-05 16:19:59 -0700 | [diff] [blame] | 69 | cscope: |
| 70 | @cscope -b -R |
| 71 | |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 72 | tag-archive: |
| 73 | @git tag $(TAG) |
| 74 | |
| 75 | create-archive: |
| 76 | @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG) |
| 77 | @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz." |
| 78 | |
| 79 | archive: clean tag-archive create-archive |
| 80 | |
| 81 | srpm: create-archive |
| 82 | $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE) |