aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/pipe-loader/Makefile
blob: eb3b4fc8aa363782ccead646eb436b4f0f2022f0 (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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Makefile for building pipe driver shared libraries.
#
# Input variables: PIPE_INSTALL_DIR, PIPE_PREFIX (optional)
#
TOP = ../../../..
include $(TOP)/configs/current

PIPE_PREFIX ?= pipe_

PIPE_CPPFLAGS = \
	-DGALLIUM_RBUG \
	-DGALLIUM_TRACE \
	-DGALLIUM_GALAHAD \
	-I$(TOP)/include \
	-I$(TOP)/src/gallium/auxiliary \
	-I$(TOP)/src/gallium/drivers \
	-I$(TOP)/src/gallium/include \
	-I$(TOP)/src/gallium/winsys

PIPE_LIBS = \
	$(TOP)/src/gallium/drivers/identity/libidentity.a \
	$(TOP)/src/gallium/drivers/galahad/libgalahad.a \
	$(TOP)/src/gallium/drivers/trace/libtrace.a \
	$(TOP)/src/gallium/drivers/rbug/librbug.a \
	$(GALLIUM_AUXILIARIES)

PIPE_SYS = $(LIBDRM_LIB) -lm -lpthread $(DLOPEN_LIBS)

PIPE_CFLAGS = $(LIBDRM_CFLAGS)

PIPE_LDFLAGS = -Wl,--no-undefined

# i915 pipe driver
i915_LIBS = \
	$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
	$(TOP)/src/gallium/drivers/i915/libi915.a
i915_SYS = -ldrm_intel

# nouveau pipe driver
nouveau_LIBS = \
	$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
	$(TOP)/src/gallium/drivers/nv30/libnv30.a \
	$(TOP)/src/gallium/drivers/nv50/libnv50.a \
	$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
	$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
nouveau_SYS = -ldrm_nouveau

# r300 pipe driver
r300_LIBS = \
	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
	$(TOP)/src/gallium/drivers/r300/libr300.a
r300_SYS += -ldrm_radeon

# r600 pipe driver
r600_LIBS = \
	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
	$(TOP)/src/gallium/drivers/r600/libr600.a
r600_SYS += -ldrm_radeon

# vmwgfx pipe driver
vmwgfx_LIBS = \
	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
	$(TOP)/src/gallium/drivers/svga/libsvga.a

ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
   swrast_LIBS = $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
   PIPE_CFLAGS += -DGALLIUM_LLVMPIPE
else ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
   swrast_LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
   PIPE_CFLAGS += -DGALLIUM_SOFTPIPE
endif

# LLVM
ifeq ($(MESA_LLVM),1)
   PIPE_SYS += $(LLVM_LIBS)
   PIPE_LDFLAGS += $(LLVM_LDFLAGS)
endif

# determine the targets/sources
_PIPE_TARGETS_CC =
_PIPE_TARGETS_CXX =
PIPE_SOURCES =

ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
   _PIPE_TARGETS_CC += $(PIPE_PREFIX)i915.so
   PIPE_SOURCES += pipe_i915.c
endif

ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
   _PIPE_TARGETS_CXX += $(PIPE_PREFIX)nouveau.so
   PIPE_SOURCES += pipe_nouveau.c
endif

ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r300,$(GALLIUM_DRIVERS_DIRS)),)
   _PIPE_TARGETS_CC += $(PIPE_PREFIX)r300.so
   PIPE_SOURCES += pipe_r300.c
endif
endif

ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
ifneq ($(findstring r600,$(GALLIUM_DRIVERS_DIRS)),)
   _PIPE_TARGETS_CC += $(PIPE_PREFIX)r600.so
   PIPE_SOURCES += pipe_r600.c
endif
endif

ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
   _PIPE_TARGETS_CC += $(PIPE_PREFIX)vmwgfx.so
   PIPE_SOURCES += pipe_vmwgfx.c
endif

ifneq ($(filter llvmpipe softpipe,$(GALLIUM_DRIVERS_DIRS)),)
   _PIPE_TARGETS_CC += $(PIPE_PREFIX)swrast.so
   PIPE_SOURCES += pipe_swrast.c
endif

PIPE_OBJECTS := $(PIPE_SOURCES:.c=.o)

ifeq ($(MESA_LLVM),1)
   PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX) $(_PIPE_TARGETS_CC)
   PIPE_TARGETS_CC =
else
   PIPE_TARGETS_CXX = $(_PIPE_TARGETS_CXX)
   PIPE_TARGETS_CC = $(_PIPE_TARGETS_CC)
endif

PIPE_TARGETS = $(PIPE_TARGETS_CC) $(PIPE_TARGETS_CXX)

default: depend $(PIPE_TARGETS)

.SECONDEXPANSION:

$(PIPE_TARGETS_CC): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
	$(MKLIB) -o $@ -noprefix -linker '$(CC)' \
		-ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
		$(MKLIB_OPTIONS) $< \
		-Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
		$(PIPE_SYS) $($*_SYS)

$(PIPE_TARGETS_CXX): $(PIPE_PREFIX)%.so: pipe_%.o $(PIPE_LIBS) $$(%_LIBS)
	$(MKLIB) -o $@ -noprefix -linker '$(CXX)' \
		-ldflags '-L$(TOP)/$(LIB_DIR) $(PIPE_LDFLAGS) $(LDFLAGS)' \
		$(MKLIB_OPTIONS) $< \
		-Wl,--start-group $(PIPE_LIBS) $($*_LIBS) -Wl,--end-group \
		$(PIPE_SYS) $($*_SYS)

$(PIPE_OBJECTS): %.o: %.c
	$(CC) -c -o $@ $< $(PIPE_CPPFLAGS) $(PIPE_CFLAGS) $(CFLAGS)

install: $(PIPE_TARGETS)
	$(INSTALL) -d $(DESTDIR)/$(PIPE_INSTALL_DIR)
	for tgt in $(PIPE_TARGETS); do \
		$(MINSTALL) "$$tgt" $(DESTDIR)/$(PIPE_INSTALL_DIR); \
	done

clean:
	rm -f $(PIPE_TARGETS) $(PIPE_OBJECTS) depend depend.bak

depend: $(PIPE_SOURCES)
	rm -f depend
	touch depend
	$(MKDEP) $(MKDEP_OPTIONS) $(PIPE_CPPFLAGS) $(PIPE_SOURCES) 2>/dev/null

sinclude depend