]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: don't run cgo when not compiling
authorGustavo Niemeyer <gustavo@niemeyer.net>
Tue, 8 Feb 2011 20:40:11 +0000 (15:40 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 8 Feb 2011 20:40:11 +0000 (15:40 -0500)
The logic introduced to avoid running cgo when
introducing _cgo_flags is faulty.  My goal was
to handle it with the following statement:

    -include _cgo_flags

The dash tells make to ignore errors if it can't
include the file.

What I missed, though, was the fact that it
*will* attempt to build the file if it knows
how.

This change will introduce the originally
intended semantics of not attempting to build
the file before necessary.

R=rsc
CC=golang-dev
https://golang.org/cl/4023069

src/Make.pkg

index 850e86e35263b06db0aa753d05358dad150ec16d..ca0fa9ee2ca1151029a1e727b79d3bdfb5a8a454 100644 (file)
@@ -119,14 +119,14 @@ _cgo_run: $(CGOFILES)
 # _CGO_CFLAGS and _CGO_LDFLAGS are defined via the evaluation of _cgo_flags.
 # The include happens before the commands in the recipe run,
 # so it cannot be done in the same recipe that runs cgo.
-_cgo_flags: _cgo_run
+_load_cgo_flags: _cgo_run
        $(eval include _cgo_flags)
 
 # Include any previous flags in case cgo files are up to date.
 -include _cgo_flags
 
 # Ugly but necessary - cgo writes these files too.
-_cgo_gotypes.go _cgo_export.c _cgo_export.h _cgo_main.c _cgo_defun.c: _cgo_flags
+_cgo_gotypes.go _cgo_export.c _cgo_export.h _cgo_main.c _cgo_defun.c: _load_cgo_flags
        @true
 
 %.cgo1.go %.cgo2.c: _cgo_defun.c