Merge branch 'gallium-userbuf'
[mesa.git] / src / gallium / targets / pipe-loader / Makefile
1 # Makefile for building pipe driver shared libraries.
2 #
3 # Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
4 #
5 TOP = ../../../..
6 include $(TOP)/configs/current
7
8 PIPE_PREFIX ?= pipe_
9
10 PIPE_CPPFLAGS = \
11 -DGALLIUM_RBUG \
12 -DGALLIUM_TRACE \
13 -DGALLIUM_GALAHAD \
14 -I$(TOP)/include \
15 -I$(TOP)/src/gallium/auxiliary \
16 -I$(TOP)/src/gallium/drivers \
17 -I$(TOP)/src/gallium/include \
18 -I$(TOP)/src/gallium/winsys
19
20 PIPE_LIBS = \
21 $(TOP)/src/gallium/drivers/identity/libidentity.a \
22 $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
23 $(TOP)/src/gallium/drivers/trace/libtrace.a \
24 $(TOP)/src/gallium/drivers/rbug/librbug.a \
25 $(GALLIUM_AUXILIARIES)
26
27 PIPE_SYS = $(LIBDRM_LIB) -lm -lpthread $(DLOPEN_LIBS)
28
29 PIPE_CFLAGS = $(LIBDRM_CFLAGS)
30
31 PIPE_LDFLAGS = -Wl,--no-undefined
32
33 # i915 pipe driver
34 i915_LIBS = \
35 $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
36 $(TOP)/src/gallium/drivers/i915/libi915.a
37 i915_SYS = -ldrm_intel
38
39 # nouveau pipe driver
40 nouveau_LIBS = \
41 $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
42 $(TOP)/src/gallium/drivers/nv30/libnv30.a \
43 $(TOP)/src/gallium/drivers/nv50/libnv50.a \
44 $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
45 $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
46 nouveau_SYS = -ldrm_nouveau
47
48 # r300 pipe driver
49 r300_LIBS = \
50 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
51 $(TOP)/src/gallium/drivers/r300/libr300.a
52 r300_SYS += -ldrm_radeon
53
54 # r600 pipe driver
55 r600_LIBS = \
56 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
57 $(TOP)/src/gallium/drivers/r600/libr600.a
58 r600_SYS += -ldrm_radeon
59
60 # vmwgfx pipe driver
61 vmwgfx_LIBS = \
62 $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
63 $(TOP)/src/gallium/drivers/svga/libsvga.a
64
65 ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
66 swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
67 PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
68 else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
69 swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
70 PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
71 endif
72
73 # LLVM
74 ifeq ($(MESA_LLVM),1)
75 PIPE_SYS += $(LLVM_LIBS)
76 PIPE_LDFLAGS += $(LLVM_LDFLAGS)
77 endif
78
79 # determine the targets/sources
80 _PIPE_TARGETS_CC =
81 _PIPE_TARGETS_CXX =
82 PIPE_SOURCES =
83
84 ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
85 _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
86 PIPE_SOURCES += pipe_i915.c
87 endif
88
89 ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
90 _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
91 PIPE_SOURCES += pipe_nouveau.c
92 endif
93
94 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
95 ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
96 _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
97 PIPE_SOURCES += pipe_r300.c
98 endif
99 endif
100
101 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
102 ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
103 _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
104 PIPE_SOURCES += pipe_r600.c
105 endif
106 endif
107
108 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
109 _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
110 PIPE_SOURCES += pipe_vmwgfx.c
111 endif
112
113 ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
114 _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
115 PIPE_SOURCES += pipe_swrast.c
116 endif
117
118 PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)
119
120 ifeq ($(MESA_LLVM),1)
121 PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
122 PIPE_TARGETS_CC =
123 else
124 PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
125 PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
126 endif
127
128 PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX)
129
130 default: depend $(PIPE_TARGETS)
131
132 .SECONDEXPANSION:
133
134 $(PIPE_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
135 $(MKLIB) -o $@ -noprefix -linker '$(CC)' \
136 -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
137 $(MKLIB_OPTIONS) $< \
138 -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
139 $(PIPE_SYS) $($*_SYS)
140
141 $(PIPE_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
142 $(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
143 -ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
144 $(MKLIB_OPTIONS) $< \
145 -Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
146 $(PIPE_SYS) $($*_SYS)
147
148 $(PIPE_OBJECTS): %.o: %.c
149 $(CC) -c -o $@ $< $(PIPE_CPPFLAGS) $(PIPE_CFLAGS) $(CFLAGS)
150
151 install: $(PIPE_TARGETS)
152 $(INSTALL) -d $(DESTDIR)/$(PIPE_INSTALL_DIR)
153 for tgt in $(PIPE_TARGETS); do \
154 $(MINSTALL) "$$tgt" $(DESTDIR)/$(PIPE_INSTALL_DIR); \
155 done
156
157 clean:
158 rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak
159
160 depend: $(PIPE_SOURCES)
161 rm -f depend
162 touch depend
163 $(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null
164
165 sinclude depend