-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 1.76 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
49
50
51
52
53
54
55
56
57
58
59
60
#
# makefile of intri core
#
CROSS = aarch64-linux-gnu-
AR = $(CROSS)ar
CC = $(CROSS)gcc
STRIP = $(CROSS)strip
# GoBuildEnv=$(CC) GOSUMDB=off CGO_ENABLED=1 GOARCH=arm GOARM=7 GOOS=linux
NowDirName=$$(echo ${PWD} | awk -F '/' '{print $$NF}')
GO_CC = CC=$(CC)
GO_OPTS = CGO_ENABLED=1 GOARCH=arm64 GOOS=linux
# GO_OPTS = GOARCH=arm64 GOARM=8 GOOS=linux
all: switch-template switch-template-test
tag:
@git describe --tags --abbrev=0 | awk -F. '{OFS="."; $$NF+=1; print $$0}' | xargs -t -I % sh -c 'git tag %'
hide:
@printf "[_] Add build files into .gitignore\r"
@sed -E -i '.bk' "s/(.*)#(.*)$(NowDirName)/$(NowDirName)/g" ./.gitignore; rm -f ./.gitignore.bk
@if [[ $$(sed -n "/$(NowDirName)/p" ./.gitignore) = "" ]]; \
then \
echo "# repository genarate binary\n$(NowDirName)\n\n" >> ./.gitignore; \
fi
@printf "[v] Add build files into .gitignore\n"
mod-tidy:
@printf "[_] Run go mod tidy\r"
@GOSUMDB=off go get -d github.com/Intrising/intri-utils@ltos5_feat_porting
@GOSUMDB=off go get -d github.com/Intrising/intri-type@ltos5_feat_porting
@GOSUMDB=off go mod tidy
@printf "[v] Run go mod tidy\n"
clean:
@printf "[_] Clear build files\r"
@rm -f ./switch-template*
@printf "[v] Clear build files\n"
build: main.go clean hide mod-tidy
@printf "[_] Building binary\r"
@$(GO_OPTS) go build -o $(NowDirName) $<
@printf "[v] Building binary\n"
switch-template: main.go ./*/*.go
@printf "[_] Building binary\r"
$(GO_CC) $(GO_OPTS) go build -o $@ $<
$(STRIP) $@
@printf "[v] Building binary\n"
switch-template-test:${PWD}/testing/
@printf "[_] Building binary\r"
$(GO_CC) $(GO_OPTS) go test $< -c -v -o $@
$(STRIP) $@
@printf "[v] Building binary\n"