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