LOCAL_PATH := $(call my-dir)

###########################
#
# Canvas3d shared library
#
###########################

include $(CLEAR_VARS)

LOCAL_MODULE := Canvas3d

tcl_path := $(LOCAL_PATH)/../tcl

include $(tcl_path)/tcl-config.mk

LOCAL_ADDITIONAL_DEPENDENCIES += $(tcl_path)/tcl-config.mk

tk_path := $(LOCAL_PATH)/../sdl2tk

include $(tk_path)/tk-config.mk

LOCAL_ADDITIONAL_DEPENDENCIES += $(tk_path)/tk-config.mk

LOCAL_C_INCLUDES := $(tcl_includes) $(tk_includes) \
	$(LOCAL_PATH)/../glshim/include \
	$(LOCAL_PATH)/../glshim/src/util \
	$(LOCAL_PATH)/../glshim/src/util/vectorial \
	$(LOCAL_PATH)/generic $(LOCAL_PATH)/sdl

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_SRC_FILES := \
	generic/c3dmain.c \
	generic/c3dsearch.c \
	generic/c3dtransform.c \
	generic/c3ditem.c \
	generic/c3dpolygon.c \
	generic/c3dlight.c \
	generic/c3drectangle.c \
	generic/c3dtext.c \
	generic/c3dcamera.c \
	generic/c3dline.c \
	generic/c3doptions.c \
	generic/c3dres.c \
	../glshim/src/gl/array.c \
	../glshim/src/gl/blend.c \
	../glshim/src/gl/block.c \
	../glshim/src/gl/clear.c \
	../glshim/src/gl/depth.c \
	../glshim/src/gl/eval.c \
	../glshim/src/gl/get.c \
	../glshim/src/gl/gl.c \
	../glshim/src/gl/light.c \
	../glshim/src/gl/line.c \
	../glshim/src/gl/list.c \
	../glshim/src/gl/loader.c \
	../glshim/src/gl/matrix.c \
	../glshim/src/gl/pixel.c \
	../glshim/src/gl/raster.c \
	../glshim/src/gl/render.c \
	../glshim/src/gl/stack.c \
	../glshim/src/gl/texgen.c \
	../glshim/src/gl/text.c \
	../glshim/src/gl/texture.c \
	../glshim/src/gl/wrap/gl.c \
	../glshim/src/gl/wrap/gles.c \
	../glshim/src/gl/wrap/gles2.c \
	../glshim/src/gl/wrap/glstub.c \
	../glshim/src/util/gl_str.c \
	../glshim/src/util/tack.c \
	../glshim/src/util/math/eval.c

LOCAL_CFLAGS := $(tcl_cflags) $(tk_cflags) \
	-DCONST86= \
	-DNO_FD_SET=1 \
	-DPACKAGE_NAME=\"Canvas3d\" \
	-DPACKAGE_VERSION=\"1.2.3\" \
	-DBUILD_Canvas3d=1 \
	-DCAN3D_SDL=1 \
	-fvisibility=hidden -std=c99 -DGL_EXPORTS -DGLAPI=extern \
	-D_THREAD_SAFE=1 \
	-O2

LOCAL_STATIC_LIBRARIES :=

LOCAL_SHARED_LIBRARIES := libtcl libtk

LOCAL_LDLIBS := -ldl -llog

include $(BUILD_SHARED_LIBRARY)
