protect against broken apps
[mesa.git] / src / mesa / Makefile.X11
1 # Makefile for main Mesa library for Unix/X11-like systems
2
3
4 ##### MACROS #####
5
6 TOP = ../..
7
8 GL_MAJOR = 1
9 GL_MINOR = 5
10 GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
11
12 GL_LIB_NAME = "GL" # may be overridden in Make-config
13 OSMESA_LIB_NAME = "OSMesa" # may be overridden in Make-config
14
15 LIBDIR = $(TOP)/lib
16
17
18 include sources
19
20
21 # This will probably get set to $(X86_SOURCES) in Make-config:
22 ASM_SOURCES =
23
24 # This should get set in Make-config someday:
25 DRIVER_SOURCES = \
26 $(X11_DRIVER_SOURCES) \
27 $(GLIDE_DRIVER_SOURCES) \
28 $(SVGA_DRIVER_SOURCES) \
29 $(FBDEV_DRIVER_SOURCES)
30
31 # All the sources we care about:
32 SOURCES = \
33 $(CORE_SOURCES) \
34 $(ASM_SOURCES) \
35 $(DRIVER_SOURCES)
36
37
38 ASM_OBJECTS = $(ASM_SOURCES:.S=.o)
39
40 DRIVER_OBJECTS = $(DRIVER_SOURCES:.c=.o)
41
42 OSMESA_OBJECTS = $(OSMESA_DRIVER_SOURCES:.c=.o)
43
44 # All the objects we want to make:
45 OBJECTS = \
46 $(CORE_OBJECTS) \
47 $(ASM_OBJECTS) \
48 $(DRIVER_OBJECTS)
49
50
51
52 ##### RULES #####
53
54 .c.o:
55 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
56
57 .S.o:
58 $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
59
60
61 # need some special rules here, unfortunately
62 x86/matypes.h: main/mtypes.h tnl/t_context.h x86/gen_matypes.c
63 $(CC) $(INCLUDE_DIRS) $(CFLAGS) x86/gen_matypes.c -o x86/gen_matypes
64 ./x86/gen_matypes > x86/matypes.h
65 #rm -f x86/gen_matypes x86/*.o
66
67 x86/common_x86_asm.o: x86/matypes.h
68 x86/3dnow_normal.o: x86/matypes.h
69 x86/3dnow_xform1.o: x86/matypes.h
70 x86/3dnow_xform2.o: x86/matypes.h
71 x86/3dnow_xform3.o: x86/matypes.h
72 x86/3dnow_xform4.o: x86/matypes.h
73 x86/mmx_blend.o: x86/matypes.h
74 x86/sse_normal.o: x86/matypes.h
75 x86/sse_xform1.o: x86/matypes.h
76 x86/sse_xform2.o: x86/matypes.h
77 x86/sse_xform3.o: x86/matypes.h
78 x86/sse_xform4.o: x86/matypes.h
79 x86/x86_cliptest.o: x86/matypes.h
80 x86/x86_xform2.o: x86/matypes.h
81 x86/x86_xform3.o: x86/matypes.h
82 x86/x86_xform4.o: x86/matypes.h
83
84
85
86 ##### TARGETS #####
87
88 default:
89 @echo "Specify a target configuration"
90
91
92 targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB)
93
94
95 # Make the GL library
96 $(LIBDIR)/$(GL_LIB): $(OBJECTS)
97 $(TOP)/bin/mklib -o $(GL_LIB_NAME) -major $(GL_MAJOR) \
98 -minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \
99 $(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS)
100
101
102 # Make the OSMesa library
103 $(LIBDIR)/$(OSMESA_LIB): $(OSMESA_OBJECTS)
104 if [ ${OSMESA_LIB} ] ; then \
105 $(TOP)/bin/mklib -o $(OSMESA_LIB_NAME) -major $(MESA_MAJOR) \
106 -minor $(MESA_MINOR) -patch $(GL_TINY) -L$(LIBDIR) \
107 -l$(GL_LIB_NAME) -install $(LIBDIR) \
108 $(MKLIB_OPTIONS) $(OSMESA_OBJECTS) ; \
109 fi
110
111
112 # Make an optional library with _just_ core objects
113 # XXX this should probably be moved into a separate makefile
114 libmesa: $(LIBDIR)/$(MESA_LIB)
115 if [ ${MESA_LIB} ] ; then \
116 $(MAKELIB) $(MESA_LIB) $(MESA_MAJOR) \
117 $(MESA_MINOR) $(GL_TINY) $(CORE_OBJECTS) ; \
118 fi
119 if [ ${MESA_LIB} ] ; then rm -f $(LIBDIR)/$(MESA_LIB)* ; fi
120 if [ ${MESA_LIB} ] ; then mv $(MESA_LIB)* $(LIBDIR) ; fi
121 $(LIBDIR)/$(MESA_LIB): $(CORE_OBJECTS)
122
123
124
125 # Run 'make -f Makefile.X11 dep' to update the dependencies if you change
126 # what's included by any source file.
127 dep: $(SOURCES)
128 makedepend -fdepend -Y $(INCLUDE_DIRS) -DGGI -DSVGA -DFX $(SOURCES)
129
130
131 # Emacs tags
132 tags:
133 etags `find . -name \*.[ch]` `find ../include`
134
135
136 # Remove .o and backup files
137 clean:
138 -rm -f *.a
139 -rm -f */*.o */*~ */*.o */*~
140 -rm -f drivers/*/*.o drivers/*/*/*.o
141
142
143 include $(TOP)/Make-config
144
145 include depend