resources/examples/libgit2/Makefile
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 05 Sep 2012 11:13:11 +0000
changeset 25 9718bd0f1028
parent 23 76267fa19138
permissions -rw-r--r--
Style & Makefile fixes for libgit2

GCC_XML=gccxml

XSLTPROC=xsltproc

XML2DEF_XSL=styles/gccxml2def.xsl



LIBGIT2_INCLUDE_DIR=/home/jv/work/libgit2/include
LIBGIT2_HEADERS=git2.h
LIBGIT2_DEFFILES=$(LIBGIT2_HEADERS:%.h=%.h.def)
LIBGIT2_XMLFILES=$(LIBGIT2_HEADERS:%.h=%.h.xml)

XSL_PARAMS=--stringparam c-header-file $<

XSLTPROC_FLAGS=$(XSL_PARAMS)

default: all

all: libgit2.def

xml: $(LIBGIT2_XMLFILES)


libgit2.def:   $(LIBGIT2_DEFFILES)
	cat $(LIBGIT2_DEFFILES) > libgit2.def
	sed -i -e 's/^(struct-foreign git_/(struct git_/g' libgit2.def
	sed -i -e 's/^(struct-foreign _git_oid/(struct _git_oid/g' libgit2.def
	sed -i -e 's/^(typedef-foreign git_/(typedef git_/g' libgit2.def


%.h.def:%.h.xml
	$(XSLTPROC) $(XSLTPROC_FLAGS) -o $@ $(XML2DEF_XSL) $<

%.h.xml: $(LIBGIT2_INCLUDE_DIR)/%.h
	$(GCC_XML) -m32 -I$(LIBGIT2_INCLUDE_DIR) $< -fxml=$@

clean:
	rm -rf *.h.xml *.h.def

distclean: clean
	rm -rf libgit2.def