-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
42 lines (34 loc) · 1.13 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
BUILDDIR ?= dist
OSS ?= linux darwin freebsd windows
ARCHS ?= amd64 arm64
VERSION ?= $(shell git describe --tags `git rev-list -1 HEAD`)
build: $(BUILDDIR)/wgrest
clean:
rm -rf "$(BUILDDIR)"
install: build
define wgrest
$(BUILDDIR)/wgrest-$(1)-$(2): export CGO_ENABLED := 0
$(BUILDDIR)/wgrest-$(1)-$(2): export GOOS := $(1)
$(BUILDDIR)/wgrest-$(1)-$(2): export GOARCH := $(2)
$(BUILDDIR)/wgrest-$(1)-$(2):
go build \
-ldflags="-s -w -X main.appVersion=$(VERSION)" \
-trimpath -v -o "$(BUILDDIR)/wgrest-$(1)-$(2)" \
cmd/wgrest-server/main.go
endef
$(foreach OS,$(OSS),$(foreach ARCH,$(ARCHS),$(eval $(call wgrest,$(OS),$(ARCH)))))
$(BUILDDIR)/wgrest: $(foreach OS,$(OSS),$(foreach ARCH,$(ARCHS),$(BUILDDIR)/wgrest-$(OS)-$(ARCH)))
@mkdir -vp "$(BUILDDIR)"
go-echo-server:
openapi-generator generate -g go-echo-server \
-i openapi-spec.yaml \
-o . \
--git-host github.com \
--git-user-id suquant \
--git-repo-id wgrest
typescript-axios-client:
swagger-codegen generate -l typescript-axios \
--additional-properties modelPropertyNaming=original \
-i openapi-spec.yaml \
-o clients/typeascript-axios
.PHONY: clean build install