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 | |
| 7 | prefix=/usr |
| 8 | includedir=$(prefix)/include |
| 9 | libdir=$(prefix)/lib |
| 10 | |
| 11 | default: all |
| 12 | |
| 13 | all: |
| 14 | @$(MAKE) -C src |
Jens Axboe | baa8d24 | 2019-01-08 15:48:57 -0700 | [diff] [blame] | 15 | @$(MAKE) -C test |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 16 | |
Jens Axboe | f16b83b | 2019-01-15 11:14:43 -0700 | [diff] [blame^] | 17 | config-host.mak: configure |
| 18 | @if [ ! -e "$@" ]; then \ |
| 19 | echo "Running configure ..."; \ |
| 20 | ./configure; \ |
| 21 | else \ |
| 22 | echo "$@ is out-of-date, running configure"; \ |
| 23 | sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \ |
| 24 | fi |
| 25 | |
| 26 | ifneq ($(MAKECMDGOALS),clean) |
| 27 | include config-host.mak |
| 28 | endif |
| 29 | |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 30 | install: |
| 31 | @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir) |
| 32 | |
| 33 | clean: |
Jens Axboe | f16b83b | 2019-01-15 11:14:43 -0700 | [diff] [blame^] | 34 | @rm -f config-host.mak config-host.h |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 35 | @$(MAKE) -C src clean |
Jens Axboe | baa8d24 | 2019-01-08 15:48:57 -0700 | [diff] [blame] | 36 | @$(MAKE) -C test clean |
Jens Axboe | f93c84e | 2019-01-08 06:51:07 -0700 | [diff] [blame] | 37 | |
| 38 | tag-archive: |
| 39 | @git tag $(TAG) |
| 40 | |
| 41 | create-archive: |
| 42 | @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG) |
| 43 | @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz." |
| 44 | |
| 45 | archive: clean tag-archive create-archive |
| 46 | |
| 47 | srpm: create-archive |
| 48 | $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE) |