

EXAMPLE = cgGL_vertex_example


#
# These may be overriden by the user with environment varibles
#
CC ?= gcc
COPTS ?= -g -Wall

INC := -I../common -I../../include -DCWD="\"$(shell pwd)/\""

ifeq ("$(shell uname)", "Linux")
  ifeq ($(TARGET_MACHTYPE), x86_64)
    LIBS := -L/usr/X11R6/lib64 -L../../../../lib64
  else
    LIBS := -L/usr/X11R6/lib -L../../../../lib
  endif
  LIBS += -lCgGL -lCg -lGL -lGLU -lglut -lpthread -lXmu -lXi
  INC += -I../../../../include
  BUILD_APP := :
else
  ifeq ("$(shell uname)", "Darwin")
    LIBS := -F/Library/Frameworks -framework Cg -F/System/Library/Frameworks -framework OpenGL -framework GLUT -framework Foundation -lstdc++
    BUILD_APP := perl -w ../scripts/build_app.pl
  endif
endif

all : $(EXAMPLE)

clean :
	rm -f $(EXAMPLE)

run : $(EXAMPLE)
	./$(EXAMPLE)

$(EXAMPLE) : $(EXAMPLE).c
	$(CC) -o $@ $(INC) $(COPTS) $< ../common/cg_noise.c $(LIBS)
	$(BUILD_APP) $@
