summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/Makefile.egl_g3d
blob: d8f47396d168404f9b33442f9101bf762059a521 (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
# src/gallium/winsys/drm/Makefile.egl_g3d

# 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

x11_ST = $(TOP)/src/gallium/state_trackers/egl_g3d/libeglx11.a
x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes

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

##### RULES #####

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


##### TARGETS #####

EGL_DISPLAY_DRIVERS = $(foreach dpy, $(EGL_DISPLAYS), egl_$(dpy)_$(EGL_DRIVER_NAME).so)

LIB_GALLIUM_DIR = $(TOP)/$(LIB_DIR)/gallium
EGL_DISPLAY_LIBS = $(foreach drv, $(EGL_DISPLAY_DRIVERS), $(LIB_GALLIUM_DIR)/$(drv))

default: $(EGL_DISPLAY_LIBS)

$(EGL_DISPLAY_LIBS): $(LIB_GALLIUM_DIR)/%.so: %.so
	@mkdir -p $(LIB_GALLIUM_DIR)
	$(INSTALL) $^ $(LIB_GALLIUM_DIR)

define mklib-egl
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
	$(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
	-Wl,--whole-archive $($(1)_ST) -Wl,--no-whole-archive \
	$(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) $($(1)_LIBS) $(EGL_DRIVER_LIBS)
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)

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

install: $(EGL_DISPLAY_LIBS)
	@$(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
	@echo "Install $(EGL_DISPLAY_DRIVERS)"
	@for lib in "$(EGL_DISPLAY_LIBS)"; do \
		$(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR); \
	done

depend: