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