34 lines
1.3 KiB
Makefile
34 lines
1.3 KiB
Makefile
|
# Makefile for python interface for package gorrent.
|
||
|
# File is generated by gopy. Do not edit.
|
||
|
# gopy gen --output=py/gorrent gorrent
|
||
|
|
||
|
GOCMD=go
|
||
|
GOBUILD=$(GOCMD) build -mod=mod
|
||
|
GOIMPORTS=goimports
|
||
|
PYTHON=/usr/bin/python
|
||
|
LIBEXT=.so
|
||
|
|
||
|
# get the CC and flags used to build python:
|
||
|
GCC = $(shell $(GOCMD) env CC)
|
||
|
CFLAGS = $(shell python3-config --includes)
|
||
|
LDFLAGS = -L/usr/lib64 $(BOOST_ROOT)/stage/lib/libboost_python*.a -lpthread -ldl -lutil -lm -lm
|
||
|
|
||
|
all: build
|
||
|
|
||
|
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 gorrent.c
|
||
|
# goimports is needed to ensure that the imports list is valid
|
||
|
$(GOIMPORTS) -w gorrent.go
|
||
|
# generate gorrent_go$(LIBEXT) from gorrent.go -- the cgo wrappers to go functions
|
||
|
$(GOBUILD) -buildmode=c-archive -o gorrent_go.a gorrent.go
|
||
|
# use pybindgen to build the gorrent.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 _gorrent$(LIBEXT) library that contains the cgo and CPython wrappers
|
||
|
# generated gorrent.py python wrapper imports this c-code package
|
||
|
|
||
|
$(GCC) gorrent.c gorrent_go.a -o _gorrent$(LIBEXT) $(CFLAGS) $(LDFLAGS) -fPIC --shared -w
|
||
|
|