summaryrefslogtreecommitdiff
path: root/src/gallium/targets/Makefile.egl
blob: 315856014b72293e6226b2d23ff9abd791818a1c (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
# src/gallium/winsys/drm/Makefile.egl

# The driver Makefile should define
#
#   EGL_DRIVER_NAME, the name of the driver
#   EGL_DRIVER_SOURCES, the sources of the driver
#   EGL_DRIVER_LIBS, extra libraries needed by the driver
#   EGL_DRIVER_PIPES, the pipe drivers of the driver
#
# before including this file.

EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)

common_LIBS = -ldrm -lm -ldl

# ximage backend calls gallium_wrap_screen, which requires libidentity.a and
# libtrace.a
x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a \
	 $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
	 $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
	 $(TOP)/src/gallium/drivers/identity/libidentity.a \
	 $(TOP)/src/gallium/drivers/trace/libtrace.a \
	 $(TOP)/src/gallium/drivers/rbug/librbug.a

x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes

kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
kms_LIBS = $(common_LIBS)

fbdev_ST = \
	$(TOP)/src/gallium/state_trackers/egl/libeglfbdev.a \
	$(TOP)/src/gallium/winsys/sw/fbdev/libfbdev.a \
	$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
	$(TOP)/src/gallium/drivers/identity/libidentity.a \
	$(TOP)/src/gallium/drivers/trace/libtrace.a \
	$(TOP)/src/gallium/drivers/rbug/librbug.a
fbdev_LIBS = $(common_LIBS)

ifeq ($(MESA_LLVM),1)
x11_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
x11_LIBS += $(LLVM_LIBS)
fbdev_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
fbdev_LIBS += $(LLVM_LIBS)
LDFLAGS += $(LLVM_LDFLAGS)
endif

### Include directories
INCLUDES = \
	-I$(TOP)/include \
	-I$(TOP)/src/gallium/include \
	-I$(TOP)/src/gallium/auxiliary \
	-I$(TOP)/src/gallium/drivers \
	-I$(TOP)/src/gallium/winsys \
	-I$(TOP)/src/egl/main \
	$(LIBDRM_CFLAGS)

##### RULES #####

.c.o:
	$(CC) -c $(INCLUDES) $(CFLAGS) $(EGL_DRIVER_DEFINES) $< -o $@


##### TARGETS #####

ifeq ($(EGL_DRIVER_NAME),swrast)
EGL_PLATFORMS := $(filter-out kms, $(EGL_PLATFORMS))
else
EGL_PLATFORMS := $(filter-out fbdev, $(EGL_PLATFORMS))
endif

EGL_PLATFORM_DRIVERS = $(foreach plat, $(EGL_PLATFORMS), egl_$(plat)_$(EGL_DRIVER_NAME).so)

EGL_PLATFORM_LIBS = $(foreach drv, $(EGL_PLATFORM_DRIVERS), $(TOP)/$(LIB_DIR)/egl/$(drv))

default: $(EGL_PLATFORM_LIBS)

$(EGL_PLATFORM_LIBS): $(TOP)/$(LIB_DIR)/egl/%.so: %.so
	@$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
	$(INSTALL) $< $(TOP)/$(LIB_DIR)/egl

define mklib-egl
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
	$(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
	-Wl,--start-group $($(1)_ST) $(EGL_DRIVER_PIPES) \
	$(GALLIUM_AUXILIARIES) -Wl,--end-group \
	$($(1)_LIBS) $(EGL_DRIVER_LIBS) -L$(TOP)/$(LIB_DIR) -l$(EGL_LIB)
endef

egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
	$(call mklib-egl,x11)

egl_kms_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(kms_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
	$(call mklib-egl,kms)

egl_fbdev_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(fbdev_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
	$(call mklib-egl,fbdev)

clean:
	-rm -f $(EGL_DRIVER_OBJECTS)
	-rm -f $(EGL_PLATFORM_DRIVERS)

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

depend: