2012-01-28 17:24:19 +00:00
|
|
|
BUILDMODE = debug
|
|
|
|
BUILDPATH = ../build/${BUILDMODE}
|
|
|
|
OBJPATH = ./obj/${BUILDMODE}
|
2012-11-25 21:53:01 +00:00
|
|
|
SOURCES = $(wildcard *.c atmosphere/*.c)
|
2012-01-28 17:24:19 +00:00
|
|
|
OBJECTS = ${SOURCES:%.c=${OBJPATH}/%.o}
|
2012-11-25 21:53:01 +00:00
|
|
|
HEADERS = $(wildcard shared/*.h atmosphere/*.h *.h)
|
2012-01-28 17:24:19 +00:00
|
|
|
RESULT = ${BUILDPATH}/libpaysages.so
|
2012-12-01 16:39:47 +00:00
|
|
|
LIBS = glib-2.0 gthread-2.0 IL ILU
|
|
|
|
CC_FLAGS = -Wall -fPIC -DHAVE_GLIB=1
|
2011-12-23 22:00:19 +00:00
|
|
|
|
2012-12-01 16:39:47 +00:00
|
|
|
CHECK_OPENCL = $(shell pkg-config --modversion --silence-errors OpenCL)
|
|
|
|
ifneq (,${CHECK_OPENCL})
|
|
|
|
LIBS += OpenCL
|
|
|
|
CC_FLAGS += -DHAVE_OPENCL=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
CC_FLAGS += $(shell pkg-config --cflags ${LIBS})
|
|
|
|
CC_LDFLAGS = $(shell pkg-config --libs ${LIBS})
|
|
|
|
|
|
|
|
ifeq (${BUILDMODE},debug)
|
2012-04-09 19:58:08 +00:00
|
|
|
CC_FLAGS += -g -pg
|
|
|
|
CC_LDFLAGS += -g -pg
|
2012-01-28 17:24:19 +00:00
|
|
|
endif
|
2012-12-01 16:39:47 +00:00
|
|
|
ifeq (${BUILDMODE},release)
|
2012-07-01 13:27:57 +00:00
|
|
|
CC_FLAGS += -O3 -DNDEBUG -Wno-unused-variable -Wno-unused-but-set-variable
|
2012-01-28 17:24:19 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
all:prepare ${RESULT}
|
2012-12-01 16:39:47 +00:00
|
|
|
|
2012-01-28 17:24:19 +00:00
|
|
|
prepare:
|
|
|
|
mkdir -p ${OBJPATH}
|
|
|
|
mkdir -p ${BUILDPATH}
|
2011-12-23 22:00:19 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ${OBJECTS}
|
|
|
|
rm -f ${RESULT}
|
|
|
|
|
2012-01-28 17:24:19 +00:00
|
|
|
${OBJPATH}/%.o:%.c ${HEADERS}
|
2012-11-25 21:53:01 +00:00
|
|
|
mkdir -p `dirname $@`
|
2011-12-23 22:00:19 +00:00
|
|
|
${CC} -c ${CC_FLAGS} $< -o $@
|
|
|
|
|
|
|
|
${RESULT}:${OBJECTS}
|
2011-12-23 22:39:13 +00:00
|
|
|
${CC} $^ -shared ${CC_LDFLAGS} -o $@
|
2011-12-23 22:00:19 +00:00
|
|
|
|
2012-01-28 17:24:19 +00:00
|
|
|
.PHONY:all clean prepare
|
2011-12-23 22:00:19 +00:00
|
|
|
|