Merge branch 'gallium-polygon-stipple'
[mesa.git] / src / gallium / targets / egl-static / Makefile
1 # src/gallium/targets/egl-static/Makefile
2 #
3 # This is Makefile for egl_gallium.so. It is static in that all state trackers
4 # and pipe drivers are linked statically when possible.
5 #
6 # The following variables are examined
7 #
8 # EGL_PLATFORMS - platforms to support
9 # EGL_CLIENT_APIS - state trackers to support
10 # GALLIUM_WINSYS_DIRS - pipe drivers to support
11 # SHARED_GLAPI - st/mesa can be statically linked or not
12 #
13
14 TOP = ../../../..
15 include $(TOP)/configs/current
16
17 OUTPUTS := egl_gallium
18
19 egl_CPPFLAGS := \
20 -I$(TOP)/include \
21 -I$(TOP)/src/gallium/auxiliary \
22 -I$(TOP)/src/gallium/drivers \
23 -I$(TOP)/src/gallium/include \
24 -I$(TOP)/src/gallium/winsys
25 egl_LIBS := \
26 $(TOP)/src/gallium/drivers/identity/libidentity.a \
27 $(TOP)/src/gallium/drivers/trace/libtrace.a \
28 $(TOP)/src/gallium/drivers/rbug/librbug.a \
29 $(GALLIUM_AUXILIARIES)
30 egl_SYS :=
31
32 egl_SOURCES := \
33 egl.c \
34 egl_pipe.c \
35 egl_st.c
36
37 egl_OBJECTS := $(egl_SOURCES:%.c=%.o)
38
39 # st/egl
40 egl_CPPFLAGS += \
41 -I$(TOP)/src/gallium/state_trackers/egl \
42 -I$(TOP)/src/egl/main \
43 -D_EGL_MAIN=_eglMain
44 egl_LIBS += $(TOP)/src/gallium/state_trackers/egl/libegl.a
45 egl_SYS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) -lEGL -lm -lpthread
46
47 # EGL platforms
48 ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
49 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
50 egl_LIBS += $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a
51 egl_SYS += -lX11 -lXext -lXfixes $(LIBDRM_LIB)
52 endif
53 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
54 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
55 egl_LIBS += $(TOP)/src/gallium/winsys/sw/wayland/libws_wayland.a
56 egl_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
57 egl_SYS += $(LIBDRM_LIB) $(WAYLAND_LIBS)
58 endif
59 ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
60 egl_CPPFLAGS += $(LIBDRM_CFLAGS)
61 egl_SYS += $(LIBDRM_LIB) -lgbm
62 endif
63 ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
64 egl_LIBS += $(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a
65 endif
66
67 # st/mesa
68 ifneq ($(filter $(GL_LIB), $(EGL_CLIENT_APIS)),)
69 egl_CPPFLAGS += -I$(TOP)/src/mesa $(API_DEFINES)
70 # make st/mesa built-in when there is a single glapi provider
71 ifeq ($(SHARED_GLAPI),1)
72 egl_LIBS += $(TOP)/src/mesa/libmesagallium.a
73 egl_SYS += -lm -lpthread $(DLOPEN_LIBS) -l$(GLAPI_LIB)
74 else
75 egl_CPPFLAGS += -D_EGL_EXTERNAL_GL=1
76 OUTPUTS += st_GL
77 endif # SHARED_GLAPI
78 endif
79
80 # st/vega
81 ifneq ($(filter $(VG_LIB), $(EGL_CLIENT_APIS)),)
82 egl_CPPFLAGS += -I$(TOP)/src/gallium/state_trackers/vega -DFEATURE_VG=1
83 egl_LIBS += $(TOP)/src/gallium/state_trackers/vega/libvega.a
84 egl_SYS += -lm -l$(VG_LIB)
85 endif
86
87 # i915
88 ifneq ($(findstring i915/drm,$(GALLIUM_WINSYS_DIRS)),)
89 egl_CPPFLAGS += -D_EGL_PIPE_I915=1
90 egl_LIBS += \
91 $(TOP)/src/gallium/winsys/i915/drm/libi915drm.a \
92 $(TOP)/src/gallium/drivers/i915/libi915.a
93 egl_SYS += -ldrm_intel
94 endif
95
96 # i965
97 ifneq ($(findstring i965/drm,$(GALLIUM_WINSYS_DIRS)),)
98 egl_CPPFLAGS += -D_EGL_PIPE_I995=1
99 egl_LIBS += \
100 $(TOP)/src/gallium/winsys/i965/drm/libi965drm.a \
101 $(TOP)/src/gallium/drivers/i965/libi965.a \
102 $(TOP)/src/gallium/winsys/sw/wrapper/libwsw.a
103 egl_SYS += -ldrm_intel
104 endif
105
106 # nouveau
107 ifneq ($(findstring nouveau/drm,$(GALLIUM_WINSYS_DIRS)),)
108 egl_CPPFLAGS += -D_EGL_PIPE_NOUVEAU=1
109 egl_LIBS += \
110 $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
111 $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
112 $(TOP)/src/gallium/drivers/nv50/libnv50.a \
113 $(TOP)/src/gallium/drivers/nvc0/libnvc0.a \
114 $(TOP)/src/gallium/drivers/nouveau/libnouveau.a
115 egl_SYS += -ldrm_nouveau
116 endif
117
118 # r300
119 ifneq ($(findstring radeon/drm,$(GALLIUM_WINSYS_DIRS)),)
120 egl_CPPFLAGS += -D_EGL_PIPE_R300=1
121 egl_LIBS += \
122 $(TOP)/src/gallium/winsys/radeon/drm/libradeonwinsys.a \
123 $(TOP)/src/gallium/drivers/r300/libr300.a
124 egl_SYS += -ldrm_radeon
125 endif
126
127 # r600
128 ifneq ($(findstring r600/drm,$(GALLIUM_WINSYS_DIRS)),)
129 egl_CPPFLAGS += -D_EGL_PIPE_R600=1
130 egl_LIBS += \
131 $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
132 $(TOP)/src/gallium/drivers/r600/libr600.a
133 egl_SYS += -ldrm_radeon
134 endif
135
136 # vmwgfx
137 ifneq ($(findstring svga/drm,$(GALLIUM_WINSYS_DIRS)),)
138 egl_CPPFLAGS += -D_EGL_PIPE_VMWGFX=1
139 egl_LIBS += \
140 $(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
141 $(TOP)/src/gallium/drivers/svga/libsvga.a
142 endif
143
144 # swrast
145 egl_CPPFLAGS += -DGALLIUM_SOFTPIPE -DGALLIUM_RBUG -DGALLIUM_TRACE
146 egl_LIBS += $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a
147 egl_SYS += -lm
148
149 # sort to remove duplicates
150 egl_CPPFLAGS := $(sort $(egl_CPPFLAGS))
151 egl_LIBS := $(sort $(egl_LIBS))
152 egl_SYS := $(sort $(egl_SYS))
153
154 # st_GL, built only when shared glapi is not enabled
155 st_GL_CPPFLAGS := -I $(TOP)/src/mesa -I$(TOP)/src/gallium/include
156 st_GL_LIBS := $(TOP)/src/mesa/libmesagallium.a $(GALLIUM_AUXILIARIES)
157 st_GL_SYS := -lm -lpthread $(DLOPEN_LIBS)
158
159 # LLVM
160 ifeq ($(MESA_LLVM),1)
161 egl_CPPFLAGS += -DGALLIUM_LLVMPIPE
162 egl_LIBS += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
163 egl_SYS += $(LLVM_LIBS)
164 LDFLAGS += $(LLVM_LDFLAGS)
165
166 st_GL_SYS += $(LLVM_LIBS)
167 endif
168
169 OUTPUT_PATH := $(TOP)/$(LIB_DIR)/egl
170 OUTPUTS := $(addprefix $(OUTPUT_PATH)/, $(addsuffix .so, $(OUTPUTS)))
171
172 default: $(OUTPUTS)
173
174 $(OUTPUT_PATH)/egl_gallium.so: $(egl_OBJECTS) $(egl_LIBS)
175 $(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
176 -ldflags '-L$(TOP)/$(LIB_DIR) -Wl,--no-undefined $(LDFLAGS)' \
177 -cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
178 $(egl_OBJECTS) -Wl,--start-group $(egl_LIBS) -Wl,--end-group \
179 $(egl_SYS)
180
181 $(OUTPUT_PATH)/st_GL.so: st_GL.o $(st_GL_LIBS)
182 $(MKLIB) -o $(notdir $@) -noprefix -linker '$(CXX)' \
183 -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
184 -cplusplus -install $(OUTPUT_PATH) $(MKLIB_OPTIONS) \
185 $< -Wl,--start-group $(st_GL_LIBS) -Wl,--end-group \
186 $(st_GL_SYS)
187
188 $(egl_OBJECTS): %.o: %.c
189 $(CC) -c -o $@ $< $(egl_CPPFLAGS) $(DEFINES) $(CFLAGS)
190
191 st_GL.o: st_GL.c
192 $(CC) -c -o $@ $< $(st_GL_CPPFLAGS) $(DEFINES) $(CFLAGS)
193
194 install: $(OUTPUTS)
195 $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
196 for out in $(OUTPUTS); do \
197 $(MINSTALL) -m 755 "$$out" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
198 done
199
200 clean:
201 rm -f *.o