-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
47 lines (38 loc) · 1.93 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
BINDIR=bin
BIN=run-command-handler
IMMEDIATE_BIN=immediate-run-command-handler
BIN_ARM64=run-command-handler-arm64
IMMEDIATE_BIN_ARM64=immediate-run-command-handler-arm64
BUNDLEDIR=bundle
BUNDLE=run-command-handler.zip
bundle: clean binary
$(info creating $(BUNDLEDIR) directory)
@mkdir -p $(BUNDLEDIR)
$(info creating zip $(BUNDLEDIR)/$(BUNDLE) with contents from $(BINDIR) directory)
zip -r ./$(BUNDLEDIR)/$(BUNDLE) ./$(BINDIR)
zip -j ./$(BUNDLEDIR)/$(BUNDLE) ./misc/HandlerManifest.json
zip -j ./$(BUNDLEDIR)/$(BUNDLE) ./misc/manifest.xml
binary: clean
$(info building amd64 binaries)
GOOS=linux GOARCH=amd64 go build -v \
-ldflags "-X main.Version=`grep -E -m 1 -o '<Version>(.*)</Version>' misc/manifest.xml | awk -F">" '{print $$2}' | awk -F"<" '{print $$1}'`" \
-o $(BINDIR)/$(BIN) ./cmd/main
$(info building amd64 immediate run command service)
OOS=linux GOARCH=amd64 go build -v \
-ldflags "-X immediateruncommandservice.Version=`grep -E -m 1 -o '<Version>(.*)</Version>' misc/manifest.xml | awk -F">" '{print $$2}' | awk -F"<" '{print $$1}'`" \
-o $(BINDIR)/$(IMMEDIATE_BIN) ./cmd/immediateruncommandservice
$(info building arm64 binaries)
GOOS=linux GOARCH=arm64 go build -v \
-ldflags "-X main.Version=`grep -E -m 1 -o '<Version>(.*)</Version>' misc/manifest.xml | awk -F">" '{print $$2}' | awk -F"<" '{print $$1}'`" \
-o $(BINDIR)/$(BIN_ARM64) ./cmd/main
$(info building amd64 immediate run command service)
GOOS=linux GOARCH=arm64 go build -v \
-ldflags "-X immediateruncommandservice.Version=`grep -E -m 1 -o '<Version>(.*)</Version>' misc/manifest.xml | awk -F">" '{print $$2}' | awk -F"<" '{print $$1}'`" \
-o $(BINDIR)/$(IMMEDIATE_BIN_ARM64) ./cmd/immediateruncommandservice
$(info copy run-command-shim into $(BINDIR))
cp ./misc/run-command-shim ./$(BINDIR)
clean:
$(info cleaning $(BINDIR) and $(BUNDLEDIR) directories)
rm -rf "$(BINDIR)" "$(BUNDLEDIR)"
$(info directories cleaned)
.PHONY: clean binary