07fcf96488366ddf535e71c9100fc78aa2b7c11a
[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 if CROSS_COMPILING
23 SUBDIRS = builtin_compiler glcpp
24 else
25 SUBDIRS = glcpp
26 endif
27
28 AM_CPPFLAGS = \
29 -I$(top_srcdir)/include \
30 -I$(top_srcdir)/src/mapi \
31 -I$(top_srcdir)/src/mesa/ \
32 $(DEFINES) \
33 $(API_DEFINES)
34 AM_CFLAGS = $(VISIBILITY_CFLAGS)
35 AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
36
37 AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
38
39 include Makefile.sources
40
41 noinst_LTLIBRARIES = libglsl.la
42 check_PROGRAMS = glsl_test
43
44 libglsl_la_SOURCES = \
45 glsl_lexer.ll \
46 glsl_parser.cc \
47 $(LIBGLSL_FILES) \
48 builtin_function.cpp
49
50 libglsl_la_LIBADD = glcpp/libglcpp.la
51 libglsl_la_LDFLAGS =
52
53 glsl_test_SOURCES = \
54 $(top_srcdir)/src/mesa/main/hash_table.c \
55 $(top_srcdir)/src/mesa/program/prog_hash_table.c \
56 $(top_srcdir)/src/mesa/program/symbol_table.c \
57 $(GLSL_SRCDIR)/standalone_scaffolding.cpp \
58 test.cpp \
59 test_optpass.cpp
60
61 glsl_test_LDADD = libglsl.la
62
63 if CROSS_COMPILING
64 BUILTIN_COMPILER = builtin_compiler/builtin_compiler$(BUILD_EXEEXT)
65 else
66 BUILTIN_COMPILER = builtincompiler$(BUILD_EXEEXT)
67
68 noinst_PROGRAMS = builtincompiler
69 noinst_LTLIBRARIES += libglslcore.la
70
71 libglslcore_la_SOURCES = \
72 glsl_lexer.ll \
73 glsl_parser.cc \
74 $(LIBGLSL_FILES)
75 builtincompiler_SOURCES = \
76 $(top_srcdir)/src/mesa/main/hash_table.c \
77 $(top_srcdir)/src/mesa/program/prog_hash_table.c\
78 $(top_srcdir)/src/mesa/program/symbol_table.c \
79 $(top_srcdir)/src/glsl/builtin_compiler/builtin_stubs.cpp \
80 $(GLSL_COMPILER_CXX_FILES)
81 builtincompiler_LDADD = libglslcore.la glcpp/libglcpp.la
82 endif
83
84 # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
85 # made by yacc. To work with both, we write our own rule rather than using automake's.
86 # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
87 # the automake rule.
88 glsl_parser.cc glsl_parser.h: glsl_parser.yy
89 $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
90
91 BUILT_SOURCES = glsl_parser.h
92 CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) builtin_function.cpp
93
94 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)
95 $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py $(builddir)/$(BUILTIN_COMPILER) > builtin_function.cpp || rm -f builtin_function.cpp