glsl: Assign locations for uniforms in UBOs using the std140 rules.
[profile/ivi/mesa.git] / src / glsl / Makefile.am
1 # Copyright © 2012 Jon TURNEY
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
23 # builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
24 # For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
25
26 # Hack to make some of the non-automake variables work.
27 TOP=$(top_builddir)
28
29 AM_CFLAGS = \
30         -I$(top_srcdir)/include \
31         -I$(top_srcdir)/src/mapi \
32         -I$(top_srcdir)/src/mesa/ \
33         $(LIBRARY_INCLUDES) \
34         $(DEFINES) \
35         $(LIBRARY_DEFINES) \
36         $(API_DEFINES)
37
38 AM_CXXFLAGS = $(AM_CFLAGS)
39
40 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
41
42 GLSL_SRCDIR=$(top_srcdir)/src/glsl
43 include Makefile.sources
44
45 noinst_LTLIBRARIES = libglslcommon.la libglsl.la
46 noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler
47
48 # common sources for builtin_compiler and libglsl
49 libglslcommon_la_SOURCES = \
50         glsl_lexer.ll \
51         glsl_parser.cc \
52         $(LIBGLSL_FILES) \
53         $(LIBGLSL_CXX_FILES)
54
55 libglslcommon_la_LIBADD = glcpp/libglcpp.la
56
57 # common sources for builtin_compiler and glsl_compiler
58 GLSL2_SOURCES = \
59         $(top_srcdir)/src/mesa/program/hash_table.c \
60         $(top_srcdir)/src/mesa/program/symbol_table.c \
61         $(GLSL_COMPILER_CXX_FILES)
62
63 libglsl_la_SOURCES = \
64         builtin_function.cpp
65
66 libglsl_la_LIBADD = libglslcommon.la
67 libglsl_la_LDFLAGS =
68
69 glsl_compiler_SOURCES = \
70         $(GLSL2_SOURCES)
71
72 glsl_compiler_LDADD = libglsl.la
73
74 glsl_test_SOURCES = \
75         $(top_srcdir)/src/mesa/program/hash_table.c \
76         $(top_srcdir)/src/mesa/program/symbol_table.c \
77         $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
78         test.cpp \
79         test_optpass.cpp
80
81 glsl_test_LDADD = libglsl.la
82
83 builtin_compiler_SOURCES = \
84         $(GLSL2_SOURCES) \
85         builtin_stubs.cpp
86
87 builtin_compiler_LDADD = libglslcommon.la
88
89 # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
90 # made by yacc.  To work with both, we write our own rule rather than using automake's.
91 # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
92 # the automake rule.
93 glsl_parser.cc glsl_parser.h: glsl_parser.yy
94         $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
95
96 BUILT_SOURCES = glsl_parser.h builtin_function.cpp
97 CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
98
99 builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/glsl/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
100         $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
101
102 glcpp/libglcpp.la:
103         cd glcpp ; $(MAKE) $(AM_MAKEFLAGS)
104
105 SUBDIRS = glcpp
106
107 # Provide compatibility with scripts for the old Mesa build system for
108 # a while by putting a link to the library in the current directory.
109 all-local: libglsl.la
110         ln -f .libs/libglsl.a .
111
112 CLEANFILES += libglsl.a