all: # Get settings from the output of configure by running it to generate # Makefile.config if it doesn't exist yet. # If Makefile.config doesn't exist, then srcdir won't be # set. Conditionally set it (assuming a plain srcdir build) so that # the rule to generate Makefile.config can actually work. srcdir ?= . include Makefile.config Makefile.config: $(srcdir)/configure ifeq ($(configure_options),) @echo "" @echo "Note: Calling ./configure with no command-line arguments. This is often fine," @echo " but if you want to specify any arguments (such as an alternate prefix" @echo " into which to install), call ./configure explicitly and then make again." @echo " See \"./configure --help\" for more details." @echo "" endif $(srcdir)/configure $(configure_options) LIBGLAZE_LINKER_NAME = libglaze.so LIBGLAZE_SONAME = $(LIBGLAZE_LINKER_NAME).$(MAJOR) LIBGLAZE_LIBNAME = $(LIBGLAZE_SONAME).$(MINOR).$(RELEASE) TARGETS = $(LIBGLAZE_LIBNAME) ifeq ($(COMPILER_SUPPORTS_32),Yes) TARGETS += $(LIB32_DIR)/libGL.so.1 TARGETS += glaze-find-libgl-32 endif ifeq ($(COMPILER_SUPPORTS_64),Yes) TARGETS += $(LIB64_DIR)/libGL.so.1 TARGETS += glaze-find-libgl-64 endif all: $(TARGETS) GLAZE_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(LIBGLAZE_LIBNAME): glaze.c $(CC) $(GLAZE_CFLAGS) -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -ldl -ltalloc -o $@ $< $(LIB64_DIR)/libGL.so.1: glaze-gl.c glapi.def mkdir -p $(LIB64_DIR) $(CC) $(GLAZE_CFLAGS) -DGLAZE_BITS=64 -m64 -fPIC -shared -Wl,-Bsymbolic -o $@ $< $(LIB32_DIR)/libGL.so.1: glaze-gl.c specs/gl.def mkdir -p $(LIB32_DIR) $(CC) $(GLAZE_CFLAGS) -DGLAZE_BITS=32 -m32 -fPIC -shared -Wl,-Bsymbolic -o $@ $< glaze-find-libgl-32: glaze-find-libgl.c $(CC) $(GLAZE_CFLAGS) -m32 -fPIC -ldl -o $@ $< glaze-find-libgl-64: glaze-find-libgl.c $(CC) $(GLAZE_CFLAGS) -m64 -fPIC -ldl -o $@ $< .PHONY: install install: all mkdir -p $(DESTDIR)$(LIBDIR)/glaze/$(LIB64_DIR) install -m0644 $(LIB64_DIR)/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/$(LIB64_DIR) mkdir -p $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR) install -m0644 $(LIB32_DIR)/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR) install -m0644 $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR) ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_SONAME) ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_LINKER_NAME) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig install glaze.pc $(DESTDIR)$(LIBDIR)/pkgconfig mkdir -p $(DESTDIR)$(INCLUDEDIR)/glaze install -m0644 glaze.h $(DESTDIR)$(INCLUDEDIR)/glaze mkdir -p $(DESTDIR)$(BINDIR) ifeq ($(COMPILER_SUPPORTS_32),Yes) install -m0755 glaze-find-libgl-32 $(DESTDIR)$(BINDIR) endif ifeq ($(COMPILER_SUPPORTS_64),Yes) install -m0755 glaze-find-libgl-64 $(DESTDIR)$(BINDIR) endif clean: rm -f $(TARGETS)