winsys/drm: Handle circular dependencies in Makefile.egl.
[mesa.git] / src / gallium / winsys / drm / 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 x11_ST = $(TOP)/src/gallium/state_trackers/egl/libeglx11.a \
17 $(TOP)/src/gallium/winsys/xlib/libws_xlib.a
18 x11_LIBS = $(common_LIBS) -lX11 -lXext -lXfixes
19
20 kms_ST = $(TOP)/src/gallium/state_trackers/egl/libeglkms.a
21 kms_LIBS = $(common_LIBS)
22
23 ##### RULES #####
24
25 .c.o:
26 $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
27
28
29 ##### TARGETS #####
30
31 EGL_DISPLAY_DRIVERS = $(foreach dpy, $(EGL_DISPLAYS), egl_$(dpy)_$(EGL_DRIVER_NAME).so)
32
33 EGL_DISPLAY_LIBS = $(foreach drv, $(EGL_DISPLAY_DRIVERS), $(TOP)/$(LIB_DIR)/$(drv))
34
35 default: $(EGL_DISPLAY_LIBS)
36
37 $(EGL_DISPLAY_LIBS): $(TOP)/$(LIB_DIR)/%.so: %.so
38 $(INSTALL) $< $(TOP)/$(LIB_DIR)
39
40 define mklib-egl
41 $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
42 $(MKLIB_OPTIONS) $(EGL_DRIVER_OBJECTS) \
43 -Wl,--start-group $($(1)_ST) $(EGL_DRIVER_PIPES) \
44 $(GALLIUM_AUXILIARIES) -Wl,--end-group \
45 $($(1)_LIBS) $(EGL_DRIVER_LIBS)
46 endef
47
48 egl_x11_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(x11_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
49 $(call mklib-egl,x11)
50
51 egl_kms_$(EGL_DRIVER_NAME).so: $(EGL_DRIVER_OBJECTS) $(kms_ST) $(EGL_DRIVER_PIPES) $(GALLIUM_AUXILIARIES) Makefile
52 $(call mklib-egl,kms)
53
54 clean:
55 -rm -f $(EGL_DRIVER_OBJECTS)
56 -rm -f $(EGL_DISPLAY_DRIVERS)
57
58 install: $(EGL_DISPLAY_LIBS)
59 $(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
60 for lib in $(EGL_DISPLAY_LIBS); do \
61 $(MINSTALL) -m 755 "$$lib" $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR); \
62 done
63
64 depend: