-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (48 loc) · 1.3 KB
/
Makefile
File metadata and controls
58 lines (48 loc) · 1.3 KB
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
PREFIX=/usr/local
BINDIR=${PREFIX}/bin
DESTDIR=
BLDDIR = build
# GOOS 的可选项包括:
# darwin:macOS
# linux:Linux
# windows:Windows
# freebsd:FreeBSD
# netbsd:NetBSD
# openbsd:OpenBSD
# dragonfly:DragonFly BSD
# android:Android
# ios:iOS
# js:JavaScript(用于 WebAssembly)
# GOARCH 的可选项包括:
# amd64:64 位 x86 架构
# 386:32 位 x86 架构
# arm:32 位 ARM 架构
# arm64:64 位 ARM 架构(也称为 AArch64)
# mips:32 位 MIPS 架构
# mipsle:32 位小端 MIPS 架构
# mips64:64 位 MIPS 架构
# mips64le:64 位小端 MIPS 架构
# ppc:32 位 PowerPC 架构
# ppc64:64 位 PowerPC 架构
# ppc64le:64 位小端 PowerPC 架构
# s390x:64 位 IBM Z 架构
BLDFLAGS = CGO_ENABLED=0 GOOS=linux GOARCH=amd64 #golang的交叉编译妙啊
EXT=
ifeq (${GOOS},windows)
EXT=.exe
endif
APPS = sqlserver_proxy
BLDDIR = build
all: $(APPS)
$(BLDDIR)/sqlserver_proxy: $(wildcard cmd/proxy/*.go internal/node/*.go internal/proxy/*.go)
$(BLDDIR)/%:
@mkdir -p $(dir $@)
${BLDFLAGS} go build -o $@ ./cmd/$*
$(APPS): %: $(BLDDIR)/%
clean:
rm -fr $(BLDDIR)
.PHONY: install clean all
.PHONY: $(APPS)
install: $(APPS)
install -m 755 -d ${DESTDIR}${BINDIR}
for APP in $^ ; do install -m 755 ${BLDDIR}/$$APP ${DESTDIR}${BINDIR}/$$APP${EXT} ; done