mesa: Move api_exec_es*.c into mesa/main
[mesa.git] / src / mesa / Makefile
1 # src/mesa/Makefile
2
3 TOP = ../..
4 include $(TOP)/configs/current
5
6 include sources.mak
7
8 .SUFFIXES : .cpp
9
10 .c.o:
11 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
12
13 .cpp.o:
14 $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@
15
16 .S.o:
17 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
18
19
20
21 # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
22 # then convenience libs (.a) and finally the device drivers:
23 default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
24 libglapi.a driver_subdirs
25
26
27 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
28 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
29
30 main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
31 $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
32
33
34 ######################################################################
35 # Helper libraries used by many drivers:
36
37 # Make archive of core mesa object files
38 libmesa.a: $(MESA_OBJECTS) $(GLSL_LIBS)
39 @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) $(GLSL_LIBS)
40
41 # Make archive of subset of core mesa object files for gallium
42 libmesagallium.a: $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
43 @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) $(GLSL_LIBS)
44
45 # Make archive of gl* API dispatcher functions only
46 libglapi.a: $(GLAPI_OBJECTS)
47 @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
48
49 ######################################################################
50 # Device drivers
51 driver_subdirs: libmesa.a libglapi.a libmesagallium.a
52 @ (cd drivers && $(MAKE))
53
54
55 ######################################################################
56 # Assembly subdirs
57 asm_subdirs:
58 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \
59 (cd x86 && $(MAKE)) || exit 1 ; \
60 fi
61 @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \
62 (cd x86 && $(MAKE)) || exit 1 ; \
63 (cd x86-64 && $(MAKE)) || exit 1 ; \
64 fi
65
66
67 ######################################################################
68 # GLSL built-in library
69 glsl_builtin:
70 (cd shader/slang/library && $(MAKE)) || exit 1 ;
71
72
73 ######################################################################
74 # Dependency generation
75
76 depend: $(ALL_SOURCES)
77 @ echo "running $(MKDEP)"
78 @ touch depend
79 @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \
80 > /dev/null 2>/dev/null
81
82
83 ######################################################################
84 # Installation rules
85
86 # this isn't fleshed out yet but is probably the way to go in the future
87 new_install:
88 (cd drivers && $(MAKE) install)
89
90
91 # XXX replace this with new_install above someday
92 install: default
93 @for driver in $(DRIVER_DIRS) ; do \
94 case "$$driver" in \
95 osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \
96 $(MAKE) install-headers install-osmesa || exit 1 ; \
97 else \
98 $(MAKE) install-osmesa || exit 1 ; \
99 fi ;; \
100 dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
101 *) $(MAKE) install-libgl || exit 1 ;; \
102 esac ; \
103 done
104
105
106 gl_pcedit = sed \
107 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
108 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
109 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
110 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
111 -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
112 -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
113 -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
114 -e 's,@GL_LIB@,$(GL_LIB),'
115
116 gl.pc: gl.pc.in
117 $(gl_pcedit) $< > $@
118
119 osmesa_pcedit = sed \
120 -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
121 -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
122 -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
123 -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
124 -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
125 -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
126 -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
127
128 osmesa.pc: osmesa.pc.in
129 $(osmesa_pcedit) $< > $@
130
131 install-headers:
132 $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL
133 $(INSTALL) -m 644 $(TOP)/include/GL/*.h \
134 $(DESTDIR)$(INSTALL_INC_DIR)/GL
135
136 install-libgl: default gl.pc install-headers
137 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
138 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
139 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
140 $(DESTDIR)$(INSTALL_LIB_DIR)
141 $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
142
143 install-osmesa: default osmesa.pc
144 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
145 $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
146 $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \
147 $(DESTDIR)$(INSTALL_LIB_DIR)
148 $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
149
150 install-dri: default
151 cd drivers/dri && $(MAKE) install
152
153
154
155 # Emacs tags
156 tags:
157 etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h
158
159
160 clean:
161 -rm -f */*.o
162 -rm -f */*/*.o
163 -rm -f depend depend.bak libmesa.a libglapi.a libmesagallium.a
164 -rm -f drivers/*/*.o
165 -rm -f *.pc
166 -rm -f shader/slang/library/*_gc.h
167 -@cd drivers/dri && $(MAKE) clean
168 -@cd drivers/x11 && $(MAKE) clean
169 -@cd drivers/osmesa && $(MAKE) clean
170 -@cd x86 && $(MAKE) clean
171 -@cd x86-64 && $(MAKE) clean
172
173
174 -include depend