glsl2: Add a pass to strip out noop swizzles.
[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 $(LIBGLCPP_SOURCES)
20
21 CXX_SOURCES = \
22 ast_expr.cpp \
23 ast_function.cpp \
24 ast_to_hir.cpp \
25 ast_type.cpp \
26 builtin_function.cpp \
27 glsl_lexer.cpp \
28 glsl_parser.cpp \
29 glsl_parser_extras.cpp \
30 glsl_types.cpp \
31 hir_field_selection.cpp \
32 ir_algebraic.cpp \
33 ir_basic_block.cpp \
34 ir_clone.cpp \
35 ir_constant_expression.cpp \
36 ir_constant_folding.cpp \
37 ir_constant_propagation.cpp \
38 ir_constant_variable.cpp \
39 ir_copy_propagation.cpp \
40 ir.cpp \
41 ir_dead_code.cpp \
42 ir_dead_code_local.cpp \
43 ir_dead_functions.cpp \
44 ir_div_to_mul_rcp.cpp \
45 ir_explog_to_explog2.cpp \
46 ir_expression_flattening.cpp \
47 ir_function_can_inline.cpp \
48 ir_function.cpp \
49 ir_function_inlining.cpp \
50 ir_hierarchical_visitor.cpp \
51 ir_hv_accept.cpp \
52 ir_if_return.cpp \
53 ir_if_simplification.cpp \
54 ir_if_to_cond_assign.cpp \
55 ir_import_prototypes.cpp \
56 ir_mat_op_to_vec.cpp \
57 ir_mod_to_fract.cpp \
58 ir_noop_swizzle.cpp \
59 ir_print_visitor.cpp \
60 ir_reader.cpp \
61 ir_rvalue_visitor.cpp \
62 ir_set_program_inouts.cpp \
63 ir_structure_splitting.cpp \
64 ir_sub_to_add_neg.cpp \
65 ir_swizzle_swizzle.cpp \
66 ir_tree_grafting.cpp \
67 ir_validate.cpp \
68 ir_variable.cpp \
69 ir_variable_refcount.cpp \
70 ir_vec_index_to_cond_assign.cpp \
71 ir_vec_index_to_swizzle.cpp \
72 linker.cpp \
73 link_functions.cpp \
74 s_expression.cpp
75
76 LIBS = \
77 $(TOP)/src/glsl/libglsl.a \
78 $(shell pkg-config --libs talloc)
79
80 APPS = glsl_compiler glcpp/glcpp
81
82 GLSL2_C_SOURCES = \
83 ../mesa/program/hash_table.c \
84 ../mesa/program/symbol_table.c
85 GLSL2_CXX_SOURCES = \
86 main.cpp
87
88 GLSL2_OBJECTS = \
89 $(GLSL2_C_SOURCES:.c=.o) \
90 $(GLSL2_CXX_SOURCES:.cpp=.o)
91
92 ### Basic defines ###
93
94 DEFINES += \
95 $(LIBRARY_DEFINES) \
96 $(API_DEFINES)
97
98 GLCPP_OBJECTS = \
99 $(GLCPP_SOURCES:.c=.o) \
100 ../mesa/program/hash_table.o
101
102 OBJECTS = \
103 $(C_SOURCES:.c=.o) \
104 $(CXX_SOURCES:.cpp=.o)
105
106 INCLUDES = \
107 -I. \
108 -I../mesa \
109 -I../mapi \
110 -I../../include \
111 $(LIBRARY_INCLUDES)
112
113 ALL_SOURCES = \
114 $(C_SOURCES) \
115 $(CXX_SOURCES) \
116 $(GLSL2_CXX_SOURCES) \
117 $(GLSL2_C_SOURCES)
118
119 ##### TARGETS #####
120
121 default: depend lib$(LIBNAME).a $(APPS)
122
123 lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
124 $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS)
125
126 depend: $(ALL_SOURCES) Makefile
127 rm -f depend
128 touch depend
129 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
130
131 # Remove .o and backup files
132 clean:
133 rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
134 -rm -f $(APPS)
135
136 # Dummy target
137 install:
138 @echo -n ""
139
140
141 ##### RULES #####
142
143 glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
144 $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
145
146 glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a
147 $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@
148
149 .cpp.o:
150 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
151
152 .c.o:
153 $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
154
155 glsl_lexer.cpp: glsl_lexer.lpp
156 flex --nounistd -o$@ $<
157
158 glsl_parser.cpp: glsl_parser.ypp
159 bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
160
161 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
162 flex --nounistd -o$@ $<
163
164 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
165 bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
166
167 builtin_function.cpp: builtins/*/*
168 ./builtins/tools/generate_builtins.pl > builtin_function.cpp
169
170 -include depend