diff --git a/Makefile b/Makefile index 52ca03f..1566d4c 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ endif # Variables #---------------------------------------------------------------- progName = scaffold +arch = amd64 +winbinName = $(progName).exe #---------------------------------------------------------------- # Helpers @@ -57,11 +59,18 @@ prep: clean > date +"%F %a %T %Z" > buildTime.txt > git describe --always --tags --dirty --long > buildVersion.txt -build: prep -> @go build -o build/$(progName) . && echo "Build success" || echo "[FAILED] go build" +build: prep linux windows -build-production: prep -> @go build -ldflags=${linkerflags} -o build/$(progName) . && echo "production build success" || echo "[FAILED] production build" +linux: +> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(progName) . && echo $@ "Build success" || echo $@ "[FAILED] go build" + +windows: +> @GOOS=$@ GOARCH=$(arch) go build -o build/$@/$(winbinName) . && echo $@ "Build success" || echo $@ "[FAILED] go build" + +build-production: prep linx-production + +linux-production: +> @GOOS=linx GOARCH=$(arch) go build -ldflags=${linkerflags} -o build/$@/$(progName) . && echo "production build success" || echo "[FAILED] production build" #------------------------------------------------------------- # Install - same as build, but places binary on system path @@ -74,4 +83,4 @@ install-production: prep > @go install -ldflags=${linkerflags} . && echo "Production build and install success" || echo "[FAILED] Production install" ## Commands that don't relate to a specific file -.PHONY: help confirm clean prep build build-production \ No newline at end of file +.PHONY: help confirm clean prep build build-production linux windows amd64 \ No newline at end of file diff --git a/main.go b/main.go index 4efca19..1ea1c41 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "os/exec" "os/user" "path/filepath" + "runtime" "strconv" "github.com/BurntSushi/toml" @@ -60,6 +61,15 @@ func main() { if *infoFlag || *infoFlag2 { fmt.Printf("Scaffold version: %s", buildVersion) fmt.Printf("Built: %s\n", buildTime) + + if runtime.GOOS == "windows" { + fmt.Println("It's a windows system") + } + + ucfgd, err := os.UserConfigDir() + ifFerr("Unable to determine user config directory", err) + fmt.Println("System says -- user config directory: ", ucfgd) + os.Exit(0) }