glsl2: Factor out the variable refcounting part of ir_dead_code.cpp.
[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 glcpp/xtalloc.c
14
15 GLCPP_SOURCES = \
16 $(LIBGLCPP_SOURCES) \
17 glcpp/glcpp.c
18
19 C_SOURCES = \
20 $(LIBGLCPP_SOURCES)
21
22 CXX_SOURCES = \
23 ast_expr.cpp \
24 ast_function.cpp \
25 ast_to_hir.cpp \
26 ast_type.cpp \
27 builtin_function.cpp \
28 glsl_lexer.cpp \
29 glsl_parser.cpp \
30 glsl_parser_extras.cpp \
31 glsl_types.cpp \
32 hir_field_selection.cpp \
33 ir_algebraic.cpp \
34 ir_basic_block.cpp \
35 ir_clone.cpp \
36 ir_constant_expression.cpp \
37 ir_constant_folding.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_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_swizzle_swizzle.cpp \
59 ir_validate.cpp \
60 ir_variable.cpp \
61 ir_variable_refcount.cpp \
62 ir_vec_index_to_cond_assign.cpp \
63 ir_vec_index_to_swizzle.cpp \
64 linker.cpp \
65 link_functions.cpp \
66 s_expression.cpp
67
68 LIBS = \
69 $(TOP)/src/glsl/libglsl.a \
70 $(shell pkg-config --libs talloc)
71
72 APPS = glsl_compiler glcpp/glcpp
73
74 GLSL2_C_SOURCES = \
75 ../mesa/program/hash_table.c \
76 ../mesa/program/symbol_table.c
77 GLSL2_CXX_SOURCES = \
78 main.cpp
79
80 GLSL2_OBJECTS = \
81 $(GLSL2_C_SOURCES:.c=.o) \
82 $(GLSL2_CXX_SOURCES:.cpp=.o)
83
84 ### Basic defines ###
85
86 DEFINES += \
87 $(LIBRARY_DEFINES) \
88 $(API_DEFINES)
89
90 GLCPP_OBJECTS = \
91 $(GLCPP_SOURCES:.c=.o) \
92 ../mesa/program/hash_table.o
93
94 OBJECTS = \
95 $(C_SOURCES:.c=.o) \
96 $(CXX_SOURCES:.cpp=.o)
97
98 INCLUDES = \
99 -I. \
100 -I../mesa \
101 -I../mapi \
102 -I../mesa/program \
103 -I../../include \
104 $(LIBRARY_INCLUDES)
105
106 ALL_SOURCES = \
107 $(C_SOURCES) \
108 $(CXX_SOURCES) \
109 $(GLSL2_CXX_SOURCES) \
110 $(GLSL2_C_SOURCES)
111
112 ##### TARGETS #####
113
114 default: depend lib$(LIBNAME).a $(APPS)
115
116 lib$(LIBNAME).a: $(OBJECTS) Makefile $(TOP)/src/glsl/Makefile.template
117 $(MKLIB) -cplusplus -o $(LIBNAME) -static $(OBJECTS)
118
119 depend: $(ALL_SOURCES) Makefile
120 rm -f depend
121 touch depend
122 $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(ALL_SOURCES) 2> /dev/null
123
124 # Remove .o and backup files
125 clean:
126 rm -f $(OBJECTS) lib$(LIBNAME).a depend depend.bak
127 -rm -f $(APPS)
128
129 # Dummy target
130 install:
131 @echo -n ""
132
133
134 ##### RULES #####
135
136 glsl_compiler: $(GLSL2_OBJECTS) libglsl.a
137 $(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLSL2_OBJECTS) $(LIBS) -o $@
138
139 glcpp/glcpp: $(GLCPP_OBJECTS) libglsl.a
140 $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(GLCPP_OBJECTS) $(LIBS) -o $@
141
142 .cpp.o:
143 $(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
144
145 .c.o:
146 $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
147
148 glsl_lexer.cpp: glsl_lexer.lpp
149 flex --never-interactive --outfile="$@" $<
150
151 glsl_parser.cpp: glsl_parser.ypp
152 bison -v -o "$@" --defines=glsl_parser.h $<
153
154 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
155 flex --never-interactive --outfile="$@" $<
156
157 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
158 bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
159
160 builtin_function.cpp: builtins/*/*
161 ./builtins/tools/generate_builtins.pl > builtin_function.cpp
162
163 -include depend