use mklib script to make drivers instead of gcc -shared
[mesa.git] / src / mesa / drivers / dri / Makefile.template
1 # -*-makefile-*-
2
3 MESA_MODULES = $(TOP)/src/mesa/libmesa.a
4
5 COMMON_SOURCES = \
6 ../../common/driverfuncs.c \
7 ../common/mm.c \
8 ../common/utils.c \
9 ../common/texmem.c \
10 ../common/vblank.c \
11 ../common/dri_util.c \
12 ../common/xmlconfig.c \
13 ../common/drirenderbuffer.c
14
15 ifeq ($(WINDOW_SYSTEM),dri)
16 WINOBJ=
17 WINLIB=
18 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) \
19 `pkg-config --cflags libdrm`
20
21 OBJECTS = $(C_SOURCES:.c=.o) \
22 $(ASM_SOURCES:.S=.o)
23
24 else
25 WINOBJ=
26 WINLIB=-L$(MESA)/src/glx/mini
27 MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
28 INCLUDES = $(MINIGLX_INCLUDES) \
29 -I$(DRM_SOURCE_PATH)/shared-core \
30 -I$(DRM_SOURCE_PATH)/libdrm \
31 $(SHARED_INCLUDES)
32
33 OBJECTS = $(C_SOURCES:.c=.o) \
34 $(MINIGLX_SOURCES:.c=.o) \
35 $(ASM_SOURCES:.S=.o)
36 endif
37
38
39 ### Include directories
40 SHARED_INCLUDES = \
41 -I. \
42 -I$(TOP)/src/mesa/drivers/dri/common \
43 -Iserver \
44 -I$(DRM_SOURCE_PATH)/shared-core \
45 -I$(TOP)/include \
46 -I$(TOP)/include/GL/internal \
47 -I$(TOP)/src/mesa \
48 -I$(TOP)/src/mesa/main \
49 -I$(TOP)/src/mesa/glapi \
50 -I$(TOP)/src/mesa/math \
51 -I$(TOP)/src/mesa/transform \
52 -I$(TOP)/src/mesa/shader \
53 -I$(TOP)/src/mesa/swrast \
54 -I$(TOP)/src/mesa/swrast_setup \
55 -I$(TOP)/src/egl/main \
56 -I$(TOP)/src/egl/drivers/dri
57
58 ##### RULES #####
59
60 .c.o:
61 $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
62
63 .S.o:
64 $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
65
66
67 ##### TARGETS #####
68
69 default: depend symlinks $(LIBNAME) $(LIB_DIR)/$(LIBNAME)
70
71
72 #$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile
73 # @echo BUILDING FOR: $(WINDOW_SYSTEM)
74 # $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(LIB_DIR) \
75 # $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) $(OBJECTS)
76
77 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
78 $(TOP)/bin/mklib -noprefix -o $@ \
79 $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
80
81
82 $(LIB_DIR)/$(LIBNAME): $(LIBNAME)
83 install $(LIBNAME) $(LIB_DIR)
84
85
86
87 # Run 'make depend' to update the dependencies if you change
88 # what's included by any source file.
89 .PHONY: depend
90 depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
91 touch depend
92 $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(C_SOURCES) $(ASM_SOURCES) \
93 > /dev/null
94
95
96 # Emacs tags
97 tags:
98 etags `find . -name \*.[ch]` `find ../include`
99
100
101 # Remove .o and backup files
102 clean:
103 -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
104 -rm -f depend depend.bak
105
106 install: $(LIBNAME)
107 install $(LIBNAME) /usr/X11R6/lib/modules/dri/$(LIBNAME)
108
109 include depend