glsl2: Add a pass for converting if statements to conditional assignment.
[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 C_SOURCES = \
10 glcpp/glcpp.c \
11 glcpp/glcpp-lex.c \
12 glcpp/glcpp-parse.c \
13 glcpp/pp.c \
14 glcpp/xtalloc.c
15
16 CXX_SOURCES = \
17 ast_expr.cpp \
18 ast_function.cpp \
19 ast_to_hir.cpp \
20 ast_type.cpp \
21 builtin_function.cpp \
22 glsl_lexer.cpp \
23 glsl_parser.cpp \
24 glsl_parser_extras.cpp \
25 glsl_types.cpp \
26 hir_field_selection.cpp \
27 ir_basic_block.cpp \
28 ir_clone.cpp \
29 ir_constant_expression.cpp \
30 ir_constant_folding.cpp \
31 ir_constant_variable.cpp \
32 ir_copy_propagation.cpp \
33 ir.cpp \
34 ir_dead_code.cpp \
35 ir_dead_code_local.cpp \
36 ir_div_to_mul_rcp.cpp \
37 ir_expression_flattening.cpp \
38 ir_function_can_inline.cpp \
39 ir_function.cpp \
40 ir_function_inlining.cpp \
41 ir_hierarchical_visitor.cpp \
42 ir_hv_accept.cpp \
43 ir_if_return.cpp \
44 ir_if_simplification.cpp \
45 ir_if_to_cond_assign.cpp \
46 ir_mat_op_to_vec.cpp \
47 ir_mod_to_fract.cpp \
48 ir_print_visitor.cpp \
49 ir_reader.cpp \
50 ir_swizzle_swizzle.cpp \
51 ir_validate.cpp \
52 ir_variable.cpp \
53 ir_vec_index_to_cond_assign.cpp \
54 ir_vec_index_to_swizzle.cpp \
55 linker.cpp \
56 s_expression.cpp
57
58 LIBS = \
59 $(TOP)/src/glsl/libglsl.a \
60 $(shell pkg-config --libs talloc)
61
62 APPS = glsl_compiler
63 GLSL2_C_SOURCES = \
64 ../mesa/shader/hash_table.c \
65 ../mesa/shader/symbol_table.c
66 GLSL2_CXX_SOURCES = \
67 main.cpp
68
69 GLSL2_OBJECTS = \
70 $(GLSL2_C_SOURCES:.c=.o) \
71 $(GLSL2_CXX_SOURCES:.cpp=.o)
72
73 ### Basic defines ###
74
75 OBJECTS = \
76 $(C_SOURCES:.c=.o) \
77 $(CXX_SOURCES:.cpp=.o)
78
79 INCLUDES = \
80 -I. \
81 -I../mesa \
82 -I../mapi \
83 -I../mesa/shader \
84 $(LIBRARY_INCLUDES)
85
86 ALL_SOURCES = \
87 $(C_SOURCES) \
88 $(CXX_SOURCES) \
89 $(GLSL2_CXX_SOURCES) \
90 $(GLSL2_C_SOURCES)
91
92 ##### TARGETS #####
93
94 default: depend lib$(LIBNAME).a $(APPS)
95
96 lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
97 $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS)
98
99 depend: $(ALL_SOURCES) Makefile
100 rm -f depend
101 touch depend
102 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
103
104 # Remove .o and backup files
105 clean:
106 rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
107 -rm -f $(APPS)
108
109 # Dummy target
110 install:
111 @echo -n ""
112
113
114 ##### RULES #####
115
116 glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
117 $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
118
119 .cpp.o:
120 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(LIBRARY_DEFINES) $< -o $@
121
122 .c.o:
123 $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
124
125 glsl_lexer.cpp: glsl_lexer.lpp
126 flex --never-interactive --outfile="$@" $<
127
128 glsl_parser.cpp: glsl_parser.ypp
129 bison -v -o "$@" --defines=glsl_parser.h $<
130
131 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
132 flex --never-interactive --outfile="$@" $<
133
134 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
135 bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
136
137 builtin_function.cpp: builtins/*/*
138 ./builtins/tools/generate_builtins.pl > builtin_function.cpp
139
140 -include depend