# Makefile for python interface for package gomssql_python_go.
# File is generated by gopy. Do not edit.
# gopy build -output=gomssql_python/py2 -symbols=true -vm=/Users/edwardbeech/.venv/gomssql-python/bin/python gomssql_python/gomssql_python_go

GOCMD=go
GOBUILD=$(GOCMD) build
GOIMPORTS=goimports
PYTHON=/Users/edwardbeech/.venv/gomssql-python/bin/python
LIBEXT=.so

# get the CC and flags used to build python:
GCC = $(shell $(GOCMD) env CC)
CFLAGS = -I/Users/edwardbeech/.venv/gomssql-python/include/python2.7
LDFLAGS = -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -lpython2.7 -ldl  -framework CoreFoundation 

all: gen build

gen:
	gopy gen -symbols=true -vm=/Users/edwardbeech/.venv/gomssql-python/bin/python gomssql_python/gomssql_python_go

build:
	# build target builds the generated files -- this is what gopy build does..
	# this will otherwise be built during go build and may be out of date
	- rm gomssql_python_go.c
	# goimports is needed to ensure that the imports list is valid
	$(GOIMPORTS) -w gomssql_python_go.go
	# generate gomssql_python_go_go$(LIBEXT) from gomssql_python_go.go -- the cgo wrappers to go functions
	$(GOBUILD) -buildmode=c-shared -o gomssql_python_go_go$(LIBEXT) gomssql_python_go.go
	# use pybindgen to build the gomssql_python_go.c file which are the CPython wrappers to cgo wrappers..
	# note: pip install pybindgen to get pybindgen if this fails
	$(PYTHON) build.py
	# build the _gomssql_python_go$(LIBEXT) library that contains the cgo and CPython wrappers
	# generated gomssql_python_go.py python wrapper imports this c-code package
	$(GCC) gomssql_python_go.c -dynamiclib gomssql_python_go_go$(LIBEXT) -o _gomssql_python_go$(LIBEXT) $(CFLAGS) $(LDFLAGS) -fPIC --shared -w
	


