-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (40 loc) · 1.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###### Makefile for hls-get
export CGO_ENABLED=0
GOPATHSRC := $(GOPATH)/src
GOHOSTARCH:=$(shell go env GOHOSTARCH)
GOHOSTOS:=$(shell go env GOHOSTOS)
GOARCH ?= $(GOHOSTARCH)
GOOS ?= $(GOHOSTOS)
GO111MODULE ?= on
ifneq ($(GOOS)_$(GOARCH),$(GOHOSTOS)_$(GOHOSTARCH))
GOPATHBIN := $(GOPATH)/bin/$(GOOS)_$(GOARCH)
else
GOPATHBIN := $(GOPATH)/bin
endif
GOSRCS := $(shell find . -name "*.go")
.PHONY=version.go
VERSION=$(subst heads/,,$(shell git describe --all))
TAG=$(shell git rev-parse --short HEAD)
DATE=`date +'%F %T'`
MACHINE=$(shell uname -a)
all: $(GOPATHBIN)/hls-get
version.go: go.mod $(GOSRCS) Makefile
@echo "Generating Version $@ ..."
@echo "/* AUTO GENERATED */" > $@
@echo "package main" >> $@
@echo "const (" >> $@
@echo " VERSION=\"$(VERSION)\"" >> $@
@echo " TAG=\"$(TAG)\"" >> $@
@echo " BUILD_TIME=\"$(DATE)\"" >> $@
@echo ")" >> $@
htmldocs/assets_vfsdata.go:
@make -C htmldocs/
$(GOPATHBIN)/hls-get: version.go go.mod $(GOSRCS) htmldocs/assets_vfsdata.go
@echo "Building $@ ..."
@go install -tags release hls-get
run: $(GOPATHBIN)/hls-get
@echo "Starting test ..."
@$(GOPATHBIN)/hls-get --config example.yaml serve --debug --combine --remove --format=mp4
clean:
@rm -f $(GOPATHBIN)/hls-get
@make -C htmldocs/ clean