Browse code

Makefile: remove empty targets, and slight refactor

The empty `binary:`, `dynbinary:`, and `cross:` targets at the top were
only useful to provide the description for `make help`.

This patch splits the actual `binary`, `dynbinary`, and `cross` targets
to separate lines, introducing some slight duplicated code, but making
it slightly easier to read (and removing the "empty" targets).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/05/01 23:48:07
Showing 1 changed files
... ...
@@ -168,15 +168,9 @@ VERSION_AUTOGEN_ARGS = --build-arg VERSION --build-arg DOCKER_GITCOMMIT --build-
168 168
 
169 169
 default: binary
170 170
 
171
-all: build ## validate all checks, build linux binaries, run all tests\ncross build non-linux binaries and generate archives
171
+all: build ## validate all checks, build linux binaries, run all tests,\ncross build non-linux binaries, and generate archives
172 172
 	$(DOCKER_RUN_DOCKER) bash -c 'hack/validate/default && hack/make.sh'
173 173
 
174
-binary: ## build statically linked linux binaries
175
-dynbinary: ## build dynamically linked linux binaries
176
-cross: ## cross build the binaries for darwin, freebsd and\nwindows
177
-
178
-cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
179
-
180 174
 # This is only used to work around read-only bind mounts of the source code into
181 175
 # binary build targets. We end up mounting a tmpfs over autogen which allows us
182 176
 # to write build-time generated assets even though the source is mounted read-only
... ...
@@ -184,7 +178,14 @@ cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
184 184
 autogen:
185 185
 	mkdir -p autogen
186 186
 
187
-binary dynbinary cross: buildx autogen
187
+binary: buildx autogen ## build statically linked linux binaries
188
+	$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
189
+
190
+dynbinary: buildx autogen ## build dynamically linked linux binaries
191
+	$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
192
+
193
+cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
194
+cross: buildx autogen ## cross build the binaries for darwin, freebsd and\nwindows
188 195
 	$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
189 196
 
190 197
 bundles: