2 # Build flags (include general stuff in the .pc file instead)
6 # XXX: The cut pipe is to strip the leading "./" from find results. It's
7 # a little ugly but I couldn't find a better way to get a list of all
8 # headers in the directory (recursively).
9 HEADERS = $(shell find -name '*.hpp' | cut -b3-)
12 PCTEMPLATE = $(PCFILE).template
14 # prefix for installing the binaries
18 # Flags fetched from pkg-config .pc file
19 ifneq ($(PCTEMPLATE), )
20 PKG_LIB = $(shell grep Libs.private: $(PCTEMPLATE) | cut -d' ' -f2-)
21 PKG_REQ = $(shell grep Requires: $(PCTEMPLATE) | cut -d' ' -f2-)
23 PKG_REQ_CFLAGS = $(shell pkg-config --cflags $(PKG_REQ))
24 PKG_REQ_LDFLAGS = $(shell pkg-config --libs $(PKG_REQ))
28 # XXX: LI_* variables are for internal use only
29 # (for the super-repository local-install target)
30 ALL_CFLAGS = $(LOCAL_CFLAGS) $(PKG_REQ_CFLAGS) $(LI_CFLAGS) $(CFLAGS)
31 ALL_LDFLAGS = $(LOCAL_LDFLAGS) $(PKG_LIB) $(PKG_REQ_LDFLAGS) $(LI_LDFLAGS) \
36 INSTALL = install -p -m 0644 -D
39 # install utility functions
40 install_msg = echo " INSTALL $(1)"
42 install_files = @$(call install_msg,$(2)) && \
44 $(call install,$$f,$(2)/$$f); \
49 NICE_CLEAN = @echo " CLEAN"; $(RM)
50 install = $(INSTALL) $(1) $(2)
53 install = $(call install_msg,$(2)); $(INSTALL) $(1) $(2)
61 $(PCFILE): $(PCTEMPLATE)
62 @sed 's|PREFIX|$(prefix)|' $< > $@
64 install: install-headers install-pc
66 install-headers: .install-headers-stamp
68 .install-headers-stamp: $(HEADERS)
69 $(call install_files,$^,$(prefix)/include/$(HDRPATH))
71 install-pc: .install-pc-stamp
73 .install-pc-stamp: $(PCFILE)
74 $(call install_files,$^,$(prefix)/lib/pkgconfig)
77 $(NICE_CLEAN) $(PCFILE) .*-stamp
79 .PHONY: default all install install-headers install-pc clean