af2bb36ccc483d86003879f24d24005e33e0d945
[mesa.git] / src / mesa / Makefile.DJ
1 # Mesa 3-D graphics library
2 # Version: 5.1
3 #
4 # Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 # and/or sell copies of the Software, and to permit persons to whom the
11 # Software is furnished to do so, subject to the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 # DOS/DJGPP core makefile v1.4 for Mesa
24 #
25 # Copyright (C) 2002 - Borca Daniel
26 # Email : dborca@users.sourceforge.net
27 # Web : http://www.geocities.com/dborca
28
29
30 #
31 # Available options:
32 #
33 # Environment variables:
34 # CFLAGS
35 #
36 # GLIDE path to Glide3 SDK; used with FX.
37 # default = $(TOP)/glide3
38 # FX=1 build for 3dfx Glide3. Note that this disables
39 # compilation of most DMesa code and requires fxMesa.
40 # As a consequence, you'll need the DJGPP Glide3
41 # library to build any application.
42 # default = no
43 # MATROX=1 build for Matrox Millennium I (MGA2064W) cards.
44 # This is experimental and not intensively tested.
45 # default = no
46 # HAVE_X86=1 optimize for i386.
47 # default = no
48 # HAVE_MMX=1 allow MMX specializations, provided your assembler
49 # supports MMX instruction set. However, the true CPU
50 # capabilities are checked at run-time to avoid crashes.
51 # default = no
52 # HAVE_SSE=1 (see HAVE_MMX)
53 # default = no
54 # HAVE_3DNOW=1 (see HAVE_MMX)
55 # default = no
56 #
57 # Targets:
58 # all: build GL
59 # clean: remove object files
60 #
61
62
63
64 .PHONY: all clean
65 .INTERMEDIATE: x86/gen_matypes.exe
66
67 TOP = ../..
68 GLIDE ?= $(TOP)/glide3
69 LIBDIR = $(TOP)/lib
70 GL_LIB = libgl.a
71 GL_DXE = gl.dxe
72 GL_IMP = libigl.a
73
74 export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
75
76 CC = gcc
77 CFLAGS += -I$(TOP)/include -I. -Imain -Iglapi
78 ifeq ($(FX),1)
79 CFLAGS += -D__DOS__ -DH3
80 CFLAGS += -I$(GLIDE)/include -DFX
81 LIBNAME = "Mesa/FX DJGPP"
82 else
83 ifeq ($(MATROX),1)
84 CFLAGS += -DMATROX
85 LIBNAME = "Mesa/MGA DJGPP"
86 else
87 LIBNAME = "Mesa DJGPP"
88 endif
89 endif
90
91 AR = ar
92 ARFLAGS = rus
93
94 HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
95
96 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
97 UNLINK = del $(subst /,\,$(1))
98 else
99 UNLINK = $(RM) $(1)
100 endif
101
102 MAIN_SOURCES = \
103 main/api_arrayelt.c \
104 main/api_loopback.c \
105 main/api_noop.c \
106 main/api_validate.c \
107 main/accum.c \
108 main/arbparse.c \
109 main/arbprogram.c \
110 main/arbfragparse.c \
111 main/arbvertparse.c \
112 main/attrib.c \
113 main/blend.c \
114 main/bufferobj.c \
115 main/buffers.c \
116 main/clip.c \
117 main/colortab.c \
118 main/context.c \
119 main/convolve.c \
120 main/debug.c \
121 main/depth.c \
122 main/dispatch.c \
123 main/dlist.c \
124 main/drawpix.c \
125 main/enable.c \
126 main/enums.c \
127 main/eval.c \
128 main/extensions.c \
129 main/feedback.c \
130 main/fog.c \
131 main/get.c \
132 main/hash.c \
133 main/hint.c \
134 main/histogram.c \
135 main/image.c \
136 main/imports.c \
137 main/light.c \
138 main/lines.c \
139 main/matrix.c \
140 main/nvprogram.c \
141 main/nvfragparse.c \
142 main/nvvertexec.c \
143 main/nvvertparse.c \
144 main/occlude.c \
145 main/pixel.c \
146 main/points.c \
147 main/polygon.c \
148 main/program.c \
149 main/rastpos.c \
150 main/state.c \
151 main/stencil.c \
152 main/texcompress.c \
153 main/texformat.c \
154 main/teximage.c \
155 main/texobj.c \
156 main/texstate.c \
157 main/texstore.c \
158 main/texutil.c \
159 main/varray.c \
160 main/vtxfmt.c
161
162 GLAPI_SOURCES = \
163 glapi/glapi.c \
164 glapi/glthread.c
165
166 MATH_SOURCES = \
167 math/m_debug_clip.c \
168 math/m_debug_norm.c \
169 math/m_debug_xform.c \
170 math/m_eval.c \
171 math/m_matrix.c \
172 math/m_translate.c \
173 math/m_vector.c \
174 math/m_xform.c
175
176 ARRAY_CACHE_SOURCES = \
177 array_cache/ac_context.c \
178 array_cache/ac_import.c
179
180 SWRAST_SOURCES = \
181 swrast/s_aaline.c \
182 swrast/s_aatriangle.c \
183 swrast/s_accum.c \
184 swrast/s_alpha.c \
185 swrast/s_alphabuf.c \
186 swrast/s_bitmap.c \
187 swrast/s_blend.c \
188 swrast/s_buffers.c \
189 swrast/s_copypix.c \
190 swrast/s_context.c \
191 swrast/s_depth.c \
192 swrast/s_drawpix.c \
193 swrast/s_feedback.c \
194 swrast/s_fog.c \
195 swrast/s_imaging.c \
196 swrast/s_lines.c \
197 swrast/s_logic.c \
198 swrast/s_masking.c \
199 swrast/s_nvfragprog.c \
200 swrast/s_pixeltex.c \
201 swrast/s_points.c \
202 swrast/s_readpix.c \
203 swrast/s_span.c \
204 swrast/s_stencil.c \
205 swrast/s_texture.c \
206 swrast/s_texstore.c \
207 swrast/s_triangle.c \
208 swrast/s_zoom.c
209
210 SWRAST_SETUP_SOURCES = \
211 swrast_setup/ss_context.c \
212 swrast_setup/ss_triangle.c \
213 swrast_setup/ss_vb.c
214
215 TNL_SOURCES = \
216 tnl/t_array_api.c \
217 tnl/t_array_import.c \
218 tnl/t_context.c \
219 tnl/t_eval_api.c \
220 tnl/t_imm_alloc.c \
221 tnl/t_imm_api.c \
222 tnl/t_imm_debug.c \
223 tnl/t_imm_dlist.c \
224 tnl/t_imm_elt.c \
225 tnl/t_imm_eval.c \
226 tnl/t_imm_exec.c \
227 tnl/t_imm_fixup.c \
228 tnl/t_pipeline.c \
229 tnl/t_vb_fog.c \
230 tnl/t_vb_light.c \
231 tnl/t_vb_normals.c \
232 tnl/t_vb_points.c \
233 tnl/t_vb_program.c \
234 tnl/t_vb_render.c \
235 tnl/t_vb_texgen.c \
236 tnl/t_vb_texmat.c \
237 tnl/t_vb_vertex.c
238
239 X86_SOURCES = \
240 x86/x86.c \
241 x86/glapi_x86.S \
242 x86/common_x86.c \
243 x86/common_x86_asm.S \
244 x86/x86_xform2.S \
245 x86/x86_xform3.S \
246 x86/x86_xform4.S \
247 x86/x86_cliptest.S
248
249 MMX_SOURCES = \
250 x86/mmx_blend.S
251
252 SSE_SOURCES = \
253 x86/sse.c \
254 x86/sse_xform2.S \
255 x86/sse_xform3.S \
256 x86/sse_xform4.S \
257 x86/sse_normal.S
258
259 K3D_SOURCES = \
260 x86/3dnow.c \
261 x86/3dnow_xform2.S \
262 x86/3dnow_xform3.S \
263 x86/3dnow_xform4.S \
264 x86/3dnow_normal.S
265
266 CORE_SOURCES = \
267 $(MAIN_SOURCES) \
268 $(GLAPI_SOURCES) \
269 $(MATH_SOURCES) \
270 $(ARRAY_CACHE_SOURCES) \
271 $(SWRAST_SOURCES) \
272 $(SWRAST_SETUP_SOURCES) \
273 $(TNL_SOURCES)
274
275 ifeq ($(HAVE_MMX),1)
276 X86_SOURCES += $(MMX_SOURCES)
277 CFLAGS += -DUSE_MMX_ASM
278 HAVE_X86 = 1
279 endif
280 ifeq ($(HAVE_SSE),1)
281 X86_SOURCES += $(SSE_SOURCES)
282 CFLAGS += -DUSE_SSE_ASM
283 HAVE_X86 = 1
284 endif
285 ifeq ($(HAVE_3DNOW),1)
286 X86_SOURCES += $(K3D_SOURCES)
287 CFLAGS += -DUSE_3DNOW_ASM
288 HAVE_X86 = 1
289 endif
290 ifeq ($(HAVE_X86),1)
291 CFLAGS += -DUSE_X86_ASM
292 else
293 X86_SOURCES =
294 endif
295
296 DRIVER_SOURCES = \
297 drivers/dos/dmesa.c
298 ifeq ($(FX),1)
299 DRIVER_SOURCES += \
300 drivers/glide/fxapi.c \
301 drivers/glide/fxdd.c \
302 drivers/glide/fxddspan.c \
303 drivers/glide/fxddtex.c \
304 drivers/glide/fxsetup.c \
305 drivers/glide/fxtexman.c \
306 drivers/glide/fxtris.c \
307 drivers/glide/fxvb.c \
308 drivers/glide/fxglidew.c \
309 drivers/glide/fxg.c
310 else
311 ifeq ($(MATROX),1)
312 DRIVER_SOURCES += \
313 drivers/dos/mga/mga.c \
314 drivers/dos/mga/mga_hw.c \
315 drivers/dos/mga/mga_mode.c \
316 drivers/dos/dpmi.c
317 else
318 DRIVER_SOURCES += \
319 drivers/dos/video.c \
320 drivers/dos/virtual.S \
321 drivers/dos/vesa.c \
322 drivers/dos/blit.S \
323 drivers/dos/vga.c \
324 drivers/dos/dpmi.c
325 endif
326 endif
327
328 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
329
330 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
331
332 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
333
334 .c.o:
335 $(CC) -o $@ $(CFLAGS) -c $<
336 .S.o:
337 $(CC) -o $@ $(CFLAGS) -c $<
338 .s.o:
339 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
340
341 all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP)
342
343 $(LIBDIR)/$(GL_LIB): $(OBJECTS)
344 $(AR) $(ARFLAGS) $@ $^
345
346 $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
347 ifeq ($(HAVEDXE3),)
348 $(warning Missing DXE3 package... Skipping $(GL_DXE))
349 else
350 ifeq ($(FX),1)
351 -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glide3x.dxe -U $^
352 else
353 -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -U $^
354 endif
355 endif
356
357 $(X86_OBJECTS): x86/matypes.h
358
359 x86/matypes.h: x86/gen_matypes.exe
360 $< > $@
361
362 x86/gen_matypes.exe: x86/gen_matypes.c
363 $(CC) -o $@ $(CFLAGS) -s $<
364
365 clean:
366 -$(call UNLINK,array_cache/*.o)
367 -$(call UNLINK,glapi/*.o)
368 -$(call UNLINK,main/*.o)
369 -$(call UNLINK,math/*.o)
370 -$(call UNLINK,swrast/*.o)
371 -$(call UNLINK,swrast_setup/*.o)
372 -$(call UNLINK,tnl/*.o)
373 -$(call UNLINK,x86/*.o)
374 -$(call UNLINK,drivers/dos/*.o)
375 -$(call UNLINK,drivers/dos/mga/*.o)
376 -$(call UNLINK,drivers/glide/*.o)