1 # src/gbm/backends/Makefile.template
3 # Backends should define
5 # GBM_BACKEND, the driver name
6 # GBM_SOURCES, the driver sources
7 # GBM_INCLUDES, the include pathes
8 # GBM_CFLAGS, additional CFLAGS
9 # GBM_LIBS, additional LIBS
11 # before including this template.
15 GBM_BACKEND_PATH = $(TOP)/$(LIB_DIR)/gbm/$(GBM_BACKEND).so
16 GBM_OBJECTS = $(GBM_SOURCES:.c=.o)
18 # built-in or external
19 ifeq ($(GBM_BUILTIN), true)
20 GBM_TARGET = lib$(GBM_BACKEND).a
23 GBM_TARGET = $(GBM_BACKEND_PATH)
24 GBM_INSTALL = install-so
27 default: depend $(GBM_TARGET)
29 $(GBM_BACKEND_PATH): $(GBM_BACKEND).so
30 @$(INSTALL) -d $(TOP)/$(LIB_DIR)/gbm
31 $(INSTALL) $< $(TOP)/$(LIB_DIR)/gbm
33 $(GBM_BACKEND).so: $(GBM_OBJECTS) Makefile $(TOP)/src/gbm/backends/Makefile.template
34 @$(MKLIB) -o $(GBM_BACKEND).so -noprefix \
35 -linker '$(CC)' -ldflags '-L$(TOP)/$(LIB_DIR) $(LDFLAGS)' \
37 $(GBM_OBJECTS) $(GBM_LIBS) -l$(GBM_LIB)
39 lib$(GBM_BACKEND).a: $(GBM_OBJECTS) Makefile $(TOP)/src/gbm/backends/Makefile.template
40 @$(MKLIB) -o $(GBM_BACKEND) -static $(GBM_OBJECTS)
43 $(CC) -c $(GBM_INCLUDES) $(CFLAGS) $(GBM_CFLAGS) $< -o $@
45 install-so: $(GBM_BACKEND_PATH)
46 $(INSTALL) -d $(DESTDIR)$(GBM_BACKEND_INSTALL_DIR)
47 $(MINSTALL) $(GBM_BACKEND_PATH) $(DESTDIR)$(GBM_BACKEND_INSTALL_DIR)
49 install: $(GBM_INSTALL)
52 rm -f $(GBM_BACKEND).so
53 rm -f lib$(GBM_BACKEND).a
55 rm -f depend depend.bak
57 depend: $(GBM_SOURCES)
58 @ echo "running $(MKDEP)"
61 $(MKDEP) $(MKDEP_OPTIONS) $(GBM_INCLUDES) $(GBM_SOURCES) \
62 >/dev/null 2>/dev/null