Merge ssh://repo.or.cz/srv/git/gfxprim
[gfxprim.git] / gen.mk
blob6cd9b47d1bad71eed2bf13848cc72d83efac5f80
2 # This is makefile rule for generating C sources from python templates
4 ifndef GENHEADERS
5 GENHEADERS=
6 endif
8 ifndef GENSOURCES
9 GENSOURCES=
10 endif
13 # We add these to CSOURCES which is handled in post.mk
15 CSOURCES+=$(GENSOURCES)
18 # Make the genrated headers actually build
20 ALL+=$(GENHEADERS) $(GENSOURCES)
23 # Base common templates location
25 TEMPLATE_DIR=$(TOPDIR)/pylib/templates/
28 # And clean them
30 CLEAN+=$(GENSOURCES) $(GENHEADERS)
33 # Some base dependencies
35 $(GENSOURCES): $(TEMPLATE_DIR)/base.c.t $(TEMPLATE_DIR)/common.c.t
36 $(GENHEADERS): $(TEMPLATE_DIR)/base.h.t
39 # Generated files depend on python generators and the template
41 $(GENSOURCES) $(GENHEADERS): %: %.t
42 ifdef VERBOSE
43 ${PYTHON} ${TOPDIR}/pylib/bin/generate_file.py -t $(TEMPLATE_DIR) "$@.t" "$@"
44 else
45 @echo "GEN $@"
46 @${PYTHON} ${TOPDIR}/pylib/bin/generate_file.py -t $(TEMPLATE_DIR) "$@.t" "$@"
47 endif