glsl: Make a function to express a GLSL version ir human-readable form.
[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 SUBDIRS = builtin_compiler glcpp
23
24 AM_CPPFLAGS = \
25 -I$(top_srcdir)/include \
26 -I$(top_srcdir)/src/mapi \
27 -I$(top_srcdir)/src/mesa/ \
28 $(LIBRARY_INCLUDES) \
29 $(DEFINES) \
30 $(LIBRARY_DEFINES) \
31 $(API_DEFINES)
32 AM_CFLAGS = $(VISIBILITY_CFLAGS)
33 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
34
35 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
36
37 include Makefile.sources
38
39 noinst_LTLIBRARIES = libglsl.la
40 noinst_PROGRAMS = glsl_compiler glsl_test
41
42 libglsl_la_SOURCES = \
43 glsl_lexer.ll \
44 glsl_parser.cc \
45 $(LIBGLSL_FILES) \
46 builtin_function.cpp
47
48 libglsl_la_LIBADD = glcpp/libglcpp.la
49 libglsl_la_LDFLAGS =
50
51 glsl_compiler_SOURCES = \
52 $(top_srcdir)/src/mesa/program/hash_table.c \
53 $(top_srcdir)/src/mesa/program/symbol_table.c \
54 $(GLSL_COMPILER_CXX_FILES)
55
56 glsl_compiler_LDADD = libglsl.la
57
58 glsl_test_SOURCES = \
59 $(top_srcdir)/src/mesa/program/hash_table.c \
60 $(top_srcdir)/src/mesa/program/symbol_table.c \
61 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
62 test.cpp \
63 test_optpass.cpp
64
65 glsl_test_LDADD = libglsl.la
66
67 # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
68 # made by yacc. To work with both, we write our own rule rather than using automake's.
69 # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
70 # the automake rule.
71 glsl_parser.cc glsl_parser.h: glsl_parser.yy
72 $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
73
74 BUILT_SOURCES = glsl_parser.h
75 CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) builtin_function.cpp
76
77 builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
78 $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > builtin_function.cpp || rm -f builtin_function.cpp
79
80 # Provide compatibility with scripts for the old Mesa build system for
81 # a while by putting a link to the library in the current directory.
82 all-local: libglsl.la
83 ln -f .libs/libglsl.a .
84
85 CLEANFILES += libglsl.a