mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 13:55:07 +00:00
Makefile refinements: Move strip step from install to build, make it optional. Don't use exotic .o suffixes. Put temporary files in tmp/ for easy seperation and deltion
This commit is contained in:
parent
64e751c741
commit
aa7da9242a
153
Makefile
153
Makefile
@ -41,10 +41,9 @@ $(error "Platform '$(SYSTEM)' not supported")
|
||||
endif
|
||||
|
||||
GLEW_DEST ?= /usr
|
||||
BINDIR ?= $(GLEW_DEST)/bin
|
||||
LIBDIR ?= $(GLEW_DEST)/lib
|
||||
INCDIR ?= $(GLEW_DEST)/include/GL
|
||||
SHARED_OBJ_EXT ?= o
|
||||
BINDIR ?= $(GLEW_DEST)/bin
|
||||
LIBDIR ?= $(GLEW_DEST)/lib
|
||||
INCDIR ?= $(GLEW_DEST)/include/GL
|
||||
|
||||
TARDIR = ../glew-$(GLEW_VERSION)
|
||||
TARBALL = ../glew-$(GLEW_VERSION).tar.gz
|
||||
@ -54,11 +53,16 @@ DIST_WIN32 = glew-$(GLEW_VERSION)-win32.zip
|
||||
DIST_SRC_ZIP = glew-$(GLEW_VERSION).zip
|
||||
DIST_SRC_TGZ = glew-$(GLEW_VERSION).tgz
|
||||
|
||||
AR = ar
|
||||
INSTALL = install
|
||||
STRIP = strip
|
||||
RM = rm -f
|
||||
LN = ln -sf
|
||||
# To disable stripping of binaries either:
|
||||
# - use STRIP= on gmake command-line
|
||||
# - edit this makefile to set STRIP to the empty string
|
||||
|
||||
AR ?= ar
|
||||
INSTALL ?= install
|
||||
STRIP ?= strip
|
||||
RM ?= rm -f
|
||||
LN ?= ln -sf
|
||||
|
||||
ifeq ($(MAKECMDGOALS), debug)
|
||||
OPT = -g
|
||||
else
|
||||
@ -67,29 +71,25 @@ endif
|
||||
INCLUDE = -Iinclude
|
||||
CFLAGS = $(OPT) $(WARN) $(INCLUDE) $(CFLAGS.EXTRA)
|
||||
|
||||
LIB.SRCS = src/glew.c
|
||||
LIB.OBJS = $(LIB.SRCS:.c=.o)
|
||||
LIB.SOBJS = $(LIB.SRCS:.c=.$(SHARED_OBJ_EXT))
|
||||
LIB.LDFLAGS = $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
LIB.LIBS = $(GL_LDFLAGS)
|
||||
|
||||
LIB.OBJS.MX = $(LIB.SRCS:.c=.mx.o)
|
||||
LIB.SOBJS.MX = $(LIB.SRCS:.c=.mx.$(SHARED_OBJ_EXT))
|
||||
|
||||
GLEWINFO.BIN = glewinfo$(BIN.SUFFIX)
|
||||
GLEWINFO.BIN.SRCS = src/glewinfo.c
|
||||
GLEWINFO.BIN.OBJS = $(GLEWINFO.BIN.SRCS:.c=.o)
|
||||
VISUALINFO.BIN = visualinfo$(BIN.SUFFIX)
|
||||
VISUALINFO.BIN.SRCS = src/visualinfo.c
|
||||
VISUALINFO.BIN.OBJS = $(VISUALINFO.BIN.SRCS:.c=.o)
|
||||
BIN.LIBS = -Llib $(LDFLAGS.DYNAMIC) -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
|
||||
all debug: glew.lib glew.lib.mx glew.bin
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
# GLEW shared and static libraries
|
||||
|
||||
# GLEW libraries
|
||||
LIB.LDFLAGS := $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
LIB.LIBS := $(GL_LDFLAGS)
|
||||
|
||||
LIB.SRCS := src/glew.c
|
||||
LIB.SRCS.NAMES := $(notdir $(LIB.SRCS))
|
||||
|
||||
LIB.OBJS := $(addprefix tmp/$(SYSTEM)/default/static/,$(LIB.SRCS.NAMES))
|
||||
LIB.OBJS := $(LIB.OBJS:.c=.o)
|
||||
LIB.SOBJS := $(addprefix tmp/$(SYSTEM)/default/shared/,$(LIB.SRCS.NAMES))
|
||||
LIB.SOBJS := $(LIB.SOBJS:.c=.o)
|
||||
|
||||
LIB.OBJS.MX := $(addprefix tmp/$(SYSTEM)/mx/static/,$(LIB.SRCS.NAMES))
|
||||
LIB.OBJS.MX := $(LIB.OBJS.MX:.c=.o)
|
||||
LIB.SOBJS.MX := $(addprefix tmp/$(SYSTEM)/mx/shared/,$(LIB.SRCS.NAMES))
|
||||
LIB.SOBJS.MX := $(LIB.SOBJS.MX:.c=.o)
|
||||
|
||||
glew.lib: lib lib/$(LIB.SHARED) lib/$(LIB.STATIC) glew.pc
|
||||
|
||||
@ -98,6 +98,9 @@ lib:
|
||||
|
||||
lib/$(LIB.STATIC): $(LIB.OBJS)
|
||||
$(AR) cr $@ $^
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
lib/$(LIB.SHARED): $(LIB.SOBJS)
|
||||
$(LD) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS)
|
||||
@ -106,6 +109,17 @@ else
|
||||
$(LN) $(LIB.SHARED) lib/$(LIB.SONAME)
|
||||
$(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK)
|
||||
endif
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
tmp/$(SYSTEM)/default/static/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_STATIC $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/default/shared/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
glew.pc: glew.pc.in
|
||||
sed \
|
||||
@ -118,13 +132,7 @@ glew.pc: glew.pc.in
|
||||
-e "s|@libname@|GLEW|g" \
|
||||
< $< > $@
|
||||
|
||||
src/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
src/glew.pic_o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
# GLEW MX libraries
|
||||
# GLEW MX static and shared libraries
|
||||
|
||||
glew.lib.mx: lib lib/$(LIB.SHARED.MX) lib/$(LIB.STATIC.MX) glewmx.pc
|
||||
|
||||
@ -138,6 +146,17 @@ else
|
||||
$(LN) $(LIB.SHARED.MX) lib/$(LIB.SONAME.MX)
|
||||
$(LN) $(LIB.SHARED.MX) lib/$(LIB.DEVLNK.MX)
|
||||
endif
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
tmp/$(SYSTEM)/mx/static/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_MX -DGLEW_STATIC $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
tmp/$(SYSTEM)/mx/shared/glew.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_MX $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
glewmx.pc: glew.pc.in
|
||||
sed \
|
||||
@ -150,24 +169,44 @@ glewmx.pc: glew.pc.in
|
||||
-e "s|@libname@|GLEWmx|g" \
|
||||
< $< > $@
|
||||
|
||||
src/glew.mx.o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_MX $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
# GLEW utility programs
|
||||
|
||||
src/glew.mx.pic_o: src/glew.c include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
$(CC) -DGLEW_NO_GLU -DGLEW_MX $(CFLAGS) $(PICFLAG) $(CFLAGS.SO) -o $@ -c $<
|
||||
BIN.LIBS = -Llib $(LDFLAGS.DYNAMIC) -l$(NAME) $(LDFLAGS.EXTRA) $(LDFLAGS.GL)
|
||||
|
||||
# GLEW utilities
|
||||
GLEWINFO.BIN := glewinfo$(BIN.SUFFIX)
|
||||
GLEWINFO.BIN.SRC := src/glewinfo.c
|
||||
GLEWINFO.BIN.OBJ := $(addprefix tmp/$(SYSTEM)/default/shared/,$(notdir $(GLEWINFO.BIN.SRC)))
|
||||
GLEWINFO.BIN.OBJ := $(GLEWINFO.BIN.OBJ:.c=.o)
|
||||
|
||||
VISUALINFO.BIN := visualinfo$(BIN.SUFFIX)
|
||||
VISUALINFO.BIN.SRC := src/visualinfo.c
|
||||
VISUALINFO.BIN.OBJ := $(addprefix tmp/$(SYSTEM)/default/shared/,$(notdir $(VISUALINFO.BIN.SRC)))
|
||||
VISUALINFO.BIN.OBJ := $(VISUALINFO.BIN.OBJ:.c=.o)
|
||||
|
||||
glew.bin: glew.lib bin bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN)
|
||||
|
||||
bin:
|
||||
mkdir bin
|
||||
|
||||
glew.bin: glew.lib bin bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN)
|
||||
bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) lib/$(LIB.SHARED)
|
||||
$(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJ) $(BIN.LIBS)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJS) lib/$(LIB.SHARED)
|
||||
$(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJS) $(BIN.LIBS)
|
||||
bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) lib/$(LIB.SHARED)
|
||||
$(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJ) $(BIN.LIBS)
|
||||
ifneq ($(STRIP),)
|
||||
$(STRIP) -x $@
|
||||
endif
|
||||
|
||||
bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJS) lib/$(LIB.SHARED)
|
||||
$(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJS) $(BIN.LIBS)
|
||||
$(GLEWINFO.BIN.OBJ): $(GLEWINFO.BIN.SRC) include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
$(VISUALINFO.BIN.OBJ): $(VISUALINFO.BIN.SRC) include/GL/glew.h include/GL/wglew.h include/GL/glxew.h
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -DGLEW_NO_GLU $(CFLAGS) $(CFLAGS.SO) -o $@ -c $<
|
||||
|
||||
# Install targets
|
||||
|
||||
@ -182,10 +221,8 @@ install.lib: glew.lib
|
||||
# runtime
|
||||
ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
$(INSTALL) -d -m 0755 $(BINDIR)
|
||||
$(STRIP) -x lib/$(LIB.SHARED)
|
||||
$(INSTALL) -m 0755 lib/$(LIB.SHARED) $(BINDIR)/
|
||||
$(INSTALL) -m 0755 lib/$(LIB.SHARED) $(BINDIR)/
|
||||
else
|
||||
$(STRIP) -x lib/$(LIB.SHARED)
|
||||
$(INSTALL) -m 0644 lib/$(LIB.SHARED) $(LIBDIR)/
|
||||
$(LN) $(LIB.SHARED) $(LIBDIR)/$(LIB.SONAME)
|
||||
endif
|
||||
@ -195,7 +232,6 @@ ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
else
|
||||
$(LN) $(LIB.SHARED) $(LIBDIR)/$(LIB.DEVLNK)
|
||||
endif
|
||||
$(STRIP) -x lib/$(LIB.STATIC)
|
||||
$(INSTALL) -m 0644 lib/$(LIB.STATIC) $(LIBDIR)/
|
||||
|
||||
install.lib.mx: glew.lib.mx
|
||||
@ -203,10 +239,8 @@ install.lib.mx: glew.lib.mx
|
||||
# runtime
|
||||
ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
$(INSTALL) -d -m 0755 $(BINDIR)
|
||||
$(STRIP) -x lib/$(LIB.SHARED.MX)
|
||||
$(INSTALL) -m 0755 lib/$(LIB.SHARED.MX) $(BINDIR)/
|
||||
else
|
||||
$(STRIP) -x lib/$(LIB.SHARED.MX)
|
||||
$(INSTALL) -m 0644 lib/$(LIB.SHARED.MX) $(LIBDIR)/
|
||||
$(LN) $(LIB.SHARED.MX) $(LIBDIR)/$(LIB.SONAME.MX)
|
||||
endif
|
||||
@ -216,7 +250,6 @@ ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),)
|
||||
else
|
||||
$(LN) $(LIB.SHARED.MX) $(LIBDIR)/$(LIB.DEVLNK.MX)
|
||||
endif
|
||||
$(STRIP) -x lib/$(LIB.STATIC.MX)
|
||||
$(INSTALL) -m 0644 lib/$(LIB.STATIC.MX) $(LIBDIR)/
|
||||
|
||||
install.bin: glew.bin
|
||||
@ -254,15 +287,10 @@ endif
|
||||
$(RM) $(BINDIR)/$(GLEWINFO.BIN) $(BINDIR)/$(VISUALINFO.BIN)
|
||||
|
||||
clean:
|
||||
$(RM) $(LIB.OBJS) $(LIB.OBJS.MX)
|
||||
$(RM) $(LIB.SOBJS) $(LIB.SOBJS.MX)
|
||||
$(RM) lib/$(LIB.STATIC) lib/$(LIB.SHARED) lib/$(LIB.DEVLNK) lib/$(LIB.SONAME) $(LIB.STATIC)
|
||||
$(RM) lib/$(LIB.STATIC.MX) lib/$(LIB.SHARED.MX) lib/$(LIB.DEVLNK.MX) lib/$(LIB.SONAME.MX) $(LIB.STATIC.MX)
|
||||
$(RM) $(GLEWINFO.BIN.OBJS) bin/$(GLEWINFO.BIN) $(VISUALINFO.BIN.OBJS) bin/$(VISUALINFO.BIN)
|
||||
$(RM) -r tmp/
|
||||
$(RM) -r lib/
|
||||
$(RM) -r bin/
|
||||
$(RM) glew.pc glewmx.pc
|
||||
# Compiler droppings
|
||||
$(RM) so_locations
|
||||
$(RM) -r lib/ bin/
|
||||
|
||||
distclean: clean
|
||||
find . -name \*~ | xargs $(RM)
|
||||
@ -312,9 +340,6 @@ dist-src:
|
||||
cp -a Makefile $(TARDIR)
|
||||
cp -a glew.pc.in $(TARDIR)
|
||||
find $(TARDIR) -name '*.o' | xargs $(RM) -r
|
||||
find $(TARDIR) -name '*.mx.o' | xargs $(RM) -r
|
||||
find $(TARDIR) -name '*.pic_o' | xargs $(RM) -r
|
||||
find $(TARDIR) -name '*.mx.pic_o' | xargs $(RM) -r
|
||||
find $(TARDIR) -name '*~' | xargs $(RM) -r
|
||||
find $(TARDIR) -name CVS -o -name .cvsignore | xargs $(RM) -r
|
||||
find $(TARDIR) -name .svn | xargs $(RM) -r
|
||||
|
@ -25,4 +25,3 @@ LIB.DEVLNK.MX = lib$(NAME)mx.dylib
|
||||
LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib
|
||||
LIB.STATIC.MX = lib$(NAME)mx.a
|
||||
LDFLAGS.SO.MX = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED.MX) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
|
||||
SHARED_OBJ_EXT = pic_o
|
||||
|
@ -25,4 +25,3 @@ LIB.DEVLNK.MX = lib$(NAME)mx.dylib
|
||||
LIB.SHARED.MX = lib$(NAME)mx.$(SO_VERSION).dylib
|
||||
LIB.STATIC.MX = lib$(NAME)mx.a
|
||||
LDFLAGS.SO.MX = -dynamiclib -install_name $(GLEW_DEST)/lib/$(LIB.SHARED.MX) -current_version $(SO_VERSION) -compatibility_version $(SO_MAJOR)
|
||||
SHARED_OBJ_EXT = pic_o
|
||||
|
@ -20,4 +20,3 @@ LIB.DEVLNK.MX = lib$(NAME)mx.so
|
||||
LIB.SHARED.MX = lib$(NAME)mx.so.$(SO_VERSION)
|
||||
LIB.STATIC.MX = lib$(NAME)mx.a
|
||||
LDFLAGS.SO.MX = -shared -Wl,-soname=$(LIB.SONAME.MX)
|
||||
SHARED_OBJ_EXT = pic_o
|
||||
|
@ -20,4 +20,3 @@ LIB.DEVLNK.MX = lib$(NAME)mx.so
|
||||
LIB.SHARED.MX = lib$(NAME)mx.so.$(SO_VERSION)
|
||||
LIB.STATIC.MX = lib$(NAME)mx.a
|
||||
LDFLAGS.SO.MX = -shared -Wl,-soname $(LIB.SONAME.MX)
|
||||
SHARED_OBJ_EXT = pic_o
|
||||
|
@ -27,4 +27,3 @@ LIB.DEVLNK.MX = lib$(NAME)mx.so
|
||||
LIB.SHARED.MX = lib$(NAME)mx.so.$(SO_VERSION)
|
||||
LIB.STATIC.MX = lib$(NAME)mx.a
|
||||
LDFLAGS.SO.MX = -shared -Wl,-soname=$(LIB.SONAME.MX)
|
||||
SHARED_OBJ_EXT = pic_o
|
||||
|
Loading…
Reference in New Issue
Block a user