summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/Makefile
blob: 763e7b58a492cf7a14c2c14e3ce0e49c683bf7bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
TOP = ../../../..
include $(TOP)/configs/current

common_INCLUDES = \
	-I. \
	-I$(TOP)/src/gallium/include \
	-I$(TOP)/src/gallium/auxiliary \
	-I$(TOP)/src/egl/main \
	-I$(TOP)/src/egl/wayland/wayland-drm/ \
	-I$(TOP)/include

common_SOURCES = $(wildcard common/*.c)
common_OBJECTS = $(common_SOURCES:.c=.o)

x11_INCLUDES = \
	-I$(TOP)/src/gallium/drivers \
	-I$(TOP)/src/glx \
	-I$(TOP)/src/mapi \
	-I$(TOP)/src/mesa \
	$(X11_CFLAGS) \
	$(shell pkg-config --cflags-only-I libdrm dri2proto)

x11_SOURCES = $(wildcard x11/*.c) \
	      $(TOP)/src/glx/dri2.c
x11_OBJECTS = $(x11_SOURCES:.c=.o)

wayland_INCLUDES = \
	-I$(TOP)/src/gallium/winsys \
	-I$(TOP)/src/egl/wayland/wayland-egl \
	-I$(TOP)/src/egl/wayland/wayland-drm \
	$(shell pkg-config --cflags-only-I libdrm wayland-client)

wayland_SOURCES = $(wildcard wayland/*.c)
wayland_OBJECTS = $(wayland_SOURCES:.c=.o)

drm_INCLUDES = -I$(TOP)/src/gallium/winsys $(shell pkg-config --cflags-only-I libdrm)
drm_SOURCES = $(wildcard drm/*.c)
drm_OBJECTS = $(drm_SOURCES:.c=.o)


fbdev_INCLUDES = -I$(TOP)/src/gallium/winsys/sw
fbdev_SOURCES = $(wildcard fbdev/*.c)
fbdev_OBJECTS = $(fbdev_SOURCES:.c=.o)


ALL_INCLUDES = $(common_INCLUDES) $(x11_INCLUDES) $(drm_INCLUDES) $(fbdev_INCLUDES)
ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES)

EGL_OBJECTS = $(common_OBJECTS)
EGL_CPPFLAGS = $(common_INCLUDES)

# add backends
ifneq ($(findstring x11, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(x11_OBJECTS)
EGL_CPPFLAGS += -DHAVE_X11_BACKEND
endif
ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(wayland_OBJECTS)
EGL_CPPFLAGS += -DHAVE_WAYLAND_BACKEND
DEFINES += -DHAVE_WAYLAND_BACKEND
endif
ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(drm_OBJECTS)
EGL_CPPFLAGS += -DHAVE_DRM_BACKEND
endif
ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(fbdev_OBJECTS)
EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND
endif

##### TARGETS #####

default: depend libegl.a

libegl.a: $(EGL_OBJECTS) Makefile
	$(MKLIB) -o egl -static $(EGL_OBJECTS)

depend: 
	rm -f depend
	touch depend
	$(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null

clean:
	rm -f libegl.a
	rm -f $(EGL_OBJECTS)
	rm -f depend depend.bak

# Dummy target
install:
	@echo -n ""

##### RULES #####

define egl-cc
$(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
endef

$(common_OBJECTS): %.o: %.c
	$(CC) -c $(EGL_CPPFLAGS) $(DEFINES) $(CFLAGS) $< -o $@

$(x11_OBJECTS): %.o: %.c
	$(call egl-cc,x11)

$(wayland_OBJECTS): %.o: %.c
	$(call egl-cc,wayland)

$(drm_OBJECTS): %.o: %.c
	$(call egl-cc,drm)

$(fbdev_OBJECTS): %.o: %.c
	$(call egl-cc,fbdev)

sinclude depend