-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
122 lines (104 loc) · 2.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
.PHONY: all clean realclean
.SUFFIXES: .asm .o
.INTERMEDIATE: x86/x86gen.exe
DRIVER ?= glide
all: lib/libGL.so.1.1
CC = gcc
HOST_CC = gcc
CFLAGS = -Wall
CFLAGS += -Wno-unused
CFLAGS += -O2
# in case of problems disable -DNDEBUG to enable assertions
CFLAGS += -DNDEBUG
#CFLAGS += -g
#CFLAGS += -ffast-math -DFAST_MATH
CFLAGS += -I. -Iinclude -Idrivers
# disable software scaledown of hardware-unsupported large textures
#CFLAGS += -DFX_RESCALEHACK=0
LD = $(CC)
LDFLAGS =
LDLIBS = -lX11 -ldl -lm
AS = nasm
ASFLAGS = -O2 -felf -D__linux__ -Ix86/ -Imain/
CORE_SOURCES = \
util/cfg.c \
util/pow.c \
main/buffer.c \
main/color.c \
main/context.c \
main/cull.c \
main/depth.c \
main/stencil.c \
main/dlist.c \
main/enable.c \
main/get.c \
main/glapi.c \
main/glapic.c \
main/light.c \
main/matrix.c \
main/texture.c \
main/texstore.c \
main/texcodec.c \
main/texdef.c \
main/fog.c \
main/ext.c \
main/pixel.c \
main/raster.c \
main/attrib.c \
main/fake.c \
main/legacy.c \
util/alloc.c
TNL_SOURCES = \
tnl/tnl.c \
tnl/tnl_prim.c \
tnl/tnl_pipeline.c \
tnl/tnl_setup.c \
tnl/imm_api.c \
tnl/imm_array.c \
tnl/imm_vertex.c \
tnl/sav_api.c \
tnl/sav_array.c \
tnl/sav_vertex.c
ifeq ($(X86),1)
CFLAGS += -DX86
X86_SOURCES = \
x86/x86.c \
x86/cpuhard.c \
x86/cpusoft.asm \
x86/glapia.asm \
x86/x86_vertex.asm \
x86/x86_clip.asm \
x86/k3d_mat.asm \
x86/k3d_clip.asm \
x86/k3d_misc.asm \
x86/sse_vertex.asm \
x86/sse_mat.asm \
x86/sse_clip.asm \
x86/sse_misc.asm
x86/x86.o: x86/x86chk.h
endif
include drivers/$(DRIVER)/config
DRIVER_SOURCES += \
drivers/$(DRIVER)/glx.c
SOURCES = $(CORE_SOURCES) $(TNL_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
$(CC) -o $@ $(CFLAGS) -fPIC -DPIC -c $<
.asm.o:
$(AS) -o $@ $(ASFLAGS) $<
lib/libGL.so.1.1: $(OBJECTS)
$(LD) -o $@ -shared -Wl,-soname=libGL.so.1 $(LDFLAGS) $^ $(LDLIBS)
$(X86_SOURCES:.asm=.o): x86/x86.inc
x86/x86.inc: x86/x86gen.exe
$< -o $@
x86/x86chk.h: x86/x86gen.exe
$< -c -o $@
x86/x86gen.exe: x86/x86gen.c glinternal.h main/context.h main/matrix.h tnl/tnl.h x86/cpu.h
$(HOST_CC) -o $@ $(CFLAGS) $<
clean::
-$(RM) $(OBJECTS)
-$(RM) x86/*.o
-$(RM) x86/x86chk.h
-$(RM) x86/x86.inc
realclean:: clean
-$(RM) lib/libGL.so.1.1