i915g: Move bootstrap code to targets
[mesa.git] / src / gallium / targets / Makefile.dri
1 # -*-makefile-*-
2
3 ifeq ($(MESA_LLVM),1)
4 PIPE_DRIVERS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
5 LDFLAGS += $(LLVM_LDFLAGS)
6 LD = g++
7 DRIVER_EXTRAS = $(LLVM_LIBS)
8 USE_CXX=1
9 endif
10
11 MESA_MODULES = \
12 $(TOP)/src/mesa/libmesagallium.a \
13 $(GALLIUM_AUXILIARIES)
14
15 COMMON_GALLIUM_SOURCES = \
16 $(TOP)/src/mesa/drivers/dri/common/utils.c \
17 $(TOP)/src/mesa/drivers/dri/common/vblank.c \
18 $(TOP)/src/mesa/drivers/dri/common/dri_util.c \
19 $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c
20
21 COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
22 $(TOP)/src/mesa/drivers/common/driverfuncs.c \
23 $(TOP)/src/mesa/drivers/dri/common/texmem.c \
24 $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c
25
26 COMMON_BM_SOURCES = \
27 $(TOP)/src/mesa/drivers/dri/common/dri_bufmgr.c \
28 $(TOP)/src/mesa/drivers/dri/common/dri_drmpool.c
29
30 INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
31
32 OBJECTS = \
33 $(C_SOURCES:.c=.o) \
34 $(ASM_SOURCES:.S=.o)
35
36
37 ### Include directories
38 SHARED_INCLUDES = \
39 -I. \
40 -I$(TOP)/src/mesa/drivers/dri/common \
41 -Iserver \
42 -I$(TOP)/include \
43 -I$(TOP)/include/GL/internal \
44 -I$(TOP)/src/mapi \
45 -I$(TOP)/src/gallium/include \
46 -I$(TOP)/src/gallium/auxiliary \
47 -I$(TOP)/src/gallium/drivers \
48 -I$(TOP)/src/gallium/winsys \
49 -I$(TOP)/src/mesa \
50 -I$(TOP)/src/mesa/main \
51 -I$(TOP)/src/mesa/math \
52 -I$(TOP)/src/mesa/transform \
53 -I$(TOP)/src/mesa/shader \
54 -I$(TOP)/src/mesa/swrast \
55 -I$(TOP)/src/mesa/swrast_setup \
56 -I$(TOP)/src/egl/main \
57 -I$(TOP)/src/egl/drivers/dri \
58 $(LIBDRM_CFLAGS)
59
60 LIBNAME_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
61
62
63 ##### RULES #####
64
65 .c.o:
66 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
67
68 .S.o:
69 $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
70
71
72 ##### TARGETS #####
73
74 default: depend symlinks $(TOP)/$(LIB_DIR)/gallium $(LIBNAME) $(LIBNAME_STAGING)
75
76 $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) Makefile \
77 $(TOP)/src/mesa/drivers/dri/Makefile.template $(TOP)/src/mesa/drivers/dri/common/dri_test.o
78 $(MKLIB) -o $@.tmp -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
79 $(OBJECTS) $(PIPE_DRIVERS) \
80 -Wl,--start-group $(MESA_MODULES) -Wl,--end-group \
81 $(DRI_LIB_DEPS) $(DRIVER_EXTRAS)
82 if [ "x${USE_CXX}" == "x" ]; then \
83 $(CC) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \
84 else \
85 $(CXX) $(CFLAGS) -o $@.test $(TOP)/src/mesa/drivers/dri/common/dri_test.o $@.tmp $(DRI_LIB_DEPS); \
86 fi
87 @rm -f $@.test
88 mv -f $@.tmp $@
89
90 $(TOP)/$(LIB_DIR)/gallium:
91 mkdir -p $@
92
93 $(LIBNAME_STAGING): $(LIBNAME)
94 $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)/gallium
95
96 depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
97 rm -f depend
98 touch depend
99 $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
100 $(ASM_SOURCES) 2> /dev/null
101
102
103 # Emacs tags
104 tags:
105 etags `find . -name \*.[ch]` `find ../include`
106
107
108 # Remove .o and backup files
109 clean:
110 -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
111 -rm -f depend depend.bak
112
113
114 install: $(LIBNAME)
115 $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
116 $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
117
118
119 include depend