summaryrefslogtreecommitdiff
path: root/src/mesa/Makefile.X11
blob: 1923e14738e9a7eabf3b9c4d29300b3dc1b20040 (plain)
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
123
124
125
126
127
128
129
# Makefile for main Mesa library for Unix/X11-like systems


##### MACROS #####

TOP = ../..

GL_MAJOR = 1
GL_MINOR = 4
GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)

GL_LIB_NAME = "GL"  # may be overridden in Make-config
OSMESA_LIB_NAME = "OSMesa"  # may be overridden in Make-config

LIBDIR = $(TOP)/lib


include sources


# This will probably get set to $(X86_SOURCES) in Make-config:
ASM_SOURCES =

# This should get set in Make-config someday:
DRIVER_SOURCES = \
	$(X11_DRIVER_SOURCES) \
	$(GLIDE_DRIVER_SOURCES) \
	$(SVGA_DRIVER_SOURCES) \
	$(FBDEV_DRIVER_SOURCES)

# All the sources we care about:
SOURCES = \
	$(CORE_SOURCES) \
	$(ASM_SOURCES) \
	$(DRIVER_SOURCES)


ASM_OBJECTS = $(ASM_SOURCES:.S=.o)

DRIVER_OBJECTS = $(DRIVER_SOURCES:.c=.o)

OSMESA_OBJECTS = $(OSMESA_DRIVER_SOURCES:.c=.o)

# All the objects we want to make:
OBJECTS = \
	$(CORE_OBJECTS) \
	$(ASM_OBJECTS) \
	$(DRIVER_OBJECTS)



##### RULES #####

.c.o:
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@

.S.o:
	$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@


x86/matypes.h: main/mtypes.h tnl/t_context.h x86/gen_matypes.c
	$(CC) $(INCLUDE_DIRS) $(CFLAGS) x86/gen_matypes.c -o x86/gen_matypes
	./x86/gen_matypes > x86/matypes.h
	rm -f x86/gen_matypes x86/*.o

x86/common_x86_asm.o: x86/matypes.h



##### TARGETS #####

default:
	@echo "Specify a target configuration"


targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB)


# Make the GL library
$(LIBDIR)/$(GL_LIB): $(OBJECTS)
	$(TOP)/bin/mklib -o $(GL_LIB_NAME) -major $(GL_MAJOR) \
		-minor $(GL_MINOR) -patch $(GL_TINY) -install $(LIBDIR) \
		$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(OBJECTS)


# Make the OSMesa library
$(LIBDIR)/$(OSMESA_LIB): $(OSMESA_OBJECTS)
	if [ ${OSMESA_LIB} ] ; then \
		$(TOP)/bin/mklib -o $(OSMESA_LIB_NAME) -major $(MESA_MAJOR) \
			-minor $(MESA_MINOR) -patch $(GL_TINY) -L$(LIBDIR) \
			-l$(GL_LIB_NAME) -install $(LIBDIR) \
			$(MKLIB_OPTIONS) $(OSMESA_OBJECTS) ; \
	fi


# Make an optional library with _just_ core objects
# XXX this should probably be moved into a separate makefile
libmesa: $(LIBDIR)/$(MESA_LIB)
	if [ ${MESA_LIB} ] ; then \
		$(MAKELIB) $(MESA_LIB) $(MESA_MAJOR) \
			$(MESA_MINOR) $(GL_TINY) $(CORE_OBJECTS) ; \
	fi
	if [ ${MESA_LIB} ] ; then rm -f $(LIBDIR)/$(MESA_LIB)* ; fi
	if [ ${MESA_LIB} ] ; then mv $(MESA_LIB)* $(LIBDIR) ; fi
$(LIBDIR)/$(MESA_LIB):	$(CORE_OBJECTS)



# Run 'make -f Makefile.X11 dep' to update the dependencies if you change
# what's included by any source file.
dep: $(SOURCES)
	makedepend -fdepend -Y $(INCLUDE_DIRS) -DGGI -DSVGA -DFX $(SOURCES)


# Emacs tags
tags:
	etags `find . -name \*.[ch]` `find ../include`


# Remove .o and backup files
clean:
	-rm -f *.a
	-rm -f */*.o */*~ */*.o */*~
	-rm -f drivers/*/*.o drivers/*/*/*.o


include $(TOP)/Make-config

include depend