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