2 # This is a makefile.am fragment to build Orc code.
4 # Define ORC_SOURCE and then include this file, such as:
6 # ORC_SOURCE=gstadderorc
7 # include $(top_srcdir)/common/orc.mak
9 # This fragment will create tmp-orc.c and gstadderorc.h from
12 # When 'make dist' is run at the top level, or 'make orc-update'
13 # in a directory including this fragment, the generated source
14 # files will be copied to $(ORC_SOURCE)-dist.[ch]. These files
15 # should be checked in to git, since they are used if Orc is
18 # Note that this file defines BUILT_SOURCES, so any later usage
19 # of BUILT_SOURCES in the Makefile.am that includes this file
24 EXTRA_DIST = $(ORC_SOURCE).orc
26 ORC_NODIST_SOURCES = tmp-orc.c $(ORC_SOURCE).h
27 BUILT_SOURCES = tmp-orc.c $(ORC_SOURCE).h
30 orc-update: tmp-orc.c $(ORC_SOURCE).h
31 $(top_srcdir)/common/gst-indent tmp-orc.c
32 cp tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c
33 cp $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h
35 orcc_v_gen = $(orcc_v_gen_$(V))
36 orcc_v_gen_ = $(orcc_v_gen_$(AM_DEFAULT_VERBOSITY))
37 orcc_v_gen_0 = @echo " ORCC $@";
39 cp_v_gen = $(cp_v_gen_$(V))
40 cp_v_gen_ = $(cp_v_gen_$(AM_DEFAULT_VERBOSITY))
41 cp_v_gen_0 = @echo " CP $@";
44 tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc
45 $(orcc_v_gen)$(ORCC) $(ORCC_FLAGS) --implementation --include glib.h -o tmp-orc.c $(srcdir)/$(ORC_SOURCE).orc
47 $(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc
48 $(orcc_v_gen)$(ORCC) $(ORCC_FLAGS) --header --include glib.h -o $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE).orc
50 tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc $(srcdir)/$(ORC_SOURCE)-dist.c
51 $(cp_v_gen)cp $(srcdir)/$(ORC_SOURCE)-dist.c tmp-orc.c
53 $(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc $(srcdir)/$(ORC_SOURCE)-dist.c
54 $(cp_v_gen)cp $(srcdir)/$(ORC_SOURCE)-dist.h $(ORC_SOURCE).h
57 clean-local: clean-orc
60 rm -f tmp-orc.c $(ORC_SOURCE).h
62 dist-hook: dist-hook-orc
65 # we try and copy updated orc -dist files below, but don't fail if it
66 # doesn't work as the srcdir might not be writable
67 dist-hook-orc: tmp-orc.c $(ORC_SOURCE).h
68 $(top_srcdir)/common/gst-indent tmp-orc.c
70 cmp -s tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c || \
71 cp tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c || true
72 cmp -s $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h || \
73 cp $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h || true
74 cp -p tmp-orc.c $(distdir)/$(ORC_SOURCE)-dist.c
75 cp -p $(ORC_SOURCE).h $(distdir)/$(ORC_SOURCE)-dist.h