GO program developed using Markfile

Markfile

makefile is an automated tool to build and run software applications used.

GO program

First, we create a GO application

package main

import "fmt"

func main() {
    fmt.Println("Hello Markfile!!")
}

Creating Markfile

build:
    go build -o bin/main main.go

run:
    go run main.go

compile:
    # 32-Bit Systems
    # FreeBDS
    GOOS=freebsd GOARCH=386 go build -o bin/main-freebsd-386 main.go
    # MacOS
    GOOS=darwin GOARCH=386 go build -o bin/main-darwin-386 main.go
    # Linux
    GOOS=linux GOARCH=386 go build -o bin/main-linux-386 main.go
    # Windows
    GOOS=windows GOARCH=386 go build -o bin/main-windows-386 main.go
  # 64-Bit
    # FreeBDS
    GOOS=freebsd GOARCH=amd64 go build -o bin/main-freebsd-amd64 main.go
    # MacOS
    GOOS=darwin GOARCH=amd64 go build -o bin/main-darwin-amd64 main.go
    # Linux
    GOOS=linux GOARCH=amd64 go build -o bin/main-linux-amd64 main.go
    # Windows
    GOOS=windows GOARCH=amd64 go build -o bin/main-windows-amd64 main.go

Run command Markfile

Build command

Go to build applications for our platform

make build

Run command

Applications run go

make run

Compile command

In order for different platforms and operating systems to compile Go application

make compile

reference

I wrote together with Makefile

https://harrisonbrock.blog/go-makefile/

Guess you like

Origin www.cnblogs.com/warrior/p/12303782.html