diff --git a/Makefile b/Makefile index 16dd008..1da7eac 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,7 @@ all debug: glew.lib glew.bin LIB.LDFLAGS := $(LDFLAGS.EXTRA) $(LDFLAGS.GL) LIB.LIBS := $(GL_LDFLAGS) +LIB.SHARED.DIR ?= lib LIB.SRCS := src/glew.c LIB.SRCS.NAMES := $(notdir $(LIB.SRCS)) @@ -100,7 +101,7 @@ LIB.SOBJS := $(LIB.SOBJS:.c=.o) glew.lib: glew.lib.shared glew.lib.static -glew.lib.shared: lib lib/$(LIB.SHARED) glew.pc +glew.lib.shared: lib $(LIB.SHARED.DIR) $(LIB.SHARED.DIR)/$(LIB.SHARED) glew.pc glew.lib.static: lib lib/$(LIB.STATIC) glew.pc .PHONY: glew.lib glew.lib.shared glew.lib.static @@ -118,11 +119,11 @@ ifneq ($(STRIP),) $(STRIP) -x $@ endif -lib/$(LIB.SHARED): $(LIB.SOBJS) +$(LIB.SHARED.DIR)/$(LIB.SHARED): $(LIB.SOBJS) $(LD) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) ifneq ($(LN),) - $(LN) $(LIB.SHARED) lib/$(LIB.SONAME) - $(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK) + $(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.SONAME) + $(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.DEVLNK) endif ifneq ($(STRIP),) $(STRIP) -x $@ @@ -178,13 +179,13 @@ endif bin: mkdir bin -bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) lib/$(LIB.SHARED) +bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) $(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@ endif -bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) lib/$(LIB.SHARED) +bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) $(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@ @@ -209,9 +210,9 @@ install.lib: glew.lib # runtime ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),) $(INSTALL) -d -m 0755 "$(DESTDIR)$(BINDIR)" - $(INSTALL) -m 0755 lib/$(LIB.SHARED) "$(DESTDIR)$(BINDIR)/" + $(INSTALL) -m 0755 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(BINDIR)/" else - $(INSTALL) -m 0644 lib/$(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/" + $(INSTALL) -m 0644 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/" endif ifneq ($(LN),) $(LN) $(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/$(LIB.SONAME)" diff --git a/config/Makefile.msys b/config/Makefile.msys index b5187af..0c64c65 100644 --- a/config/Makefile.msys +++ b/config/Makefile.msys @@ -7,7 +7,7 @@ CFLAGS.EXTRA += -D_WIN32 LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = CFLAGS.EXTRA += -fno-builtin -fno-stack-protector -LDFLAGS.EXTRA += -nostdlib +#LDFLAGS.EXTRA += -nostdlib LIBDIR = $(GLEW_DEST)/bin WARN = -Wall -W POPT = -O2 @@ -15,5 +15,6 @@ BIN.SUFFIX = .exe LIB.SONAME = lib$(NAME).dll LIB.DEVLNK = lib$(NAME).dll.a # for mingw this is the dll import lib LIB.SHARED = $(NAME).dll +LIB.SHARED.DIR = bin LIB.STATIC = lib$(NAME).a # the static lib will be broken LDFLAGS.SO = -shared -Wl,-soname,$(LIB.SONAME) -Wl,--out-implib,lib/$(LIB.DEVLNK) diff --git a/config/Makefile.msys-win64 b/config/Makefile.msys-win64 index c1c785a..4ca3cde 100644 --- a/config/Makefile.msys-win64 +++ b/config/Makefile.msys-win64 @@ -1,5 +1,5 @@ include config/Makefile.msys POPT := -mtune=generic -O2 -CFLAGS.EXTRA += -m64 +CFLAGS.EXTRA += -m64 -Wno-cast-function-type LDFLAGS.EXTRA += -m64