1# 2# This is a makefile.am fragment to build Orc code. 3# 4# Define ORC_SOURCE and then include this file, such as: 5# 6# ORC_SOURCE=gstadderorc 7# include $(top_srcdir)/common/orc.mak 8# 9# This fragment will create tmp-orc.c and gstadderorc.h from 10# gstadderorc.orc. 11# 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 16# disabled. 17# 18# Note that this file defines BUILT_SOURCES, so any later usage 19# of BUILT_SOURCES in the Makefile.am that includes this file 20# must use '+='. 21# 22 23 24EXTRA_DIST = $(ORC_SOURCE).orc 25 26ORC_NODIST_SOURCES = tmp-orc.c $(ORC_SOURCE).h 27BUILT_SOURCES = tmp-orc.c $(ORC_SOURCE).h 28 29 30orc-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 34 35orcc_v_gen = $(orcc_v_gen_@AM_V@) 36orcc_v_gen_ = $(orcc_v_gen_@AM_DEFAULT_V@) 37orcc_v_gen_0 = @echo " ORCC $@"; 38 39cp_v_gen = $(cp_v_gen_@AM_V@) 40cp_v_gen_ = $(cp_v_gen_@AM_DEFAULT_V@) 41cp_v_gen_0 = @echo " CP $@"; 42 43if HAVE_ORCC 44tmp-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 46 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 49else 50tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc $(srcdir)/$(ORC_SOURCE)-dist.c 51 $(cp_v_gen)cp $(srcdir)/$(ORC_SOURCE)-dist.c tmp-orc.c 52 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 55endif 56 57clean-local: clean-orc 58.PHONY: clean-orc 59clean-orc: 60 rm -f tmp-orc.c $(ORC_SOURCE).h 61 62dist-hook: dist-hook-orc 63.PHONY: dist-hook-orc 64 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 67dist-hook-orc: tmp-orc.c $(ORC_SOURCE).h 68 $(top_srcdir)/common/gst-indent tmp-orc.c 69 rm -f 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 76 77