X-Git-Url: https://git.llucax.com/software/posixx.git/blobdiff_plain/73a9db44cca62733dc2e8cb8037ed67843843e66..8e9d621e4cf9a60cbf238df92fc60022a1d941cd:/src/Makefile diff --git a/src/Makefile b/src/Makefile index e3563d3..cfea6e6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,9 +1,35 @@ +# Build flags (include general stuff in the .pc file instead) +LOCAL_CFLAGS = +LOCAL_LDFLAGS = + # XXX: The cut pipe is to strip the leading "./" from find results. It's # a little ugly but I couldn't find a better way to get a list of all # headers in the directory (recursively). HEADERS = $(shell find -name '*.hpp' | cut -b3-) HDRPATH = posixx +PCFILE = posixx.pc +PCTEMPLATE = $(PCFILE).template + +# prefix for installing the binaries +prefix = /usr/local + + +# Flags fetched from pkg-config .pc file +ifneq ($(PCTEMPLATE), ) +PKG_LIB = $(shell grep Libs.private: $(PCTEMPLATE) | cut -d' ' -f2-) +PKG_REQ = $(shell grep Requires: $(PCTEMPLATE) | cut -d' ' -f2-) +ifneq ($(PKG_REQ), ) +PKG_REQ_CFLAGS = $(shell pkg-config --cflags $(PKG_REQ)) +PKG_REQ_LDFLAGS = $(shell pkg-config --libs $(PKG_REQ)) +endif +endif + +# XXX: LI_* variables are for internal use only +# (for the super-repository local-install target) +ALL_CFLAGS = $(LOCAL_CFLAGS) $(PKG_REQ_CFLAGS) $(LI_CFLAGS) $(CFLAGS) +ALL_LDFLAGS = $(LOCAL_LDFLAGS) $(PKG_LIB) $(PKG_REQ_LDFLAGS) $(LI_LDFLAGS) \ + $(LDFLAGS) # install command @@ -32,15 +58,23 @@ default: all all: -install: install-headers +$(PCFILE): $(PCTEMPLATE) + @sed 's|PREFIX|$(prefix)|' $< > $@ + +install: install-headers install-pc install-headers: .install-headers-stamp .install-headers-stamp: $(HEADERS) $(call install_files,$^,$(prefix)/include/$(HDRPATH)) +install-pc: .install-pc-stamp + +.install-pc-stamp: $(PCFILE) + $(call install_files,$^,$(prefix)/lib/pkgconfig) + clean: - $(NICE_CLEAN) .*-stamp + $(NICE_CLEAN) $(PCFILE) .*-stamp -.PHONY: default all install install-headers clean +.PHONY: default all install install-headers install-pc clean