@@ -65,9 +65,12 @@ CGO_ENABLED:=0
65
65
# Construct the "-tags" parameter used by "go build".
66
66
BUILD_TAGS? =
67
67
68
+ LINUX_BUILD_TAGS = $(BUILD_TAGS )
69
+ WINDOWS_BUILD_TAGS = $(BUILD_TAGS )
70
+
68
71
ifeq ($(ENABLE_JOURNALD ) , 1)
69
72
# Enable journald build tag.
70
- BUILD_TAGS:= $(BUILD_TAGS) journald
73
+ LINUX_BUILD_TAGS := $(BUILD_TAGS) journald
71
74
# Enable cgo because sdjournal needs cgo to compile. The binary will be
72
75
# dynamically linked if CGO_ENABLED is enabled. This is fine because fedora
73
76
# already has necessary dynamic library. We can not use `-extldflags "-static"`
82
85
endif
83
86
84
87
vet :
85
- GO111MODULE=on go list -mod vendor -tags " $( BUILD_TAGS ) " ./... | \
88
+ GO111MODULE=on go list -mod vendor -tags " $( LINUX_BUILD_TAGS ) " ./... | \
86
89
grep -v " ./vendor/*" | \
87
- GO111MODULE=on xargs go vet -mod vendor -tags " $( BUILD_TAGS ) "
90
+ GO111MODULE=on xargs go vet -mod vendor -tags " $( LINUX_BUILD_TAGS ) "
88
91
89
92
fmt :
90
93
find . -type f -name " *.go" | grep -v " ./vendor/*" | xargs gofmt -s -w -l
@@ -110,8 +113,8 @@ endif
110
113
-mod vendor \
111
114
-o $@ \
112
115
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
113
- -tags "$(BUILD_TAGS )" \
114
- ./cmd/$(subst -,,$*)/$(subst -,_,$*).go
116
+ -tags "$(WINDOWS_BUILD_TAGS )" \
117
+ ./cmd/$(subst -,,$*)
115
118
touch $@
116
119
117
120
./test/bin/windows_amd64/% .exe : $(PKG_SOURCES )
@@ -121,24 +124,24 @@ endif
121
124
GOOS=windows GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on go build \
122
125
-mod vendor \
123
126
-o $@ \
124
- -tags "$(BUILD_TAGS )" \
125
- ./test/e2e/$(subst -,,$*)/$(subst -,_,$*).go
127
+ -tags "$(WINDOWS_BUILD_TAGS )" \
128
+ ./test/e2e/$(subst -,,$*)
126
129
127
130
bin/linux_amd64/% : $(PKG_SOURCES )
128
131
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED ) GO111MODULE=on go build \
129
132
-mod vendor \
130
133
-o $@ \
131
134
-ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
132
- -tags " $( BUILD_TAGS ) " \
133
- ./cmd/$(subst -,,$* ) / $( subst -,_, $* ) .go
135
+ -tags " $( LINUX_BUILD_TAGS ) " \
136
+ ./cmd/$(subst -,,$* )
134
137
touch $@
135
138
136
139
./test/bin/linux_amd64/% : $(PKG_SOURCES )
137
140
GOOS=linux GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED ) GO111MODULE=on go build \
138
141
-mod vendor \
139
142
-o $@ \
140
- -tags " $( BUILD_TAGS ) " \
141
- ./test/e2e/$(subst -,,$* ) / $( subst -,_, $* ) .go
143
+ -tags " $( LINUX_BUILD_TAGS ) " \
144
+ ./test/e2e/$(subst -,,$* )
142
145
143
146
ifneq ($(ENABLE_JOURNALD ) , 1)
144
147
bin/linux_amd64/log-counter :
@@ -152,7 +155,7 @@ ifeq ($(ENABLE_JOURNALD), 1)
152
155
-mod vendor \
153
156
-o bin/log-counter \
154
157
-ldflags '-X $(PKG)/pkg/version.version=$(VERSION)' \
155
- -tags "$(BUILD_TAGS )" \
158
+ -tags "$(LINUX_BUILD_TAGS )" \
156
159
cmd/logcounter/log_counter.go
157
160
else
158
161
echo "Warning: log-counter requires journald, skipping."
@@ -163,29 +166,29 @@ endif
163
166
-mod vendor \
164
167
-o bin/node-problem-detector \
165
168
-ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
166
- -tags " $( BUILD_TAGS ) " \
169
+ -tags " $( LINUX_BUILD_TAGS ) " \
167
170
./cmd/nodeproblemdetector
168
171
169
172
./test/bin/problem-maker : $(PKG_SOURCES )
170
173
CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GO111MODULE=on go build \
171
174
-mod vendor \
172
175
-o test/bin/problem-maker \
173
- -tags " $( BUILD_TAGS ) " \
176
+ -tags " $( LINUX_BUILD_TAGS ) " \
174
177
./test/e2e/problemmaker/problem_maker.go
175
178
176
179
./bin/health-checker : $(PKG_SOURCES )
177
180
CGO_ENABLED=$(CGO_ENABLED ) GOOS=linux GO111MODULE=on go build \
178
181
-mod vendor \
179
182
-o bin/health-checker \
180
183
-ldflags ' -X $(PKG)/pkg/version.version=$(VERSION)' \
181
- -tags " $( BUILD_TAGS ) " \
184
+ -tags " $( LINUX_BUILD_TAGS ) " \
182
185
cmd/healthchecker/health_checker.go
183
186
184
187
test : vet fmt
185
- GO111MODULE=on go test -mod vendor -timeout=1m -v -race -short -tags " $( BUILD_TAGS ) " ./...
188
+ GO111MODULE=on go test -mod vendor -timeout=1m -v -race -short -tags " $( LINUX_BUILD_TAGS ) " ./...
186
189
187
190
e2e-test : vet fmt build-tar
188
- GO111MODULE=on ginkgo -nodes=$(PARALLEL ) -mod vendor -timeout=10m -v -tags " $( BUILD_TAGS ) " -stream \
191
+ GO111MODULE=on ginkgo -nodes=$(PARALLEL ) -mod vendor -timeout=10m -v -tags " $( LINUX_BUILD_TAGS ) " -stream \
189
192
./test/e2e/metriconly/... -- \
190
193
-project=$(PROJECT ) -zone=$(ZONE ) \
191
194
-image=$(VM_IMAGE ) -image-family=$(IMAGE_FAMILY ) -image-project=$(IMAGE_PROJECT ) \
0 commit comments