1 TOP = ../../../.. 2 include $(TOP)/configs/current 3 4 common_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 12 common_SOURCES = $(wildcard common/*.c) 13 common_OBJECTS = $(common_SOURCES:.c=.o) 14 15 x11_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 23 x11_SOURCES = $(wildcard x11/*.c) \ 24 $(TOP)/src/glx/dri2.c 25 x11_OBJECTS = $(x11_SOURCES:.c=.o) 26 27 wayland_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 33 wayland_SOURCES = $(wildcard wayland/*.c) 34 wayland_OBJECTS = $(wayland_SOURCES:.c=.o) 35 36 drm_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 38 drm_SOURCES = $(wildcard drm/*.c) 39 drm_OBJECTS = $(drm_SOURCES:.c=.o) 40 41 42 fbdev_INCLUDES = -I$(TOP)/src/gallium/winsys/sw 43 fbdev_SOURCES = $(wildcard fbdev/*.c) 44 fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o) 45 46 47 null_INCLUDES = -I$(TOP)/src/gallium/winsys/sw 48 null_SOURCES = $(wildcard null/*.c) 49 null_OBJECTS = $(null_SOURCES:.c=.o) 50 51 52 ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(drm_INCLUDES) $(fbdev_INCLUDES) $(null_INCLUDES) $(wayland_INCLUDES) 53 ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES) $(null_SOURCES) $(wayland_SOURCES) 54 55 EGL_OBJECTS = $(common_OBJECTS) 56 EGL_CPPFLAGS = $(common_INCLUDES) 57 58 # add backends 59 ifneq ($(findstring x11, $(EGL_PLATFORMS)),) 60 EGL_OBJECTS += $(x11_OBJECTS) 61 EGL_CPPFLAGS += -DHAVE_X11_BACKEND 62 endif 63 ifneq ($(findstring wayland, $(EGL_PLATFORMS)),) 64 EGL_OBJECTS += $(wayland_OBJECTS) 65 EGL_CPPFLAGS += -DHAVE_WAYLAND_BACKEND 66 DEFINES += -DHAVE_WAYLAND_BACKEND 67 common_INCLUDES += $(wayland_INCLUDES) 68 endif 69 ifneq ($(findstring drm, $(EGL_PLATFORMS)),) 70 EGL_OBJECTS += $(drm_OBJECTS) 71 EGL_CPPFLAGS += -DHAVE_DRM_BACKEND 72 endif 73 ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),) 74 EGL_OBJECTS += $(fbdev_OBJECTS) 75 EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND 76 endif 77 ifneq ($(findstring null, $(EGL_PLATFORMS)),) 78 EGL_OBJECTS += $(null_OBJECTS) 79 EGL_CPPFLAGS += -DHAVE_NULL_BACKEND 80 endif 81 82 ##### TARGETS ##### 83 84 default: depend libegl.a 85 86 libegl.a: $(EGL_OBJECTS) Makefile 87 $(MKLIB) -o egl -static $(EGL_OBJECTS) 88 89 depend: 90 rm -f depend 91 touch depend 92 $(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null 93 94 clean: 95 rm -f libegl.a 96 rm -f $(EGL_OBJECTS) 97 rm -f depend depend.bak 98 99 # Dummy target 100 install: 101 @echo -n "" 102 103 ##### RULES ##### 104 105 define egl-cc 106 $(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ 107 endef 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 127 sinclude depend 128