mesa: fix api source gen for out-of-tree builds
[mesa.git] / src / mesa / Makefile.am
1 # Copyright © 2012 Intel Corporation
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
9 #
10 # The above copyright notice and this permission notice (including the next
11 # paragraph) shall be included in all copies or substantial portions of the
12 # Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 # IN THE SOFTWARE.
21
22 SUBDIRS = x86 x86-64 . libdricore drivers
23
24 gldir = $(includedir)/GL
25 gl_HEADERS = $(top_srcdir)/include/GL/*.h
26
27 .PHONY: main/git_sha1.h.tmp
28 main/git_sha1.h.tmp:
29 @touch main/git_sha1.h.tmp
30 @if test -d ../../.git; then \
31 if which git > /dev/null; then \
32 git log -n 1 --oneline | \
33 sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \
34 > main/git_sha1.h.tmp ; \
35 fi \
36 fi
37
38 main/git_sha1.h: main/git_sha1.h.tmp
39 @echo "updating main/git_sha1.h"
40 @if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
41 mv main/git_sha1.h.tmp main/git_sha1.h ;\
42 fi
43
44 # include glapi_gen.mk for generating glapi headers for GLES
45 TOP = $(top_srcdir)
46 GLAPI = $(TOP)/src/mapi/glapi/gen
47 include $(GLAPI)/glapi_gen.mk
48
49 BUILT_SOURCES = \
50 main/git_sha1.h \
51 main/api_exec_es1_dispatch.h \
52 main/api_exec_es1_remap_helper.h \
53 main/api_exec_es2_dispatch.h \
54 main/api_exec_es2_remap_helper.h \
55 main/api_exec_es1.c \
56 main/api_exec_es2.c \
57 program/program_parse.tab.c \
58 program/program_parse.tab.h \
59 program/lex.yy.c
60 CLEANFILES = \
61 $(BUILT_SOURCES) \
62 git_sha1.h.tmp
63
64 main/api_exec_es1_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
65 $(call glapi_gen_dispatch,$<,es1)
66
67 main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
68 $(call glapi_gen_remap,$<,es1)
69
70 main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
71
72 main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
73 $(call glapi_gen_dispatch,$<,es2)
74
75 main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
76 $(call glapi_gen_remap,$<,es2)
77
78 main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
79
80 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
81 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \
82 -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
83
84 main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
85 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py \
86 -S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@
87
88 program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
89 $(YACC) -v -d --output=program/program_parse.tab.c $<
90
91 program/lex.yy.c: program/program_lexer.l
92 $(LEX) --never-interactive --outfile=$@ $<
93
94 all-local:
95 $(MAKE) -f Makefile.old
96
97 install-exec-local:
98 $(MAKE) -f Makefile.old install
99
100 clean-local:
101 $(MAKE) -f Makefile.old clean
102
103 pkgconfigdir = $(libdir)/pkgconfig
104
105 if HAVE_OSMESA_DRIVER
106 pkgconfig_DATA = osmesa.pc
107 else
108 pkgconfig_DATA = gl.pc
109 endif