
TARGETS = GLEW

UNAME := $(shell uname)

SRCS = src/glew.c
OBJS = $(SRCS:.c=.o)

CC = gcc
CFLAGS += -Wall
CFLAGS += -Iinclude
CFLAGS += -DGLEW_STATIC

ifeq ($(UNAME), Darwin)
  CLINKFLAGS += -framework OpenGL
else
  ifeq ($(findstring CYGWIN, $(UNAME)), CYGWIN)
    CFLAGS += -D_WIN32
    CLINKFLAGS += -lopengl32
  else
    CLINKFLAGS += -L/usr/X11R6/lib64 -L/usr/X11R6/lib
    CLINKFLAGS += -lGL 
  endif
endif

BINARIES := lib$(TARGETS:=.a)

all: $(BINARIES)

$(BINARIES) : $(OBJS)
	ar -r $@ $<

clean:
	$(RM) $(BINARIES) $(OBJS)

clobber: clean
	$(RM) *.bak *.o *~

.PHONY: all clean clobber

