blob: 547137d924623f909156d2757df17d146a45bf94 [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
7prefix=/usr
8includedir=$(prefix)/include
9libdir=$(prefix)/lib
10
11default: all
12
13all:
14 @$(MAKE) -C src
Jens Axboebaa8d242019-01-08 15:48:57 -070015 @$(MAKE) -C test
Jens Axboef93c84e2019-01-08 06:51:07 -070016
Jens Axboef16b83b2019-01-15 11:14:43 -070017config-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
26ifneq ($(MAKECMDGOALS),clean)
27include config-host.mak
28endif
29
Jens Axboef93c84e2019-01-08 06:51:07 -070030install:
31 @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
32
33clean:
Jens Axboef16b83b2019-01-15 11:14:43 -070034 @rm -f config-host.mak config-host.h
Jens Axboef93c84e2019-01-08 06:51:07 -070035 @$(MAKE) -C src clean
Jens Axboebaa8d242019-01-08 15:48:57 -070036 @$(MAKE) -C test clean
Jens Axboef93c84e2019-01-08 06:51:07 -070037
38tag-archive:
39 @git tag $(TAG)
40
41create-archive:
42 @git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
43 @echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
44
45archive: clean tag-archive create-archive
46
47srpm: create-archive
48 $(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)