Makefile revision a5f8d37be141fac5c4ac605163a552ac64324e15
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)
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)
53ALL_SOURCES = $(common_SOURCES) $(x11_SOURCES) $(drm_SOURCES) $(fbdev_SOURCES) $(null_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
67endif
68ifneq ($(findstring drm, $(EGL_PLATFORMS)),)
69EGL_OBJECTS += $(drm_OBJECTS)
70EGL_CPPFLAGS += -DHAVE_DRM_BACKEND
71endif
72ifneq ($(findstring fbdev, $(EGL_PLATFORMS)),)
73EGL_OBJECTS += $(fbdev_OBJECTS)
74EGL_CPPFLAGS += -DHAVE_FBDEV_BACKEND
75endif
76ifneq ($(findstring null, $(EGL_PLATFORMS)),)
77EGL_OBJECTS += $(null_OBJECTS)
78EGL_CPPFLAGS += -DHAVE_NULL_BACKEND
79endif
80
81##### TARGETS #####
82
83default: depend libegl.a
84
85libegl.a: $(EGL_OBJECTS) Makefile
86	$(MKLIB) -o egl -static $(EGL_OBJECTS)
87
88depend: 
89	rm -f depend
90	touch depend
91	$(MKDEP) $(MKDEP_OPTIONS) $(ALL_INCLUDES) $(ALL_SOURCES) 2> /dev/null
92
93clean:
94	rm -f libegl.a
95	rm -f $(EGL_OBJECTS)
96	rm -f depend depend.bak
97
98# Dummy target
99install:
100	@echo -n ""
101
102##### RULES #####
103
104define egl-cc
105$(CC) -c $(common_INCLUDES) $($(1)_INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@
106endef
107
108$(common_OBJECTS): %.o: %.c
109	$(CC) -c $(EGL_CPPFLAGS) $(DEFINES) $(CFLAGS) $< -o $@
110
111$(x11_OBJECTS): %.o: %.c
112	$(call egl-cc,x11)
113
114$(wayland_OBJECTS): %.o: %.c
115	$(call egl-cc,wayland)
116
117$(drm_OBJECTS): %.o: %.c
118	$(call egl-cc,drm)
119
120$(fbdev_OBJECTS): %.o: %.c
121	$(call egl-cc,fbdev)
122
123$(null_OBJECTS): %.o: %.c
124	$(call egl-cc,null)
125
126sinclude depend
127