LIBGLAZE_32_SONAME = $(LIBGLAZE_32_LINKER_NAME).$(MAJOR)
LIBGLAZE_32_LIBNAME = $(LIBGLAZE_32_SONAME).$(MINOR).$(RELEASE)
+TARGETS = glaze
+
ifeq ($(COMPILER_SUPPORTS_32),Yes)
TARGETS += $(LIBGLAZE_32_LIBNAME)
TARGETS += $(LIB32_DIR)/libGL.so.1
GLAZE_CFLAGS = $(CFLAGS) $(WARN_CFLAGS)
+glaze: glaze.c $(LIBGLAZE_LINKER_NAME)
+ $(CC) $(GLAZE_CFLAGS) -I. -L. -o $@ $< -ldl -lglaze
+
$(LIBGLAZE_32_LIBNAME): libglaze.c
$(CC) $(GLAZE_CFLAGS) -m32 -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -ldl -ltalloc -o $@ $<
$(LIBGLAZE_LIBNAME): libglaze.c
$(CC) $(GLAZE_CFLAGS) -m64 -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -ldl -ltalloc -o $@ $<
+$(LIBGLAZE_LINKER_NAME): $(LIBGLAZE_LIBNAME)
+ ln -sf $(LIBGLAZE_LIBNAME) $@
+
$(LIB64_DIR)/libGL.so.1: glaze-gl.c
mkdir -p $(LIB64_DIR)
$(CC) $(GLAZE_CFLAGS) -DGLAZE_BITS=64 -m64 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
install -m0644 glaze.h $(DESTDIR)$(INCLUDEDIR)/glaze
mkdir -p $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
+ install -m0755 glaze $(DESTDIR)$(BINDIR)
ifeq ($(COMPILER_SUPPORTS_32),Yes)
mkdir -p $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR)
install -m0644 $(LIB32_DIR)/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/$(LIB32_DIR)
--- /dev/null
+/* Copyright © 2013, Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <limits.h>
+
+#include <glaze.h>
+
+static void
+usage (void)
+{
+ printf ("Usage: glaze --wrapper=<wrapper> <program> [program args...]\n"
+ "\n"
+ "Execute <program> with <wrapper> providing alternate OpenGL functions.\n");
+}
+
+enum {
+ WRAPPER_OPT = CHAR_MAX + 1
+};
+
+int
+main (int argc, char *argv[])
+{
+ const char *wrapper = NULL;
+ int opt;
+
+ const char *short_options="h";
+ const struct option long_options[] = {
+ {"help", no_argument, 0, 'h'},
+ {"wrapper", required_argument, 0, WRAPPER_OPT},
+ {0, 0, 0, 0}
+ };
+
+ while (1)
+ {
+ opt = getopt_long (argc, argv, short_options, long_options, NULL);
+ if (opt == -1)
+ break;
+
+ switch (opt) {
+ case 'h':
+ usage ();
+ return 0;
+ case WRAPPER_OPT:
+ wrapper = optarg;
+ break;
+ default:
+ fprintf (stderr, "Internal error: "
+ "unexpected getopt value: %d\n", opt);
+ exit (1);
+ }
+ }
+
+ if (optind >= argc) {
+ fprintf (stderr, "Error: No program name provided, "
+ "see (glaze --help)\n");
+ exit (1);
+ }
+
+ glaze_execute (argc - optind, &argv[optind], wrapper);
+
+ /* If glaze_execute returns then something went wrong. */
+ return 1;
+}