mirror of
https://github.com/openharmony/third_party_liburing.git
synced 2026-07-01 06:41:58 -04:00
1b049c1265
pkg-config (https://pkgconfig.freedesktop.org/) makes it easier to build applications that have library dependencies. Libraries ship .pc files containing the compiler and linker flags needed to build successfully. This saves applications from hardcoding these details into their build scripts, especially when these details can change between operating systems or distributions. To build a liburing application: gcc $(pkg-config --cflags --libs liburing) -o myapp myapp.c Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
70 lines
1.7 KiB
Makefile
70 lines
1.7 KiB
Makefile
NAME=liburing
|
|
SPECFILE=$(NAME).spec
|
|
VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
|
|
TAG = $(NAME)-$(VERSION)
|
|
RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
|
|
|
|
INSTALL=install
|
|
prefix ?= /usr
|
|
includedir=$(prefix)/include
|
|
libdir=$(prefix)/lib
|
|
mandir=$(prefix)/man
|
|
|
|
default: all
|
|
|
|
all:
|
|
@$(MAKE) -C src
|
|
@$(MAKE) -C test
|
|
@$(MAKE) -C examples
|
|
|
|
runtests:
|
|
@$(MAKE) -C test runtests
|
|
|
|
config-host.mak: configure
|
|
@if [ ! -e "$@" ]; then \
|
|
echo "Running configure ..."; \
|
|
./configure; \
|
|
else \
|
|
echo "$@ is out-of-date, running configure"; \
|
|
sed -n "/.*Configured with/s/[^:]*: //p" "$@" | sh; \
|
|
fi
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
include config-host.mak
|
|
endif
|
|
|
|
%.pc: %.pc.in
|
|
sed -e "s%@prefix@%$(prefix)%g" \
|
|
-e "s%@libdir@%$(libdir)%g" \
|
|
-e "s%@includedir@%$(includedir)%g" \
|
|
-e "s%@NAME@%$(NAME)%g" \
|
|
-e "s%@VERSION@%$(VERSION)%g" \
|
|
$< >$@
|
|
|
|
install: $(NAME).pc
|
|
@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
|
|
$(INSTALL) -D -m 644 $(NAME).pc $(DESTDIR)$(libdir)/pkgconfig/$(NAME).pc
|
|
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man2
|
|
$(INSTALL) -m 644 man/*.2 $(DESTDIR)$(mandir)/man2
|
|
|
|
clean:
|
|
@rm -f config-host.mak config-host.h cscope.out $(NAME).pc
|
|
@$(MAKE) -C src clean
|
|
@$(MAKE) -C test clean
|
|
@$(MAKE) -C examples clean
|
|
|
|
cscope:
|
|
@cscope -b -R
|
|
|
|
tag-archive:
|
|
@git tag $(TAG)
|
|
|
|
create-archive:
|
|
@git archive --prefix=$(NAME)-$(VERSION)/ -o $(NAME)-$(VERSION).tar.gz $(TAG)
|
|
@echo "The final archive is ./$(NAME)-$(VERSION).tar.gz."
|
|
|
|
archive: clean tag-archive create-archive
|
|
|
|
srpm: create-archive
|
|
$(RPMBUILD) --define "_sourcedir `pwd`" --define "_srcrpmdir `pwd`" --nodeps -bs $(SPECFILE)
|