Finished moving and cleaning templates from .py to .t
[gfxprim.git] / gen.mk
blobc5586c683f3b6d71e90f6c1a364dcb3a0baeb649
2 # This is makefile rule for generating C sources from python generators
4 ifndef LIBNAME
5 $(error LIBNAME not defined, fix your library Makefile)
6 endif
8 ifndef GENHEADERS
9 GENHEADERS=
10 endif
12 ifndef GENSOURCES
13 GENSOURCES=
14 endif
17 # Headers go into include/core/
19 INCLUDE_PREFIX=$(TOPDIR)/include/$(LIBNAME)/
20 RGENHEADERS=$(addprefix $(INCLUDE_PREFIX),$(GENHEADERS))
23 # Generate genfiles for generated sources
25 CSOURCES+=$(GENSOURCES)
28 # Make the genrated headers actually build
30 all: $(RGENHEADERS)
31 $(CSOURCES): $(RGENHEADERS)
34 # Base common templates location
36 TEMPLATE_DIR=$(TOPDIR)/pylib/templates/
39 # ALL templates and potential generated files (not generated automatically)
41 ALL_TEMPLATES=$(shell find $(TOPDIR) -name '*.t')
42 ALL_GENERATED=$(basename $(ALL_TEMPLATES))
45 # And clean them
47 CLEAN+=$(ALL_GENERATED)
50 # Generated files depend on python generators and the template
52 $(GENSOURCES) $(RGENHEADERS): %: %.t $(PYTHON_FILES)
53 ifdef VERBOSE
54 ${PYTHON} ${TOPDIR}/pylib/bin/generate_file.py -t $(TEMPLATE_DIR) "$@.t" "$@"
55 else
56 @echo "GEN $@"
57 @${PYTHON} ${TOPDIR}/pylib/bin/generate_file.py -t $(TEMPLATE_DIR) "$@.t" "$@"
58 endif