Remove talloc from the make and automake build systems.
[profile/ivi/mesa.git] / src / glsl / Makefile
1 #src/glsl/pp/Makefile
2
3 TOP = ../..
4
5 include $(TOP)/configs/current
6
7 LIBNAME = glsl
8
9 LIBGLCPP_SOURCES = \
10         glcpp/glcpp-lex.c \
11         glcpp/glcpp-parse.c \
12         glcpp/pp.c
13
14 GLCPP_SOURCES = \
15         $(LIBGLCPP_SOURCES) \
16         glcpp/glcpp.c
17
18 C_SOURCES = \
19         strtod.c \
20         ralloc.c \
21         $(LIBGLCPP_SOURCES)
22
23 CXX_SOURCES = \
24         ast_expr.cpp \
25         ast_function.cpp \
26         ast_to_hir.cpp \
27         ast_type.cpp \
28         glsl_lexer.cpp \
29         glsl_parser.cpp \
30         glsl_parser_extras.cpp \
31         glsl_types.cpp \
32         glsl_symbol_table.cpp \
33         hir_field_selection.cpp \
34         ir_basic_block.cpp \
35         ir_clone.cpp \
36         ir_constant_expression.cpp \
37         ir.cpp \
38         ir_expression_flattening.cpp \
39         ir_function_can_inline.cpp \
40         ir_function.cpp \
41         ir_hierarchical_visitor.cpp \
42         ir_hv_accept.cpp \
43         ir_import_prototypes.cpp \
44         ir_print_visitor.cpp \
45         ir_reader.cpp \
46         ir_rvalue_visitor.cpp \
47         ir_set_program_inouts.cpp \
48         ir_validate.cpp \
49         ir_variable.cpp \
50         ir_variable_refcount.cpp \
51         linker.cpp \
52         link_functions.cpp \
53         loop_analysis.cpp \
54         loop_controls.cpp \
55         loop_unroll.cpp \
56         lower_discard.cpp \
57         lower_if_to_cond_assign.cpp \
58         lower_instructions.cpp \
59         lower_jumps.cpp \
60         lower_mat_op_to_vec.cpp \
61         lower_noise.cpp \
62         lower_texture_projection.cpp \
63         lower_variable_index_to_cond_assign.cpp \
64         lower_vec_index_to_cond_assign.cpp \
65         lower_vec_index_to_swizzle.cpp \
66         lower_vector.cpp \
67         opt_algebraic.cpp \
68         opt_constant_folding.cpp \
69         opt_constant_propagation.cpp \
70         opt_constant_variable.cpp \
71         opt_copy_propagation.cpp \
72         opt_dead_code.cpp \
73         opt_dead_code_local.cpp \
74         opt_dead_functions.cpp \
75         opt_discard_simplification.cpp \
76         opt_function_inlining.cpp \
77         opt_if_simplification.cpp \
78         opt_noop_swizzle.cpp \
79         opt_redundant_jumps.cpp \
80         opt_structure_splitting.cpp \
81         opt_swizzle_swizzle.cpp \
82         opt_tree_grafting.cpp \
83         s_expression.cpp
84
85 LIBS = \
86         $(TOP)/src/glsl/libglsl.a
87
88 APPS = glsl_compiler glcpp/glcpp
89
90 GLSL2_C_SOURCES = \
91         ../mesa/program/hash_table.c \
92         ../mesa/program/symbol_table.c
93 GLSL2_CXX_SOURCES = \
94         main.cpp
95
96 GLSL2_OBJECTS = \
97         $(GLSL2_C_SOURCES:.c=.o) \
98         $(GLSL2_CXX_SOURCES:.cpp=.o)
99
100 ### Basic defines ###
101
102 DEFINES += \
103         $(LIBRARY_DEFINES) \
104         $(API_DEFINES)
105
106 GLCPP_OBJECTS = \
107         $(GLCPP_SOURCES:.c=.o) \
108         ../mesa/program/hash_table.o
109
110 OBJECTS = \
111         $(C_SOURCES:.c=.o) \
112         $(CXX_SOURCES:.cpp=.o)
113
114 INCLUDES = \
115         -I. \
116         -I../mesa \
117         -I../mapi \
118         -I../../include \
119         $(LIBRARY_INCLUDES)
120
121 ALL_SOURCES = \
122         $(C_SOURCES) \
123         $(CXX_SOURCES) \
124         $(GLSL2_CXX_SOURCES) \
125         $(GLSL2_C_SOURCES)
126
127 ##### TARGETS #####
128
129 default: depend lib$(LIBNAME).a $(APPS)
130
131 lib$(LIBNAME).a: $(OBJECTS) builtin_function.o Makefile $(TOP)/src/glsl/Makefile.template
132         $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS) builtin_function.o
133
134 depend: $(ALL_SOURCES) Makefile
135         rm -f depend
136         touch depend
137         $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
138
139 # Remove .o and backup files
140 clean:
141         rm -f $(GLCPP_OBJECTS) $(GLSL2_OBJECTS) $(OBJECTS) lib$(LIBNAME).a depend depend.bak builtin_function.cpp builtin_function.o builtin_stubs.o builtin_compiler
142         -rm -f $(APPS)
143
144 # Dummy target
145 install:
146         @echo -n ""
147
148
149 ##### RULES #####
150
151 glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
152         $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
153
154 glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a
155         $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@
156
157 .cpp.o:
158         $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
159
160 .c.o:
161         $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
162
163 glsl_lexer.cpp: glsl_lexer.lpp
164         flex --nounistd -o$@  $<
165
166 glsl_parser.cpp: glsl_parser.ypp
167         bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
168
169 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
170         flex --nounistd -o$@  $<
171
172 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
173         bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
174
175 builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o
176         $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o -o $@
177
178 builtin_function.cpp: builtins/profiles/* builtins/ir/* builtins/tools/generate_builtins.py builtins/tools/texture_builtins.py builtin_compiler
179         @echo Regenerating builtin_function.cpp...
180         $(PYTHON2) $(PYTHON_FLAGS) builtins/tools/generate_builtins.py $(PWD)/builtin_compiler > builtin_function.cpp
181
182 -include depend