summaryrefslogtreecommitdiff
path: root/src/egl/drivers/Makefile.template
blob: 76dbe260c6b77c8917c3549f67593679107720e0 (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
# src/egl/drivers/Makefile.template
#
# Drivers should define
#
# EGL_BUILTIN, the driver is built-in or external
# EGL_DRIVER, the driver name
# EGL_SOURCES, the driver sources
# EGL_INCLUDES, the include pathes
# EGL_CFLAGS, additional CFLAGS
# EGL_LIBS, additional LIBS
#
# before including this template.
#


EGL_DRIVER_PATH = $(TOP)/$(LIB_DIR)/egl/$(EGL_DRIVER).so
EGL_OBJECTS = $(EGL_SOURCES:.c=.o)

# built-in or external
ifeq ($(EGL_BUILTIN),true)
EGL_TARGET = lib$(EGL_DRIVER).a
EGL_INSTALL =
else
EGL_TARGET = $(EGL_DRIVER_PATH)
EGL_INSTALL = install-so
endif

default: depend $(EGL_TARGET)

$(EGL_DRIVER_PATH): $(EGL_DRIVER).so
	@$(INSTALL) -d $(TOP)/$(LIB_DIR)/egl
	$(INSTALL) $< $(TOP)/$(LIB_DIR)/egl

$(EGL_DRIVER).so: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
	@$(MKLIB) -o $(EGL_DRIVER).so -noprefix \
		-linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
		$(MKLIB_OPTIONS) \
		$(EGL_OBJECTS) $(EGL_LIBS) -l$(EGL_LIB)

lib$(EGL_DRIVER).a: $(EGL_OBJECTS) Makefile $(TOP)/src/egl/drivers/Makefile.template
	@$(MKLIB) -o $(EGL_DRIVER) -static $(EGL_OBJECTS)

.c.o:
	$(CC) -c $(EGL_INCLUDES) $(CFLAGS) $(EGL_CFLAGS) $< -o $@

install-so: $(EGL_DRIVER_PATH)
	$(INSTALL) -d $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)
	$(MINSTALL) $(EGL_DRIVER_PATH) $(DESTDIR)$(EGL_DRIVER_INSTALL_DIR)

install: $(EGL_INSTALL)

clean:
	rm -f $(EGL_DRIVER).so
	rm -f lib$(EGL_DRIVER).a
	rm -f $(EGL_OBJECTS)
	rm -f depend depend.bak

depend: $(EGL_SOURCES)
	@ echo "running $(MKDEP)"
	@ rm -f depend
	@ touch depend
	$(MKDEP) $(MKDEP_OPTIONS) $(EGL_INCLUDES) $(EGL_SOURCES) \
		>/dev/null 2>/dev/null

sinclude depend
# DO NOT DELETE