mesa/es: Fix symbol conflicts and warnings.
[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
14 default: subdirs depend es1 es2
15
16 es1: $(ES1_LIBS)
17
18 es2: $(ES2_LIBS)
19
20 # force the inclusion of es's mfeatures.h
21 ES1_CPPFLAGS := -include main/mfeatures_es1.h -D__GL_EXPORTS
22 ES2_CPPFLAGS := -include main/mfeatures_es2.h -D__GL_EXPORTS
23
24 ES1_OBJ_DIR := objs-es1
25 ES2_OBJ_DIR := objs-es2
26
27 # adjust output dirs
28 ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_OBJECTS))
29 ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_GALLIUM_OBJECTS))
30 ES1_API_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_API_OBJECTS))
31
32 ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_OBJECTS))
33 ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_GALLIUM_OBJECTS))
34 ES2_API_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_API_OBJECTS))
35
36 # compile either ES1 or ES2 sources
37 define es-compile
38 @mkdir -p $(dir $@)
39 $(CC) -c $(CFLAGS) $(ES$(1)_CPPFLAGS) $(ES$(1)_INCLUDES) -o $@ $<
40 endef
41
42 $(ES1_OBJ_DIR)/%.o: %.c
43 $(call es-compile,1)
44
45 $(ES1_OBJ_DIR)/%.o: %.S
46 $(call es-compile,1)
47
48 $(ES1_OBJ_DIR)/%.o: $(MESA)/%.c
49 $(call es-compile,1)
50
51 $(ES1_OBJ_DIR)/%.o: $(MESA)/%.S
52 $(call es-compile,1)
53
54 $(ES2_OBJ_DIR)/%.o: %.c
55 $(call es-compile,2)
56
57 $(ES2_OBJ_DIR)/%.o: %.S
58 $(call es-compile,2)
59
60 $(ES2_OBJ_DIR)/%.o: $(MESA)/%.c
61 $(call es-compile,2)
62
63 $(ES2_OBJ_DIR)/%.o: $(MESA)/%.S
64 $(call es-compile,2)
65
66 libes1.a: $(ES1_OBJECTS)
67 @$(TOP)/bin/mklib -o es1 -static $(ES1_OBJECTS)
68
69 libes2.a: $(ES2_OBJECTS)
70 @$(TOP)/bin/mklib -o es2 -static $(ES1_OBJECTS)
71
72 libes1gallium.a: $(ES1_GALLIUM_OBJECTS)
73 @$(TOP)/bin/mklib -o es1gallium -static $(ES1_GALLIUM_OBJECTS)
74
75 libes2gallium.a: $(ES2_GALLIUM_OBJECTS)
76 @$(TOP)/bin/mklib -o es2gallium -static $(ES2_GALLIUM_OBJECTS)
77
78 libes1api.a: $(ES1_API_OBJECTS)
79 @$(TOP)/bin/mklib -o es1api -static $(ES1_API_OBJECTS)
80
81 libes2api.a: $(ES2_API_OBJECTS)
82 @$(TOP)/bin/mklib -o es2api -static $(ES2_API_OBJECTS)
83
84 GENERATED_SOURCES := \
85 main/api_exec_es1.c \
86 main/api_exec_es2.c \
87 main/get_es1.c \
88 main/get_es2.c
89
90 main/api_exec_es1.c: main/APIspec.txt main/es_generator.py main/apiutil.py main/es1_special
91 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.txt -V GLES1.1 > $@
92
93 main/api_exec_es2.c: main/APIspec.txt main/es_generator.py main/apiutil.py main/es2_special
94 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.txt -V GLES2.0 > $@
95
96 main/get_es1.c: main/get_gen.py
97 $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
98
99 main/get_es2.c: main/get_gen.py
100 $(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
101
102 .PHONY: clean
103 clean:
104 -rm -f $(ES1_LIBS) $(ES2_LIBS)
105 -rm -rf $(ES1_OBJ_DIR) $(ES2_OBJ_DIR)
106 -rm -f $(GENERATED_SOURCES)
107 -rm -f depend
108 -rm -f *~
109
110 # nothing to install
111 install:
112
113 subdirs:
114 make -C glapi
115 make -C $(MESA) asm_subdirs
116
117 depend: $(ES1_ALL_SOURCES) $(ES2_ALL_SOURCES)
118 @echo "running $(MKDEP)"
119 @touch depend
120 @# MESA is "..", but luckily, directories are longer than 2 characters
121 @$(MKDEP) -f- -p$(ES1_OBJ_DIR)/ $(DEFINES) $(ES1_CFLAGS) \
122 $(ES1_INCLUDES) $(ES1_ALL_SOURCES) 2>/dev/null | \
123 sed -e 's,^$(ES1_OBJ_DIR)/$(MESA)/,$(ES1_OBJ_DIR)/,' > depend
124 @$(MKDEP) -f- -p$(ES2_OBJ_DIR)/ $(DEFINES) $(ES2_CFLAGS) \
125 $(ES2_INCLUDES) $(ES2_ALL_SOURCES) 2>/dev/null | \
126 sed -e 's,^$(ES2_OBJ_DIR)/$(MESA)/,$(ES2_OBJ_DIR)/,' >> depend
127
128 -include depend