Makefile revision 3dd12ccc069790872e95f3f51ddc39991a06242f
1# src/gallium/targets/gbm/Makefile
2
3TOP = ../../../..
4include $(TOP)/configs/current
5
6PIPE_PREFIX := pipe_
7
8GBM_BACKEND = gbm_gallium_drm
9GBM_SOURCES = gbm.c pipe_loader.c
10
11GBM_INCLUDES = \
12	       -I$(TOP)/include \
13	       -I$(TOP)/src/gallium/state_trackers/gbm \
14	       -I$(TOP)/src/gbm/main \
15	       -I$(TOP)/src/gallium/auxiliary \
16	       -I$(TOP)/src/gallium/include \
17
18GBM_LIBS = $(LIBUDEV_LIBS) $(LIBDRM_LIB) -lm \
19	   $(TOP)/src/gallium/state_trackers/gbm/libgbm.a \
20	   $(TOP)/src/gallium/drivers/identity/libidentity.a \
21	   $(TOP)/src/gallium/drivers/galahad/libgalahad.a \
22	   $(TOP)/src/gallium/drivers/trace/libtrace.a \
23	   $(TOP)/src/gallium/drivers/rbug/librbug.a \
24	   $(GALLIUM_AUXILIARIES)
25
26
27GBM_CFLAGS = \
28	     -DGBM_BACKEND_SEARCH_DIR=\"$(INSTALL_LIB_DIR)/gbm\" \
29	     -DPIPE_PREFIX=\"$(PIPE_PREFIX)\" \
30	     $(LIBUDEV_CFLAGS) \
31	     $(LIBDRM_CFLAGS)  
32
33
34pipe_INCLUDES = \
35	-I$(TOP)/include \
36	-I$(TOP)/src/gallium/auxiliary \
37	-I$(TOP)/src/gallium/drivers \
38	-I$(TOP)/src/gallium/include \
39	-I$(TOP)/src/gallium/winsys
40
41pipe_LIBS = \
42	$(TOP)/src/gallium/drivers/identity/libidentity.a \
43	$(TOP)/src/gallium/drivers/trace/libtrace.a \
44	$(TOP)/src/gallium/drivers/rbug/librbug.a \
45	$(GALLIUM_AUXILIARIES)
46
47# as if we are DRI modules
48pipe_SYS = $(DRI_LIB_DEPS)
49
50pipe_CLFLAGS = \
51	-DGALLIUM_RBUG -DGALLIUM_TRACE -DGALLIUM_GALAHAD \
52	$(LIBDRM_CFLAGS)
53
54pipe_LDFLAGS = -Wl,--no-undefined
55
56# i915 pipe driver
57i915_LIBS = \
58	$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
59	$(TOP)/src/gallium/drivers/i915/libi915.a
60i915_SYS = -ldrm_intel
61
62# nouveau pipe driver
63nouveau_LIBS = \
64	$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
65	$(TOP)/src/gallium/drivers/nv30/libnv30.a \
66	$(TOP)/src/gallium/drivers/nv50/libnv50.a \
67	$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
68	$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
69nouveau_SYS = -ldrm_nouveau
70
71# r300 pipe driver
72r300_LIBS = \
73	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
74	$(TOP)/src/gallium/drivers/r300/libr300.a
75r300_SYS += -ldrm_radeon
76
77# r600 pipe driver
78r600_LIBS = \
79	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
80	$(TOP)/src/gallium/drivers/r600/libr600.a
81r600_SYS += -ldrm_radeon
82
83# radeonsi pipe driver
84radeonsi_LIBS = \
85	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
86	$(TOP)/src/gallium/drivers/radeonsi/libradeonsi.a
87radeonsi_SYS += -ldrm_radeon
88
89# vmwgfx pipe driver
90vmwgfx_LIBS = \
91	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
92	$(TOP)/src/gallium/drivers/svga/libsvga.a
93
94
95
96# LLVM
97ifeq ($(MESA_LLVM),1)
98pipe_SYS += $(LLVM_LIBS)
99pipe_LDFLAGS += $(LLVM_LDFLAGS)
100endif
101
102ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
103pipe_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
104endif
105
106# determine the targets/sources
107_pipe_TARGETS_CC =
108_pipe_TARGETS_CXX =
109pipe_SOURCES =
110
111ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
112_pipe_TARGETS_CC += $(PIPE_PREFIX)i915.so
113pipe_SOURCES += pipe_i915.c
114endif
115
116ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
117_pipe_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
118pipe_SOURCES += pipe_nouveau.c
119endif
120
121ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
122ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
123_pipe_TARGETS_CC += $(PIPE_PREFIX)r300.so
124pipe_SOURCES += pipe_r300.c
125endif
126endif
127
128ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
129ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
130_pipe_TARGETS_CC += $(PIPE_PREFIX)r600.so
131pipe_SOURCES += pipe_r600.c
132endif
133endif
134
135ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
136ifneq ($(findstring radeonsi,$(GALLIUM_DRIVERS_DIRS)),)
137_pipe_TARGETS_CC += $(PIPE_PREFIX)radeonsi.so
138pipe_SOURCES += pipe_radeonsi.c
139endif
140endif
141
142ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
143_pipe_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
144pipe_SOURCES += pipe_vmwgfx.c
145endif
146
147pipe_OBJECTS = $(pipe_SOURCES:.c=.o)
148
149ifeq ($(MESA_LLVM),1)
150pipe_TARGETS_CXX = $(_pipe_TARGETS_CXX) $(_pipe_TARGETS_CC)
151pipe_TARGETS_CC =
152else
153pipe_TARGETS_CXX = $(_pipe_TARGETS_CXX)
154pipe_TARGETS_CC = $(_pipe_TARGETS_CC)
155endif
156
157GBM_EXTRA_TARGETS = $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS_CC)) $(addprefix $(TOP)/$(LIB_DIR)/gbm/, $(pipe_TARGETS_CXX))
158GBM_EXTRA_INSTALL = install-pipes
159GBM_EXTRA_CLEAN = clean-pipes
160GBM_EXTRA_SOURCES = $(pipe_SOURCES)
161
162include $(TOP)/src/gbm/backends/Makefile.template
163
164
165$(GBM_EXTRA_TARGETS): $(TOP)/$(LIB_DIR)/gbm/%: %
166	@$(INSTALL) -d $(dir $@)
167	$(INSTALL) $< $(dir $@)
168
169$(pipe_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(pipe_LIBS) $($*_LIBS)
170	$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
171		-ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
172		$(MKLIB_OPTIONS) $< \
173		-Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
174		$(pipe_SYS) $($*_SYS)
175
176$(pipe_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(pipe_LIBS) $($*_LIBS)
177	$(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
178		-ldflags '-L$(TOP)/$(LIB_DIR) $(pipe_LDFLAGS) $(LDFLAGS)' \
179		$(MKLIB_OPTIONS) $< \
180		-Wl,--start-group $(pipe_LIBS) $($*_LIBS) -Wl,--end-group \
181		$(pipe_SYS) $($*_SYS)
182
183$(pipe_OBJECTS): %.o: %.c
184	$(CC) -c -o $@ $< $(pipe_INCLUDES) $(pipe_CFLAGS) $(CFLAGS)
185
186install-pipes: $(GBM_EXTRA_TARGETS)
187	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/gbm
188	for tgt in $(GBM_EXTRA_TARGETS); do \
189		$(MINSTALL) "$$tgt" $(DESTDIR)$(INSTALL_LIB_DIR)/gbm; \
190	done
191
192clean-pipes:
193	rm -f $(pipe_TARGETS)
194	rm -f $(pipe_OBJECTS)
195