gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

Makefile (1530B)


      1 SHELL=/usr/bin/env bash
      2 NAME=minify
      3 CMD=./cmd/minify
      4 TARGETS=linux_amd64 linux_arm64 darwin_amd64 darwin_arm64 freebsd_amd64 netbsd_amd64 openbsd_amd64 windows_amd64
      5 VERSION=`git describe --tags`
      6 FLAGS=-ldflags "-s -w -X 'main.Version=${VERSION}'" -trimpath
      7 ENVS=GO111MODULES=on CGO_ENABLED=0
      8 
      9 all: install
     10 
     11 install:
     12 	echo "Installing ${VERSION}"
     13 	${ENVS} go install ${FLAGS} ./cmd/minify
     14 	. cmd/minify/bash_completion
     15 
     16 release:
     17 	TAG=$(shell git describe --tags --exact-match 2> /dev/null);
     18 	if [ "${.SHELLSTATUS}" -eq 0 ]; then \
     19 		echo "Releasing ${VERSION}"; \
     20 	else \
     21 		echo "ERROR: commit is not tagged with a version"; \
     22 		echo ""; \
     23 		exit 1; \
     24 	fi
     25 	rm -rf dist
     26 	mkdir -p dist
     27 	for t in ${TARGETS}; do \
     28 		echo Building $$t...; \
     29 		mkdir dist/$$t; \
     30 		os=$$(echo $$t | cut -f1 -d_); \
     31 		arch=$$(echo $$t | cut -f2 -d_); \
     32 		${ENVS} GOOS=$$os GOARCH=$$arch go build ${FLAGS} -o dist/$$t/${NAME} ${CMD}; \
     33 		\
     34 		cp LICENSE dist/$$t/.; \
     35 		cp cmd/minify/README.md dist/$$t/.; \
     36 		if [ "$$os" == "windows" ]; then \
     37 			mv dist/$$t/${NAME} dist/$$t/${NAME}.exe; \
     38 			zip -jq dist/${NAME}_$$t.zip dist/$$t/*; \
     39 			cd dist; \
     40 			sha256sum ${NAME}_$$t.zip >> checksums.txt; \
     41 			cd ..; \
     42 		else \
     43 			cp cmd/minify/bash_completion dist/$$t/.; \
     44 			cd dist/$$t; \
     45 			tar -cf - * | gzip -9 > ../${NAME}_$$t.tar.gz; \
     46 			cd ..; \
     47 			sha256sum ${NAME}_$$t.tar.gz >> checksums.txt; \
     48 			cd ..; \
     49 		fi; \
     50 		rm -rf dist/$$t; \
     51 	done
     52 
     53 clean:
     54 	echo "Cleaning dist/"
     55 	rm -rf dist
     56 
     57 .PHONY: install release clean
     58 .SILENT: install release clean