linker: Add uniform_field_visitor class to process leaf fields of a uniform
[profile/ivi/mesa.git] / src / glsl / Makefile
1
2 #src/glsl/pp/Makefile
3
4 TOP = ../..
5
6 include $(TOP)/configs/current
7
8 LIBNAME = glsl
9
10 LIBGLCPP_SOURCES = \
11         glcpp/glcpp-lex.c \
12         glcpp/glcpp-parse.c \
13         glcpp/pp.c
14
15 GLCPP_SOURCES = \
16         $(LIBGLCPP_SOURCES) \
17         ralloc.c \
18         glcpp/glcpp.c
19
20 C_SOURCES = \
21         strtod.c \
22         ralloc.c \
23         $(LIBGLCPP_SOURCES)
24
25 CXX_SOURCES = \
26         ast_expr.cpp \
27         ast_function.cpp \
28         ast_to_hir.cpp \
29         ast_type.cpp \
30         glsl_lexer.cpp \
31         glsl_parser.cpp \
32         glsl_parser_extras.cpp \
33         glsl_types.cpp \
34         glsl_symbol_table.cpp \
35         hir_field_selection.cpp \
36         ir_basic_block.cpp \
37         ir_clone.cpp \
38         ir_constant_expression.cpp \
39         ir.cpp \
40         ir_expression_flattening.cpp \
41         ir_function_can_inline.cpp \
42         ir_function_detect_recursion.cpp \
43         ir_function.cpp \
44         ir_hierarchical_visitor.cpp \
45         ir_hv_accept.cpp \
46         ir_import_prototypes.cpp \
47         ir_print_visitor.cpp \
48         ir_reader.cpp \
49         ir_rvalue_visitor.cpp \
50         ir_set_program_inouts.cpp \
51         ir_validate.cpp \
52         ir_variable.cpp \
53         ir_variable_refcount.cpp \
54         linker.cpp \
55         link_functions.cpp \
56         link_uniforms.cpp \
57         loop_analysis.cpp \
58         loop_controls.cpp \
59         loop_unroll.cpp \
60         lower_clip_distance.cpp \
61         lower_discard.cpp \
62         lower_if_to_cond_assign.cpp \
63         lower_instructions.cpp \
64         lower_jumps.cpp \
65         lower_mat_op_to_vec.cpp \
66         lower_noise.cpp \
67         lower_texture_projection.cpp \
68         lower_variable_index_to_cond_assign.cpp \
69         lower_vec_index_to_cond_assign.cpp \
70         lower_vec_index_to_swizzle.cpp \
71         lower_vector.cpp \
72         opt_algebraic.cpp \
73         opt_constant_folding.cpp \
74         opt_constant_propagation.cpp \
75         opt_constant_variable.cpp \
76         opt_copy_propagation.cpp \
77         opt_copy_propagation_elements.cpp \
78         opt_dead_code.cpp \
79         opt_dead_code_local.cpp \
80         opt_dead_functions.cpp \
81         opt_discard_simplification.cpp \
82         opt_function_inlining.cpp \
83         opt_if_simplification.cpp \
84         opt_noop_swizzle.cpp \
85         opt_redundant_jumps.cpp \
86         opt_structure_splitting.cpp \
87         opt_swizzle_swizzle.cpp \
88         opt_tree_grafting.cpp \
89         s_expression.cpp
90
91 LIBS = \
92         $(TOP)/src/glsl/libglsl.a
93
94 APPS = glsl_compiler glsl_test glcpp/glcpp
95
96 GLSL2_C_SOURCES = \
97         ../mesa/program/hash_table.c \
98         ../mesa/program/symbol_table.c
99 GLSL2_CXX_SOURCES = \
100         main.cpp \
101         standalone_scaffolding.cpp
102
103 GLSL2_OBJECTS = \
104         $(GLSL2_C_SOURCES:.c=.o) \
105         $(GLSL2_CXX_SOURCES:.cpp=.o)
106
107 TEST_C_SOURCES = \
108         ../mesa/program/hash_table.c \
109         ../mesa/program/symbol_table.c
110
111 TEST_CXX_SOURCES = \
112         standalone_scaffolding.cpp \
113         test.cpp \
114         test_optpass.cpp
115
116 TEST_OBJECTS = \
117         $(TEST_C_SOURCES:.c=.o) \
118         $(TEST_CXX_SOURCES:.cpp=.o)
119
120 ### Basic defines ###
121
122 DEFINES += \
123         $(LIBRARY_DEFINES) \
124         $(API_DEFINES)
125
126 GLCPP_OBJECTS = \
127         $(GLCPP_SOURCES:.c=.o) \
128         ../mesa/program/hash_table.o
129
130 OBJECTS = \
131         $(C_SOURCES:.c=.o) \
132         $(CXX_SOURCES:.cpp=.o)
133
134 DRICORE_OBJ_DIR = obj-visible
135 OBJECTS_DRICORE = $(addprefix $(DRICORE_OBJ_DIR)/,$(OBJECTS))
136
137 INCLUDES = \
138         -I. \
139         -I../mesa \
140         -I../mapi \
141         -I../../include \
142         $(LIBRARY_INCLUDES)
143
144 ALL_SOURCES = \
145         $(C_SOURCES) \
146         $(CXX_SOURCES) \
147         $(GLSL2_CXX_SOURCES) \
148         $(GLSL2_C_SOURCES) \
149         $(TEST_CXX_SOURCES) \
150         $(TEST_C_SOURCES)
151
152 ##### TARGETS #####
153
154 default: depend lib$(LIBNAME).a $(APPS) $(DRICORE_GLSL_LIBS)
155
156 $(TOP)/$(LIB_DIR)/libglsl.so: $(OBJECTS_DRICORE) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
157         $(MKLIB) -o $@ -linker '$(CXX)' -ldflags '$(LDFLAGS)' \
158                 -cplusplus -noprefix \
159                 -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/$@.dylib \
160                 $(OBJECTS_DRICORE) builtin_function.o
161
162 lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
163         $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
164
165 depend: $(ALL_SOURCES) Makefile
166         rm -f depend
167         touch depend
168         $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
169         $(MKDEP) $(MKDEP_OPTIONS) -a -p $(DRICORE_OBJ_DIR)/ $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
170
171 # Remove .o and backup files
172 clean: clean-dricore
173         rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(TEST_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler
174         -rm -f $(APPS)
175
176 clean-dricore:
177         -rm -f $(OBJECTS_DRICORE) $(TOP)/$(LIB_DIR)/libglsl.so libglsl.so
178
179 ifneq (,$(DRICORE_GLSL_LIBS))
180 DRICORE_INSTALL_TARGET = install-dricore
181 endif
182
183 # Dummy target
184 install: $(DRICORE_INSTALL_TARGET)
185         @echo -n ""
186
187 install-dricore: default
188         $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
189         $(INSTALL) -m 755 $(DRICORE_GLSL_LIBS) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
190
191 ##### RULES #####
192
193 glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
194         $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
195
196 glsl_test: $(TEST_OBJECTS) libglsl.a
197         $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(TEST_OBJECTS) $(LIBS) -o $@
198
199 glcpp: glcpp/glcpp
200 glcpp/glcpp: $(GLCPP_OBJECTS)
201         $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) -o $@
202
203 .cpp.o:
204         $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
205
206 .c.o:
207         $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
208
209 $(DRICORE_OBJ_DIR)/%.o : %.cpp
210         @mkdir -p $(dir $@)
211         $(CXX) -c $(INCLUDES) $(DRI_CXXFLAGS) $(DEFINES) $< -o $@
212
213 $(DRICORE_OBJ_DIR)/%.o : %.c
214         @mkdir -p $(dir $@)
215         $(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DEFINES) $< -o $@
216
217 glsl_lexer.cpp: glsl_lexer.ll
218         $(FLEX) --nounistd -o$@  $<
219
220 glsl_parser.cpp: glsl_parser.yy
221         $(BISON) -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
222
223 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
224         $(FLEX) --nounistd -o$@  $<
225
226 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
227         $(BISON) -v -o "$@" --defines=glcpp/glcpp-parse.h $<
228
229 builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o
230         $(APP_CXX) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o -o $@
231
232 builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler
233         @echo Regenerating builtin_function.cpp...
234         $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
235
236 -include depend