move mesa32 over to new dir
[reactos.git] / reactos / lib / mesa32 / src / 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.7 for Mesa
24 #
25 # Copyright (C) 2002 - Daniel Borca
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 # X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
44 # default = no
45 #
46 # Targets:
47 # all: build GL
48 # clean: remove object files
49 #
50
51
52
53 .PHONY: all clean
54 .INTERMEDIATE: x86/gen_matypes.exe
55
56 TOP = ../..
57 GLIDE ?= $(TOP)/glide3
58 LIBDIR = $(TOP)/lib
59 GL_LIB = libgl.a
60 GL_DXE = gl.dxe
61 GL_IMP = libigl.a
62
63 export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
64
65 CC = gcc
66 CFLAGS += $(INCLUDE_DIRS)
67 CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
68 ifeq ($(FX),1)
69 CFLAGS += -D__DOS__
70 CFLAGS += -I$(GLIDE)/include -DFX
71 LIBNAME = "Mesa/FX DJGPP"
72 else
73 LIBNAME = "Mesa DJGPP"
74 endif
75
76 AR = ar
77 ARFLAGS = crus
78
79 HAVEDXE3 = $(wildcard $(DJDIR)/bin/dxe3gen.exe)
80
81 ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
82 UNLINK = del $(subst /,\,$(1))
83 else
84 UNLINK = $(RM) $(1)
85 endif
86
87 include sources
88
89 ifeq ($(X86),1)
90 CFLAGS += -DUSE_X86_ASM
91 CFLAGS += -DUSE_MMX_ASM
92 CFLAGS += -DUSE_SSE_ASM
93 CFLAGS += -DUSE_3DNOW_ASM
94 X86_SOURCES += $(X86_API)
95 else
96 X86_SOURCES =
97 endif
98
99 DRIVER_SOURCES = \
100 drivers/dos/dmesa.c
101 ifeq ($(FX),1)
102 DRIVER_SOURCES += \
103 $(GLIDE_DRIVER_SOURCES)
104 else
105 DRIVER_SOURCES += \
106 drivers/dos/video.c \
107 drivers/dos/virtual.S \
108 drivers/dos/vesa.c \
109 drivers/dos/blit.S \
110 drivers/dos/vga.c \
111 drivers/dos/null.c \
112 drivers/dos/dpmi.c
113 endif
114
115 #DRIVER_SOURCES += $(OSMESA_DRIVER_SOURCES)
116
117 SOURCES = $(CORE_SOURCES) $(X86_SOURCES) $(COMMON_DRIVER_SOURCES) $(DRIVER_SOURCES)
118
119 OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
120
121 X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES)))
122
123 .c.o:
124 $(CC) -o $@ $(CFLAGS) -c $<
125 .S.o:
126 $(CC) -o $@ $(CFLAGS) -c $<
127 .s.o:
128 $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
129
130 all: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP)
131
132 $(LIBDIR)/$(GL_LIB): $(OBJECTS)
133 $(AR) $(ARFLAGS) $@ $^
134
135 $(LIBDIR)/$(GL_DXE) $(LIBDIR)/$(GL_IMP): $(OBJECTS)
136 ifeq ($(HAVEDXE3),)
137 $(warning Missing DXE3 package... Skipping $(GL_DXE))
138 else
139 ifeq ($(FX),1)
140 -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -P glide3x.dxe -U $^
141 else
142 -dxe3gen -o $(LIBDIR)/$(GL_DXE) -Y $(LIBDIR)/$(GL_IMP) -D $(LIBNAME) -E _gl -E _DMesa -U $^
143 endif
144 endif
145
146 $(X86_OBJECTS): x86/matypes.h
147
148 x86/matypes.h: x86/gen_matypes.exe
149 $< > $@
150
151 x86/gen_matypes.exe: x86/gen_matypes.c
152 $(CC) -o $@ $(CFLAGS) -s $<
153
154 clean:
155 -$(call UNLINK,array_cache/*.o)
156 -$(call UNLINK,glapi/*.o)
157 -$(call UNLINK,main/*.o)
158 -$(call UNLINK,math/*.o)
159 -$(call UNLINK,shader/*.o)
160 -$(call UNLINK,sparc/*.o)
161 -$(call UNLINK,ppc/*.o)
162 -$(call UNLINK,swrast/*.o)
163 -$(call UNLINK,swrast_setup/*.o)
164 -$(call UNLINK,tnl/*.o)
165 -$(call UNLINK,x86/*.o)
166 -$(call UNLINK,drivers/common/*.o)
167 -$(call UNLINK,drivers/dos/*.o)
168 -$(call UNLINK,drivers/glide/*.o)