Skip to content

Commit 67c872b

Browse files
author
Sebastien Binet
committed
fix Makefile to use the go tool + amend install instructions
--HG-- rename : cmd/Makefile => cmd/go-python/Makefile rename : cmd/main.go => cmd/go-python/main.go
1 parent bf65570 commit 67c872b

File tree

5 files changed

+29
-44
lines changed

5 files changed

+29
-44
lines changed

Makefile

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,14 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5-
include ${GOROOT}/src/Make.inc
5+
#include ${GOROOT}/src/Make.inc
66

77
all: install
88

99
DIRS=\
1010
pkg/python\
1111
tests\
12-
cmd\
12+
cmd/go-python\
1313

14-
15-
clean.dirs: $(addsuffix .clean, $(DIRS))
16-
install.dirs: $(addsuffix .install, $(DIRS))
17-
nuke.dirs: $(addsuffix .nuke, $(DIRS))
18-
test.dirs: $(addsuffix .test, $(TEST))
19-
bench.dirs: $(addsuffix .bench, $(BENCH))
20-
21-
%.clean:
22-
+cd $* && $(QUOTED_GOBIN)/gomake clean
23-
24-
%.install:
25-
+cd $* && $(QUOTED_GOBIN)/gomake install
26-
27-
clean: clean.dirs
28-
29-
install: install.dirs
30-
31-
#-include ${GOROOT}/src/Make.deps
14+
install:
15+
(cd pkg/python && make) && (cd cmd/go-python && make)

README

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ the rational being that under such an executable, ``go`` based extensions for C-
1919
Install:
2020
--------
2121

22-
$ goinstall bitbucket.org/binet/go-python/pkg/python
22+
With `Go 1` and the `go` tool, `cgo` packages can't pass anymore additional `CGO_CFLAGS` from external programs (except `pkg-config`) to the "fake" `#cgo` preprocessor directive.
23+
So one has to do instead:
24+
25+
$ mkdir -p $GOPATH/pkg/bitbucket.org/binet
26+
$ cd $GOPATH/pkg/bitbucket.org/binet
27+
$ hg clone http://bitbucket.org/binet/go-python
28+
$ cd go-python && make
29+
2330

2431

2532
Example:

cmd/Makefile renamed to cmd/go-python/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5-
include ${GOROOT}/src/Make.inc
6-
75
TARG=go-python
86
GOFILES=\
97
main.go
108

11-
include ${GOROOT}/src/Make.cmd
9+
build:
10+
CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go build .
11+
12+
install:
13+
CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go install .
14+
15+
all: install
16+
File renamed without changes.

pkg/python/Makefile

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,25 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5-
include $(GOROOT)/src/Make.inc
6-
75
TARG=bitbucket.org/binet/go-python/pkg/python
86

97
PYTHON:=python2
108
PYTHON_VERSION:=`$(PYTHON) -c "import distutils.sysconfig, sys; sys.stdout.write(''.join(distutils.sysconfig.get_config_vars('VERSION'))+'\n')"`
119
PYTHON_CFLAGS :=`$(PYTHON) -c "import distutils.sysconfig, sys; sys.stdout.write(''.join(distutils.sysconfig.get_config_vars('CFLAGS'))+'\n')"`
1210
PYTHON_CPPFLAGS:=`$(PYTHON) -c "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc()+'\n')"`
1311
PYTHON_LDFLAGS:=`$(PYTHON) -c "import distutils.sysconfig, sys; sys.stdout.write('-L'+distutils.sysconfig.get_python_lib(0,1)+' -lpython')"`$(PYTHON_VERSION)
14-
CGO_LDFLAGS=$(PYTHON_LDFLAGS)
12+
CGO_LDFLAGS:=$(PYTHON_LDFLAGS)
1513
CGO_CFLAGS:=-I$(PYTHON_CPPFLAGS) $(PYTHON_CFLAGS)
1614

17-
CGOFILES=\
18-
veryhigh.go\
19-
exceptions.go\
20-
utilities.go\
21-
object.go\
22-
type.go\
23-
none.go\
24-
numeric.go\
25-
sequence.go\
26-
dict.go\
27-
otherobjects.go\
28-
python.go
15+
build:
16+
CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go build .
2917

18+
install:
19+
CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go install .
3020

31-
#CLEANFILES+=python_test
21+
test:
22+
CGO_LDFLAGS="$(CGO_LDFLAGS)" CGO_CFLAGS="$(CGO_CFLAGS)" go test .
3223

33-
include $(GOROOT)/src/Make.pkg
24+
all: install
3425

35-
%: install %.go
36-
$(GC) $*.go
37-
$(LD) -o $@ $*.$O
26+
PHONY: build install

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy