1TOP = ../../../.. 2include $(TOP)/configs/current 3 4common_INCLUDES = \ 5 -I. \ 6 -I$(TOP)/src/gallium/include \ 7 -I$(TOP)/src/gallium/auxiliary \ 8 -I$(TOP)/src/egl/main \ 9 -I$(TOP)/src/egl/wayland/wayland-drm/ \ 10 -I$(TOP)/include 11 12common_SOURCES = $(wildcard common/*.c) 13common_OBJECTS = $(common_SOURCES:.c=.o) 14 15x11_INCLUDES = \ 16 -I$(TOP)/src/gallium/drivers \ 17 -I$(TOP)/src/glx \ 18 -I$(TOP)/src/mapi \ 19 -I$(TOP)/src/mesa \ 20 $(X11_CFLAGS) \ 21 $(shell $(PKG_CONFIG) --cflags-only-I libdrm dri2proto) 22 23x11_SOURCES = $(wildcard x11/*.c) \ 24 $(TOP)/src/glx/dri2.c 25x11_OBJECTS = $(x11_SOURCES:.c=.o) 26 27wayland_INCLUDES = \ 28 -I$(TOP)/src/gallium/winsys \ 29 -I$(TOP)/src/egl/wayland/wayland-egl \ 30 -I$(TOP)/src/egl/wayland/wayland-drm \ 31 $(shell $(PKG_CONFIG) --cflags-only-I libdrm wayland-client wayland-server) 32 33wayland_SOURCES = $(wildcard wayland/*.c) 34wayland_OBJECTS = $(wayland_SOURCES:.c=.o) 35 36drm_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell $(PKG_CONFIG) --cflags-only-I libdrm) \ 37 -I$(TOP)/src/gbm/main -I$(TOP)/src/gallium/state_trackers/gbm 38drm_SOURCES = $(wildcard drm/*.c) 39drm_OBJECTS = $(drm_SOURCES:.c=.o) 40 41 42fbdev_INCLUDES = -I$(TOP)/src/gallium/winsys/sw 43fbdev_SOURCES = $(wildcard fbdev/*.c) 44fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o) 45 46 47null_INCLUDES = -I$(TOP)/src/gallium/winsys/sw 48null_SOURCES = $(wildcard null/*.c) 49null_OBJECTS = $(null_SOURCES:.c=.o) 50 51 52ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(drm_INCLUDES) $(fbdev_INCLUDES) $(null_INCLUDES) $(wayland_INCLUDES) 53ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES) $(null_SOURCES) $(wayland_SOURCES) 54 55EGL_OBJECTS = $(common_OBJECTS) 56EGL_CPPFLAGS = $(common_INCLUDES) 57 58# add backends 59ifneq ($(findstring x11, $(EGL_PLATFORMS)),) 60EGL_OBJECTS += $(x11_OBJECTS) 61EGL_CPPFLAGS += -DHAVE_X11_BACKEND 62endif 63ifneq ($(findstring wayland, $(EGL_PLATFORMS)),) 64EGL_OBJECTS += $(wayland_OBJECTS) 65EGL_CPPFLAGS += -DHAVE_WAYLAND_BACKEND 66DEFINES += -DHAVE_WAYLAND_BACKEND 67common_INCLUDES += $(wayland_INCLUDES) 68endif 69ifneq ($(findstring drm, $(EGL_PLATFORMS)),) 70EGL_OBJECTS += $(drm_OBJECTS) 71EGL_CPPFLAGS += -DHAVE_DRM_BACKEND 72endif 73ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) 74EGL_OBJECTS += $(fbdev_OBJECTS) 75EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND 76endif 77ifneq ($(findstring null, $(EGL_PLATFORMS)),) 78EGL_OBJECTS += $(null_OBJECTS) 79EGL_CPPFLAGS += -DHAVE_NULL_BACKEND 80endif 81 82##### TARGETS ##### 83 84default: depend libegl.a 85 86libegl.a: $(EGL_OBJECTS) Makefile 87 $(MKLIB) -o egl -static $(EGL_OBJECTS) 88 89depend: 90 rm -f depend 91 touch depend 92 $(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null 93 94clean: 95 rm -f libegl.a 96 rm -f $(EGL_OBJECTS) 97 rm -f depend depend.bak 98 99# Dummy target 100install: 101 @echo -n "" 102 103##### RULES ##### 104 105define egl-cc 106$(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ 107endef 108 109$(common_OBJECTS): %.o: %.c 110 $(CC) -c $(EGL_CPPFLAGS) $(DEFINES) $(CFLAGS) $< -o $@ 111 112$(x11_OBJECTS): %.o: %.c 113 $(call egl-cc,x11) 114 115$(wayland_OBJECTS): %.o: %.c 116 $(call egl-cc,wayland) 117 118$(drm_OBJECTS): %.o: %.c 119 $(call egl-cc,drm) 120 121$(fbdev_OBJECTS): %.o: %.c 122 $(call egl-cc,fbdev) 123 124$(null_OBJECTS): %.o: %.c 125 $(call egl-cc,null) 126 127sinclude depend 128