-3

I have some Go source files: one.go, two.go,main.go

I build them to C static library for using in my cross-platform application compilation.

There are 4 types of application compilation:

  1. Compilation on Windows
  2. Compilation on Ubuntu
  3. Compilation on Mac
  4. Cross-compilation for Windows from Ubuntu

For 1,2,3 I use:

go build -buildmode c-archive -o libxyz.a .

For 4, I use:

GOOS="windows" GOARCH="amd64" CGO_ENABLED="1" CXX="x86_64-w64-mingw32-g++" CC="x86_64-w64-mingw32-gcc" go build -buildmode c-archive -o libxyz.a .

Is it somehow possible to do that by the configure-make-make install procedure? (There is no configure.ac file in the xyz Go source package)

Also, it possible to use pkg-config in that?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
test
  • 105
  • 2
  • 8
  • 1
    Of course it's possible. There's nothing stopping you from writing your configure-make-install configuration as you wish. But it's probably not a good idea. – Jonathan Hall Aug 06 '20 at 08:11

1 Answers1

2

Is it somehow possible to do that by the configure-make-make install procedure [?]

Yes.

Should you do it, is this easy, is this sensible, does this provide any benefit? No, no, no, no.

If you want to type less: Write a small shell script (or a tiny Makefile if you insist on using make for whatever reason).

Volker
  • 40,468
  • 7
  • 81
  • 87