summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/Makefile
blob: 9e9e479e7e0a1484a60986c2cdff8f4b702b10c1 (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
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)/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)

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


kms_INCLUDES = $(shell pkg-config --cflags-only-I libdrm)
kms_SOURCES = $(wildcard kms/*.c)
kms_OBJECTS = $(kms_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) $(kms_INCLUDES) $(fbdev_INCLUDES)
ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(kms_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 kms, $(EGL_PLATFORMS)),)
EGL_OBJECTS += $(kms_OBJECTS)
EGL_CPPFLAGS += -DHAVE_KMS_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)

$(kms_OBJECTS): %.o: %.c
	$(call egl-cc,kms)

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

sinclude depend