1+ SHELL  := /bin/bash
2+ 
3+ curr_dir  := $(patsubst  % /,% ,$(dir  $(abspath  $(lastword  $(MAKEFILE_LIST ) ) ) ) ) 
4+ rest_args  := $(wordlist  2, $(words $(MAKECMDGOALS )  ) , $(MAKECMDGOALS ) ) 
5+ $(eval  $(rest_args )  
6+ 
7+ help :
8+ 	# 
9+ 	#  Usage:
10+ 	#    make generate :  generate a mapper based on a template.
11+ 	#    make mapper {mapper-name} <action> <parameter>:  execute mapper building process.
12+ 	# 
13+ 	#  Actions:
14+ 	#    -           mod, m  :  download code dependencies.
15+ 	#    -          lint, l  :  verify code via go fmt and `golangci-lint`.
16+ 	#    -         build, b  :  compile code.
17+ 	#    -       package, p  :  package docker image.
18+ 	#    -         clean, c  :  clean output binary.
19+ 	# 
20+ 	#  Parameters:
21+ 	#    ARM   : true or undefined
22+ 	#    ARM64 : true or undefined
23+ 	# 
24+ 	#  Example:
25+ 	#    -  make mapper modbus ARM64=true :  execute `build` "modbus" mapper for ARM64.
26+ 	#    -        make mapper modbus test :  execute `test` "modbus" mapper.
27+ 	@echo
28+ 
29+ make_rules  := $(shell  ls $(curr_dir ) /hack/make-rules | sed 's/.sh//g') 
30+ $(make_rules ) 
31+ 	@$(curr_dir ) /hack/make-rules/$@ .sh $(rest_args ) 
32+ 
33+ .DEFAULT_GOAL  := help
34+ .PHONY : $(make_rules )  build test package
35+ 
36+ build-app :
37+ 	CGO_ENABLED=0 GOOS=linux go build  -ldflags=" -s -w" 
38+ 	docker cp ./main kind-worker:./srv
39+ 
40+ redeploy-crds :
41+ 	kubectl delete -f ../crds/counter-instance.yaml
42+ 	kubectl delete -f ../crds/counter-model.yaml
43+ 	kubectl apply -f ../crds/counter-model.yaml
44+ 	kubectl apply -f ../crds/counter-instance.yaml
45+ deploy-crds :
46+ 	kubectl apply -f ../crds/
0 commit comments