diff --git a/Makefile.am b/Makefile.am index fdb2bc5..2add1bc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,8 @@ hclgo.bin: sed -ri "/^[[:space:]]*replace[[:space:]]+cfg[[:space:]]*=>/d" $(builddir)/go.mod echo -e "\nreplace cfg => $(abs_builddir)/go/cfg" >> $(builddir)/go.mod [ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true + CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \ + CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl -lquadmath" \ go build -C $(srcdir) -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod rm -rf $(builddir)/go.mod $(builddir)/go.sum diff --git a/Makefile.in b/Makefile.in index b710d00..1dc7c95 100644 --- a/Makefile.in +++ b/Makefile.in @@ -943,6 +943,8 @@ clean-local: @ENABLE_HCLGO_TRUE@ sed -ri "/^[[:space:]]*replace[[:space:]]+cfg[[:space:]]*=>/d" $(builddir)/go.mod @ENABLE_HCLGO_TRUE@ echo -e "\nreplace cfg => $(abs_builddir)/go/cfg" >> $(builddir)/go.mod @ENABLE_HCLGO_TRUE@ [ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true +@ENABLE_HCLGO_TRUE@ CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \ +@ENABLE_HCLGO_TRUE@ CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl -lquadmath" \ @ENABLE_HCLGO_TRUE@ go build -C $(srcdir) -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod @ENABLE_HCLGO_TRUE@ go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod @ENABLE_HCLGO_TRUE@ rm -rf $(builddir)/go.mod $(builddir)/go.sum diff --git a/go/cb.go b/go/cb.go index 53d2e42..968ba86 100644 --- a/go/cb.go +++ b/go/cb.go @@ -1,26 +1,24 @@ package hcl /* -#cgo CFLAGS: -I/home/hyung-hwan/xxx/include -g -Wall -#cgo LDFLAGS: -L/home/hyung-hwan/xxx/lib -lhcl -ldl -lquadmath - #include #include */ import "C" import ( -// "bufio" -// "io" + // "bufio" + // "io" "os" -// "sync" -// "unsafe" + // "sync" + // "unsafe" ) type IOHandle struct { file *os.File ioif interface{} } + /* type IOHandleTable struct { mtx sync.Mutex @@ -408,7 +406,7 @@ func (p *PrintFileHandler) Open(g *HCL) error { f *os.File // err error ) - + // f, err = os.OpenFile("/dev/stdout", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) // if err != nil { // return err diff --git a/go/hcl.go b/go/hcl.go index 4db9b28..e98741d 100644 --- a/go/hcl.go +++ b/go/hcl.go @@ -1,9 +1,6 @@ package hcl /* -#cgo CFLAGS: -I/home/hyung-hwan/xxx/include -g -Wall -#cgo LDFLAGS: -L/home/hyung-hwan/xxx/lib -lhcl -ldl -lquadmath - #include #include */ diff --git a/go/inst.go b/go/inst.go index 8dac0ad..817435e 100644 --- a/go/inst.go +++ b/go/inst.go @@ -1,9 +1,6 @@ package hcl /* -#cgo CFLAGS: -I/home/hyung-hwan/xxx/include -g -Wall -#cgo LDFLAGS: -L/home/hyung-hwan/xxx/lib -lhcl -ldl -lquadmath - #include */ import "C"