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