• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1NAME=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
7INSTALL=install
8
9default: all
10
11all:
12	@$(MAKE) -C src
13	@$(MAKE) -C test
14	@$(MAKE) -C examples
15
16.PHONY: all install default clean test
17.PHONY: FORCE cscope
18
19partcheck: all
20	@echo "make partcheck => TODO add tests with out kernel support"
21
22runtests: all
23	@$(MAKE) -C test runtests
24runtests-loop:
25	@$(MAKE) -C test runtests-loop
26
27config-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
36ifneq ($(MAKECMDGOALS),clean)
37include config-host.mak
38endif
39
40%.pc: %.pc.in config-host.mak $(SPECFILE)
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
48install: $(NAME).pc
49	@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) \
50		includedir=$(DESTDIR)$(includedir) \
51		libdir=$(DESTDIR)$(libdir) \
52		libdevdir=$(DESTDIR)$(libdevdir) \
53		relativelibdir=$(relativelibdir)
54	$(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdevdir)/pkgconfig/$(NAME).pc
55	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
56	$(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
57	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man3
58	$(INSTALL) -m 644 man/*.3 $(DESTDIR)$(mandir)/man3
59	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man7
60	$(INSTALL) -m 644 man/*.7 $(DESTDIR)$(mandir)/man7
61
62install-tests:
63	@$(MAKE) -C test install prefix=$(DESTDIR)$(prefix) datadir=$(DESTDIR)$(datadir)
64
65clean:
66	@rm -f config-host.mak config-host.h cscope.out $(NAME).pc test/*.dmesg
67	@$(MAKE) -C src clean
68	@$(MAKE) -C test clean
69	@$(MAKE) -C examples clean
70
71cscope:
72	@cscope -b -R
73
74tag-archive:
75	@git tag $(TAG)
76
77create-archive:
78	@git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
79	@echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
80
81archive: clean tag-archive create-archive
82
83srpm: create-archive
84	$(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)
85