orc.mak: rename from orc.mk
[platform/upstream/gst-common.git] / orc.mak
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
24 EXTRA_DIST = $(ORC_SOURCE).orc
25
26 ORC_NODIST_SOURCES = tmp-orc.c $(ORC_SOURCE).h
27 BUILT_SOURCES = tmp-orc.c $(ORC_SOURCE).h
28
29
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
34         
35
36 if HAVE_ORC
37 tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc
38         $(ORCC) --implementation --include glib.h -o tmp-orc.c $(srcdir)/$(ORC_SOURCE).orc
39
40 $(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc
41         $(ORCC) --header --include glib.h -o $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE).orc
42 else
43 tmp-orc.c: $(srcdir)/$(ORC_SOURCE).orc
44         cp $(srcdir)/$(ORC_SOURCE)-dist.c tmp-orc.c
45
46 $(ORC_SOURCE).h: $(srcdir)/$(ORC_SOURCE).orc
47         cp $(srcdir)/$(ORC_SOURCE)-dist.h $(ORC_SOURCE).h
48 endif
49
50
51 clean-local: clean-orc
52 .PHONY: clean-orc
53 clean-orc:
54         rm -f tmp-orc.c $(ORC_SOURCE).h
55
56 dist-hook: dist-hook-orc
57 .PHONY: dist-hook-orc
58 dist-hook-orc: tmp-orc.c $(ORC_SOURCE).h
59         $(top_srcdir)/common/gst-indent tmp-orc.c
60         rm -f tmp-orc.c~
61         cmp -s tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c || \
62           cp tmp-orc.c $(srcdir)/$(ORC_SOURCE)-dist.c
63         cmp -s $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h || \
64           cp $(ORC_SOURCE).h $(srcdir)/$(ORC_SOURCE)-dist.h
65         cp -p $(srcdir)/$(ORC_SOURCE)-dist.c $(distdir)/
66         cp -p $(srcdir)/$(ORC_SOURCE)-dist.h $(distdir)/
67