diff --git a/Examples/Makefile.in b/Examples/Makefile.in index d8ebb80e3..cee91db30 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -1598,6 +1598,16 @@ go: $(SRCS) $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \ fi; \ fi + if test -f $(RUNME).go; then \ + $(GO) $(GOCOMPILEARG) $(RUNME).go; \ + if $(GOGCC) ; then \ + $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \ + elif $(GO12); then \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + else \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + fi; \ + fi # ---------------------------------------------------------------- # Build a Go module (C++) @@ -1621,35 +1631,22 @@ go_cpp: $(SRCS) $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \ fi; \ fi + if test -f $(RUNME).go; then \ + $(GO) $(GOCOMPILEARG) $(RUNME).go; \ + if $(GOGCC) ; then \ + $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \ + elif $(GO12); then \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + else \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + fi; \ + fi # ----------------------------------------------------------------- # Running a Go example (C) # ----------------------------------------------------------------- -go_run: runme.go - $(GO) $(GOCOMPILEARG) runme.go - if $(GOGCC) ; then \ - $(COMPILETOOL) $(GO) -o runme runme.@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \ - elif $(GO12); then \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS)" -o runme runme.$(GOOBJEXT); \ - else \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o runme runme.$(GOOBJEXT); \ - fi - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./runme $(RUNPIPE) - -# ----------------------------------------------------------------- -# Running a Go example (C++) -# ----------------------------------------------------------------- - -go_run_cpp: runme.go - $(GO) $(GOCOMPILEARG) runme.go - if $(GOGCC) ; then \ - $(COMPILETOOL) $(GO) -o runme runme.@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \ - elif $(GO12); then \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o runme runme.$(GOOBJEXT); \ - else \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o runme runme.$(GOOBJEXT); \ - fi +go_run: env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./runme $(RUNPIPE) # ----------------------------------------------------------------- diff --git a/Examples/go/callback/Makefile b/Examples/go/callback/Makefile index 4516d2674..46a14b417 100644 --- a/Examples/go/callback/Makefile +++ b/Examples/go/callback/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/go/class/Makefile b/Examples/go/class/Makefile index 66b2df325..72605caa5 100644 --- a/Examples/go/class/Makefile +++ b/Examples/go/class/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/go/enum/Makefile b/Examples/go/enum/Makefile index 6f9347ca8..1ceecc15c 100644 --- a/Examples/go/enum/Makefile +++ b/Examples/go/enum/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/go/extend/Makefile b/Examples/go/extend/Makefile index 386d4d0bb..67da89286 100644 --- a/Examples/go/extend/Makefile +++ b/Examples/go/extend/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/go/reference/Makefile b/Examples/go/reference/Makefile index 5c5e6808b..41a944239 100644 --- a/Examples/go/reference/Makefile +++ b/Examples/go/reference/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ diff --git a/Examples/go/template/Makefile b/Examples/go/template/Makefile index 20ffb7136..6796348a9 100644 --- a/Examples/go/template/Makefile +++ b/Examples/go/template/Makefile @@ -6,7 +6,7 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run_cpp + $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \