diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6057818 --- /dev/null +++ b/LICENSE @@ -0,0 +1,18 @@ +Copyright 2023-2023 Alex Yatskov + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/cmd/.gitignore b/cmd/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/cmd/.gitignore @@ -0,0 +1 @@ +build diff --git a/cmd/Makefile b/cmd/Makefile new file mode 100644 index 0000000..c28b1d4 --- /dev/null +++ b/cmd/Makefile @@ -0,0 +1,50 @@ +appname := mex +sources := $(wildcard *.go) + +build = GOOS=$(1) GOARCH=$(2) go build -o build/$(appname)$(3) +tar = cd build && tar -cvzf $(appname)_$(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3) +zip = cd build && zip $(appname)_$(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3) + +.PHONY: all windows darwin linux clean + +all: windows darwin linux + +clean: + rm -rf build/ + +# linux builds +linux: build/$(appname)_linux_arm.tar.gz build/$(appname)_linux_arm64.tar.gz build/$(appname)_linux_386.tar.gz build/$(appname)_linux_amd64.tar.gz + +build/$(appname)_linux_386.tar.gz: $(sources) + $(call build,linux,386,) + $(call tar,linux,386) + +build/$(appname)_linux_amd64.tar.gz: $(sources) + $(call build,linux,amd64,) + $(call tar,linux,amd64) + +build/$(appname)_linux_arm.tar.gz: $(sources) + $(call build,linux,arm,) + $(call tar,linux,arm) + +build/$(appname)_linux_arm64.tar.gz: $(sources) + $(call build,linux,arm64,) + $(call tar,linux,arm64) + +# darwin builds +darwin: build/$(appname)_darwin_amd64.tar.gz + +build/$(appname)_darwin_amd64.tar.gz: $(sources) + $(call build,darwin,amd64,) + $(call tar,darwin,amd64) + +# windows builds +windows: build/$(appname)_windows_386.zip build/$(appname)_windows_amd64.zip + +build/$(appname)_windows_386.zip: $(sources) + $(call build,windows,386,.exe) + $(call zip,windows,386,.exe) + +build/$(appname)_windows_amd64.zip: $(sources) + $(call build,windows,amd64,.exe) + $(call zip,windows,amd64,.exe)