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