summaryrefslogtreecommitdiffstats
path: root/src/gallium/targets/egl-static/Makefile
blob: 42d34b8eda15e77c25b8b776697f164b8541835e (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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# src/gallium/targets/egl-static/Makefile
#
# This is Makefile for egl_gallium.so.  It is static in that all state trackers
# and pipe drivers are linked statically when possible.
#
# The following variables are examined
#
#   EGL_PLATFORMS       - platforms to support
#   EGL_CLIENT_APIS     - state trackers to support
#   GALLIUM_WINSYS_DIRS - pipe drivers to support
#   SHARED_GLAPI        - st/mesa can be statically linked or not
#

TOP = ../../../..
include $(TOP)/configs/current

OUTPUTS := egl_gallium

egl_CPPFLAGS := \
	-I$(TOP)/include \
	-I$(TOP)/src/gallium/auxiliary \
	-I$(TOP)/src/gallium/drivers \
	-I$(TOP)/src/gallium/include \
	-I$(TOP)/src/gallium/winsys
egl_LIBS := \
	$(TOP)/src/gallium/drivers/identity/libidentity.a \
	$(TOP)/src/gallium/drivers/trace/libtrace.a \
	$(TOP)/src/gallium/drivers/rbug/librbug.a \
	$(GALLIUM_AUXILIARIES)
egl_SYS :=

egl_SOURCES := \
	egl.c \
	egl_pipe.c \
	egl_st.c

egl_OBJECTS := $(egl_SOURCES:%.c=%.o)

# st/egl
egl_CPPFLAGS += \
	-I$(TOP)/src/gallium/state_trackers/egl \
	-I$(TOP)/src/egl/main \
	-D_EGL_MAIN=_eglMain
egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm -lpthread

# EGL platforms
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
egl_CPPFLAGS += $(LIBDRM_CFLAGS)
egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
endif
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
egl_CPPFLAGS += $(LIBDRM_CFLAGS)
egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
egl_SYS += $(LIBDRM_LIB) $(WAYLAND_LIBS)
endif
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
egl_CPPFLAGS += $(LIBDRM_CFLAGS)
egl_SYS += $(LIBDRM_LIB) -lgbm
endif
ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
endif

# st/mesa
ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
# make st/mesa built-in when there is a single glapi provider
ifeq ($(SHARED_GLAPI),1)
egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
egl_SYS += -lm -lpthread $(DLOPEN_LIBS) -l$(GLAPI_LIB)
else
egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
OUTPUTS += st_GL
endif # SHARED_GLAPI
endif

# st/vega
ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
egl_CPPFLAGS += -I$(TOP)/src/gallium/state_trackers/vega -DFEATURE_VG=1
egl_LIBS += $(TOP)/src/gallium/state_trackers/vega/libvega.a
egl_SYS += -lm -l$(VG_LIB)
endif

# i915
ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_I915=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
	$(TOP)/src/gallium/drivers/i915/libi915.a
egl_SYS += -ldrm_intel
endif

# i965
ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_I995=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
	$(TOP)/src/gallium/drivers/i965/libi965.a \
	$(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
egl_SYS += -ldrm_intel
endif

# nouveau
ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_NOUVEAU=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
	$(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
	$(TOP)/src/gallium/drivers/nv50/libnv50.a \
	$(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
	$(TOP)/src/gallium/drivers/nouveau/libnouveau.a
egl_SYS += -ldrm_nouveau
endif

# r300
ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_R300=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
	$(TOP)/src/gallium/drivers/r300/libr300.a
endif

# r600
ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_R600=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
	$(TOP)/src/gallium/drivers/r600/libr600.a
endif

# vmwgfx
ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
egl_CPPFLAGS += -D_EGL_PIPE_VMWGFX=1
egl_LIBS += \
	$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
	$(TOP)/src/gallium/drivers/svga/libsvga.a
endif

# softpipe
ifneq ($(findstring softpipe,$(GALLIUM_DRIVERS_DIRS)),)
egl_CPPFLAGS += -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
egl_LIBS += $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
egl_SYS += -lm
endif

# llvmpipe
ifneq ($(findstring llvmpipe,$(GALLIUM_DRIVERS_DIRS)),)
egl_CPPFLAGS += -DGALLIUM_LLVMPIPE
egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
endif

# sort to remove duplicates
egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
egl_LIBS := $(sort $(egl_LIBS))
egl_SYS := $(sort $(egl_SYS))

# st_GL, built only when shared glapi is not enabled
st_GL_CPPFLAGS := -I $(TOP)/src/mesa -I$(TOP)/src/gallium/include
st_GL_LIBS := $(TOP)/src/mesa/libmesagallium.a $(GALLIUM_AUXILIARIES)
st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)

# LLVM
ifeq ($(MESA_LLVM),1)
egl_SYS += $(LLVM_LIBS)
LDFLAGS += $(LLVM_LDFLAGS)

st_GL_SYS += $(LLVM_LIBS)
endif

OUTPUT_PATH := $(TOP)/$(LIB_DIR)/egl
OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(addsuffix .so, $(OUTPUTS)))

default: $(OUTPUTS)

$(OUTPUT_PATH)/egl_gallium.so: $(egl_OBJECTS) $(egl_LIBS)
	$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
		-ldflags '-L$(TOP)/$(LIB_DIR) -Wl,--no-undefined $(LDFLAGS)' \
		-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
		$(egl_OBJECTS) -Wl,--start-group $(egl_LIBS) -Wl,--end-group \
		$(egl_SYS)

$(OUTPUT_PATH)/st_GL.so: st_GL.o $(st_GL_LIBS)
	$(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
		-ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
		-cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
		$< -Wl,--start-group $(st_GL_LIBS) -Wl,--end-group \
		$(st_GL_SYS)

$(egl_OBJECTS): %.o: %.c
	$(CC) -c -o $@ $< $(egl_CPPFLAGS) $(DEFINES) $(CFLAGS)

st_GL.o: st_GL.c
	$(CC) -c -o $@ $< $(st_GL_CPPFLAGS) $(DEFINES) $(CFLAGS)

install: $(OUTPUTS)
	$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
	for out in $(OUTPUTS); do \
		$(MINSTALL) -m 755 "$$out" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
	done

clean:
	rm -f *.o