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

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

# get the CC and flags used to build python:
GCC = $(shell $(GOCMD) env CC)
CFLAGS = -I/Users/edwardbeech/.venv/gossh-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/gossh-python/bin/python gossh_python/gossh_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 gossh_python_go.c
	# goimports is needed to ensure that the imports list is valid
	$(GOIMPORTS) -w gossh_python_go.go
	# generate gossh_python_go_go$(LIBEXT) from gossh_python_go.go -- the cgo wrappers to go functions
	$(GOBUILD) -buildmode=c-shared -o gossh_python_go_go$(LIBEXT) gossh_python_go.go
	# use pybindgen to build the gossh_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 _gossh_python_go$(LIBEXT) library that contains the cgo and CPython wrappers
	# generated gossh_python_go.py python wrapper imports this c-code package
	$(GCC) gossh_python_go.c -dynamiclib gossh_python_go_go$(LIBEXT) -o _gossh_python_go$(LIBEXT) $(CFLAGS) $(LDFLAGS) -fPIC --shared -w
	


