4 include $(TOP
)/configs
/current
6 MESA_LIBS
:= libmesa.a libmesagallium.a
10 DRICORE_OBJ_DIR
:= objs-dricore
15 DRICORE_OBJECTS
:= $(addprefix $(DRICORE_OBJ_DIR
)/, $(MESA_OBJECTS
))
16 MESA_OBJECTS
:= $(addprefix $(MESA_OBJ_DIR
)/, $(MESA_OBJECTS
))
17 MESA_GALLIUM_OBJECTS
:= $(addprefix $(MESA_OBJ_DIR
)/, $(MESA_GALLIUM_OBJECTS
))
19 # define preprocessor flags
20 MESA_CPPFLAGS
:= $(API_DEFINES
) $(DEFINES
)
23 MESA_CPPFLAGS
+= $(INCLUDE_DIRS
)
25 DRICORE_CPPFLAGS
= $(MESA_CPPFLAGS
)
28 CFLAGS
:= $(filter-out $(DEFINES
), $(CFLAGS
))
29 CXXFLAGS
:= $(filter-out $(DEFINES
), $(CXXFLAGS
))
31 # LLVM is needed for the state tracker
32 MESA_CFLAGS
:= $(LLVM_CFLAGS
) $(CFLAGS
)
33 DRICORE_CFLAGS
:= $(LLVM_CFLAGS
) $(DRI_CFLAGS
)
35 MESA_CXXFLAGS
:= $(LLVM_CFLAGS
) $(CXXFLAGS
)
36 DRICORE_CXXFLAGS
:= $(LLVM_CFLAGS
) $(DRI_CXXFLAGS
)
40 $(CC
) -c
-o
$@
$< $($(1)_CPPFLAGS
) $($(1)_CFLAGS
)
45 $(CXX
) -c
-o
$@
$< $($(1)_CPPFLAGS
) $($(1)_CXXFLAGS
)
48 $(MESA_OBJ_DIR
)/%.o
: %.c
49 $(call mesa-cc-c
,MESA
)
51 $(MESA_OBJ_DIR
)/%.o
: %.
cpp
52 $(call mesa-cxx-c
,MESA
)
54 $(MESA_OBJ_DIR
)/%.o
: %.S
55 $(call mesa-cc-c
,MESA
)
57 $(DRICORE_OBJ_DIR
)/%.o
: %.c
58 $(call mesa-cc-c
,DRICORE
)
60 $(DRICORE_OBJ_DIR
)/%.o
: %.
cpp
61 $(call mesa-cxx-c
,DRICORE
)
63 $(DRICORE_OBJ_DIR
)/%.o
: %.S
64 $(call mesa-cc-c
,DRICORE
)
66 # Default: build dependencies, then asm_subdirs, GLSL built-in lib,
67 # then convenience libs (.a) and finally the device drivers:
68 default
: $(DEPENDS
) asm_subdirs
$(MESA_LIBS
) $(DRICORE_LIBS
) driver_subdirs
70 main
/api_exec_es1.c
: main
/APIspec.xml main
/es_generator.py main
/APIspecutil.py main
/APIspec.py
71 $(PYTHON2
) $(PYTHON_FLAGS
) main
/es_generator.py
-S main
/APIspec.xml
-V GLES1.1
> $@
73 main
/api_exec_es2.c
: main
/APIspec.xml main
/es_generator.py main
/APIspecutil.py main
/APIspec.py
74 $(PYTHON2
) $(PYTHON_FLAGS
) main
/es_generator.py
-S main
/APIspec.xml
-V GLES2.0
> $@
76 program
/program_parse.tab.c program
/program_parse.tab.h
: program
/program_parse.y
77 $(BISON
) -v
-d
--output
=program
/program_parse.tab.c
$<
79 program
/lex.yy.c
: program
/program_lexer.l
80 $(FLEX
) --never-interactive
--outfile
=$@
$<
82 ######################################################################
83 # Helper libraries used by many drivers:
85 # Make archive of core mesa object files
86 libmesa.a
: $(MESA_OBJECTS
) $(GLSL_LIBS
)
87 @
$(MKLIB
) -o mesa
-static
$(MESA_OBJECTS
) $(GLSL_LIBS
)
89 # Shared dricore library for classic DRI drivers
90 $(TOP
)/$(LIB_DIR
)/libdricore.so
: $(DRICORE_OBJECTS
) $(DRICORE_GLSL_LIBS
)
91 @
$(MKLIB
) -o
$@
-linker
'$(CXX)' -ldflags '$(LDFLAGS)' \
92 -cplusplus
-noprefix \
93 -install $(TOP
)/$(LIB_DIR
) -id
$(DRI_DRIVER_INSTALL_DIR
)/$@.dylib \
94 $(DRICORE_LIB_DEPS
) $(DRICORE_OBJECTS
)
96 # Make archive of subset of core mesa object files for gallium
97 libmesagallium.a
: $(MESA_GALLIUM_OBJECTS
) $(GLSL_LIBS
)
98 @
$(MKLIB
) -o mesagallium
-static
$(MESA_GALLIUM_OBJECTS
) $(GLSL_LIBS
)
100 ######################################################################
102 driver_subdirs
: $(MESA_LIBS
) $(DRICORE_LIBS
)
103 @
(cd drivers
&& $(MAKE
))
106 ######################################################################
109 @ if echo
"$(ASM_FLAGS)" | grep
-q USE_X86_ASM
; then \
110 (cd x86
&& $(MAKE
)) || exit
1 ; \
112 @ if echo
"$(ASM_FLAGS)" | grep
-q USE_X86_64_ASM
; then \
113 (cd x86
&& $(MAKE
)) || exit
1 ; \
114 (cd x86-64
&& $(MAKE
)) || exit
1 ; \
118 ######################################################################
119 # Dependency generation
121 depend
: $(ALL_SOURCES
)
122 @ echo
"running $(MKDEP)"
124 @
$(MKDEP
) $(MKDEP_OPTIONS
) -p
$(MESA_OBJ_DIR
)/ $(MESA_CPPFLAGS
) \
125 $(ALL_SOURCES
) > /dev
/null
2>/dev
/null
126 @
$(MKDEP
) $(MKDEP_OPTIONS
) -a
-p
$(DRICORE_OBJ_DIR
)/ $(MESA_CPPFLAGS
) \
127 $(ALL_SOURCES
) > /dev
/null
2>/dev
/null
129 ######################################################################
132 # this isn't fleshed out yet but is probably the way to go in the future
134 (cd drivers
&& $(MAKE
) install)
136 ifneq (,$(DRICORE_LIBS
))
137 DRICORE_INSTALL_TARGET
= install-dricore
140 # XXX replace this with new_install above someday
141 install: default
$(DRICORE_INSTALL_TARGET
)
142 @for driver in
$(DRIVER_DIRS
) ; do \
144 osmesa
) if
[ "$(DRIVER_DIRS)" = osmesa
]; then \
145 $(MAKE
) install-headers install-osmesa || exit
1 ; \
147 $(MAKE
) install-osmesa || exit
1 ; \
149 dri
) $(MAKE
) install-libgl install-dri || exit
1 ;; \
150 *) $(MAKE
) install-libgl || exit
1 ;; \
155 -e
's,@INSTALL_DIR@,$(INSTALL_DIR),' \
156 -e
's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
157 -e
's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
158 -e
's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
163 -e
's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
164 -e
's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
165 -e
's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
166 -e
's,@GLX_TLS@,$(GLX_TLS),' \
167 -e
's,@GL_LIB@,$(GL_LIB),'
172 osmesa_pcedit
= sed \
174 -e
's,@OSMESA_LIB@,$(OSMESA_LIB),' \
175 -e
's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
176 -e
's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
178 osmesa.
pc: osmesa.
pc.in
179 $(osmesa_pcedit
) $< > $@
182 $(INSTALL
) -d
$(DESTDIR
)$(INSTALL_INC_DIR
)/GL
183 $(INSTALL
) -m
644 $(TOP
)/include/GL
/*.h \
184 $(DESTDIR
)$(INSTALL_INC_DIR
)/GL
186 install-libgl
: default gl.
pc install-headers
187 $(INSTALL
) -d
$(DESTDIR
)$(INSTALL_LIB_DIR
)
188 $(INSTALL
) -d
$(DESTDIR
)$(INSTALL_LIB_DIR
)/pkgconfig
189 $(MINSTALL
) $(TOP
)/$(LIB_DIR
)/$(GL_LIB_GLOB
) \
190 $(DESTDIR
)$(INSTALL_LIB_DIR
)
191 $(INSTALL
) -m
644 gl.
pc $(DESTDIR
)$(INSTALL_LIB_DIR
)/pkgconfig
193 install-osmesa
: default osmesa.
pc
194 $(INSTALL
) -d
$(DESTDIR
)$(INSTALL_LIB_DIR
)
195 $(INSTALL
) -d
$(DESTDIR
)$(INSTALL_LIB_DIR
)/pkgconfig
196 $(MINSTALL
) $(TOP
)/$(LIB_DIR
)/$(OSMESA_LIB_GLOB
) \
197 $(DESTDIR
)$(INSTALL_LIB_DIR
)
198 $(INSTALL
) -m
644 osmesa.
pc $(DESTDIR
)$(INSTALL_LIB_DIR
)/pkgconfig
201 cd drivers
/dri
&& $(MAKE
) install
203 # We don't need MINSTALL here because we're not installing symbolic links
204 install-dricore
: default
205 $(INSTALL
) -d
$(DESTDIR
)$(DRI_DRIVER_INSTALL_DIR
)
206 $(INSTALL
) -m
755 $(DRICORE_LIBS
) $(DESTDIR
)$(DRI_DRIVER_INSTALL_DIR
)
211 etags
`find . -name \*.[ch]` $(TOP
)/include/GL
/*.h
215 -rm -f
$(DRICORE_LIBS
)
216 -rm -rf
$(DRICORE_OBJ_DIR
)
221 -rm -f depend depend.bak libmesa.a libmesagallium.a
224 -@cd drivers
/dri
&& $(MAKE
) clean
225 -@cd drivers
/x11
&& $(MAKE
) clean
226 -@cd drivers
/osmesa
&& $(MAKE
) clean
227 -@cd x86
&& $(MAKE
) clean
228 -@cd x86-64
&& $(MAKE
) clean