targets/egl: Give egl targets a good build enviroment
[mesa.git] / src / gallium / targets / Makefile.egl
1 # src/gallium/winsys/drm/Makefile.egl
2
3 # The driver Makefile should define
4 #
5 # EGL_DRIVER_NAME, the name of the driver
6 # EGL_DRIVER_SOURCES, the sources of the driver
7 # EGL_DRIVER_LIBS, extra libraries needed by the driver
8 # EGL_DRIVER_PIPES, the pipe drivers of the driver
9 #
10 # before including this file.
11
12 EGL_DRIVER_OBJECTS = $(EGL_DRIVER_SOURCES:.c=.o)
13
14 common_LIBS = -ldrm -lm -ldl
15
16 # ximage backend calls gallium_wrap_screen, which requires libidentity.a and
17 # libtrace.a
18 x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a \
19 $(TOP)/src/gallium/winsys/sw/xlib/libws_xlib.a \
20 $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
21 $(TOP)/src/gallium/drivers/identity/libidentity.a \
22 $(TOP)/src/gallium/drivers/trace/libtrace.a \
23 $(TOP)/src/gallium/drivers/rbug/librbug.a
24
25 x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
26
27 ifeq ($(MESA_LLVM),1)
28 x11_ST += $(TOP)/src/gallium/drivers/llvmpipe/libllvmpipe.a
29 x11_LIBS += $(LLVM_LIBS)
30 LDFLAGS += $(LLVM_LDFLAGS)
31 endif
32
33 kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
34 kms_LIBS = $(common_LIBS)
35
36 ### Include directories
37 INCLUDES = \
38 -I$(TOP)/include \
39 -I$(TOP)/src/gallium/include \
40 -I$(TOP)/src/gallium/auxiliary \
41 -I$(TOP)/src/gallium/drivers \
42 -I$(TOP)/src/gallium/winsys \
43 -I$(TOP)/src/egl/main \
44 $(LIBDRM_CFLAGS)
45
46 ##### RULES #####
47
48 .c.o:
49 $(CC) -c $(INCLUDES) $(CFLAGS) $(EGL_DRIVER_DEFINES) $< -o $@
50
51
52 ##### TARGETS #####
53
54 EGL_DISPLAY_DRIVERS = $(foreach dpy, $(EGL_DISPLAYS), egl_$(dpy)_$(EGL_DRIVER_NAME).so)
55
56 EGL_DISPLAY_LIBS = $(foreach drv, $(EGL_DISPLAY_DRIVERS), $(TOP)/$(LIB_DIR)/egl/$(drv))
57
58 default: $(EGL_DISPLAY_LIBS)
59
60 $(EGL_DISPLAY_LIBS): $(TOP)/$(LIB_DIR)/egl/%.so: %.so
61 @$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
62 $(INSTALL) $< $(TOP)/$(LIB_DIR)/egl
63
64 define mklib-egl
65 $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
66 $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
67 -Wl,--start-group $($(1)_ST) $(EGL_DRIVER_PIPES) \
68 $(GALLIUM_AUXILIARIES) -Wl,--end-group \
69 $($(1)_LIBS) $(EGL_DRIVER_LIBS) -L$(TOP)/$(LIB_DIR) -l$(EGL_LIB)
70 endef
71
72 egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
73 $(call mklib-egl,x11)
74
75 egl_kms_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(kms_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
76 $(call mklib-egl,kms)
77
78 clean:
79 -rm -f $(EGL_DRIVER_OBJECTS)
80 -rm -f $(EGL_DISPLAY_DRIVERS)
81
82 install: $(EGL_DISPLAY_LIBS)
83 $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
84 for lib in $(EGL_DISPLAY_LIBS); do \
85 $(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
86 done
87
88 depend: