Merge branch 'mesa_7_7_branch'
[mesa.git] / src / mesa / es / Makefile
1 # src/mesa/es/Makefile
2 #
3 TOP := ../../..
4 MESA := ..
5
6 include $(TOP)/configs/current
7 include sources.mak
8
9 ES1_LIBS := libes1gallium.a libes1api.a
10 ES2_LIBS := libes2gallium.a libes2api.a
11
12 # Default rule: create ES1 and ES2 libs
13 .PHONY: default es1 es2
14 default: depend es1 es2
15
16 es1: $(ES1_LIBS)
17 @rm -f subdirs-stamp-tmp
18
19 es2: $(ES2_LIBS)
20 @rm -f subdirs-stamp-tmp
21
22 # force the inclusion of es's mfeatures.h
23 ES1_CPPFLAGS := -include main/mfeatures_es1.h -D__GL_EXPORTS
24 ES2_CPPFLAGS := -include main/mfeatures_es2.h -D__GL_EXPORTS
25
26 ES1_OBJ_DIR := objs-es1
27 ES2_OBJ_DIR := objs-es2
28
29 # adjust output dirs
30 ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_OBJECTS))
31 ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_GALLIUM_OBJECTS))
32 ES1_API_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_API_OBJECTS))
33
34 ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_OBJECTS))
35 ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_GALLIUM_OBJECTS))
36 ES2_API_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_API_OBJECTS))
37
38 # compile either ES1 or ES2 sources
39 define es-compile
40 @mkdir -p $(dir $@)
41 $(CC) -c $(CFLAGS) $(ES$(1)_CPPFLAGS) $(ES$(1)_INCLUDES) -o $@ $<
42 endef
43
44 $(ES1_OBJ_DIR)/%.o: %.c
45 $(call es-compile,1)
46
47 $(ES1_OBJ_DIR)/%.o: %.S
48 $(call es-compile,1)
49
50 $(ES1_OBJ_DIR)/%.o: $(MESA)/%.c
51 $(call es-compile,1)
52
53 $(ES1_OBJ_DIR)/%.o: $(MESA)/%.S
54 $(call es-compile,1)
55
56 $(ES2_OBJ_DIR)/%.o: %.c
57 $(call es-compile,2)
58
59 $(ES2_OBJ_DIR)/%.o: %.S
60 $(call es-compile,2)
61
62 $(ES2_OBJ_DIR)/%.o: $(MESA)/%.c
63 $(call es-compile,2)
64
65 $(ES2_OBJ_DIR)/%.o: $(MESA)/%.S
66 $(call es-compile,2)
67
68 libes1.a: $(ES1_OBJECTS) $(GLSL_LIBS)
69 @$(MKLIB) -o es1 -static $(ES1_OBJECTS) $(GLSL_LIBS)
70
71 libes2.a: $(ES2_OBJECTS) $(GLSL_LIBS)
72 @$(MKLIB) -o es2 -static $(ES1_OBJECTS) $(GLSL_LIBS)
73
74 libes1gallium.a: $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
75 @$(MKLIB) -o es1gallium -static $(ES1_GALLIUM_OBJECTS) $(GLSL_LIBS)
76
77 libes2gallium.a: $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
78 @$(MKLIB) -o es2gallium -static $(ES2_GALLIUM_OBJECTS) $(GLSL_LIBS)
79
80 libes1api.a: $(ES1_API_OBJECTS)
81 @$(MKLIB) -o es1api -static $(ES1_API_OBJECTS)
82
83 libes2api.a: $(ES2_API_OBJECTS)
84 @$(MKLIB) -o es2api -static $(ES2_API_OBJECTS)
85
86 GENERATED_SOURCES := \
87 main/api_exec_es1.c \
88 main/api_exec_es2.c \
89 main/get_es1.c \
90 main/get_es2.c
91
92 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
93 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
94
95 main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
96 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
97
98 main/get_es1.c: main/get_gen.py
99 $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
100
101 main/get_es2.c: main/get_gen.py
102 $(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
103
104 .PHONY: clean
105 clean:
106 -rm -f $(ES1_LIBS) $(ES2_LIBS)
107 -rm -rf $(ES1_OBJ_DIR) $(ES2_OBJ_DIR)
108 -rm -f $(GENERATED_SOURCES)
109 -rm -f depend depend.bak
110 -rm -f subdirs-stamp-tmp
111 @$(MAKE) -C glapi clean
112
113 # nothing to install
114 install:
115
116 subdirs-stamp-tmp:
117 @$(MAKE) -C $(MESA) asm_subdirs
118 @$(MAKE) -C $(MESA) glsl_builtin
119 @$(MAKE) -C glapi
120 @touch subdirs-stamp-tmp
121
122 # sort to avoid duplicates
123 ALL_SOURCES := $(sort $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES))
124
125 # need to make sure the subdirs are processed first
126 $(ALL_SOURCES): | subdirs-stamp-tmp
127
128 depend: $(ALL_SOURCES)
129 @echo "running $(MKDEP)"
130 @touch depend
131 @# MESA is "..", but luckily, directories are longer than 2 characters
132 @$(MKDEP) -f- -p$(ES1_OBJ_DIR)/ $(DEFINES) $(ES1_CFLAGS) \
133 $(ES1_INCLUDES) $(ES1_ALL_SOURCES) 2>/dev/null | \
134 sed -e 's,^$(ES1_OBJ_DIR)/$(MESA)/,$(ES1_OBJ_DIR)/,' > depend
135 @$(MKDEP) -f- -p$(ES2_OBJ_DIR)/ $(DEFINES) $(ES2_CFLAGS) \
136 $(ES2_INCLUDES) $(ES2_ALL_SOURCES) 2>/dev/null | \
137 sed -e 's,^$(ES2_OBJ_DIR)/$(MESA)/,$(ES2_OBJ_DIR)/,' >> depend
138
139 ifneq ($(MAKECMDGOALS),clean)
140 -include depend
141 endif