simplify server compile in one only block with options (#178)
Simplify make server command by setting a new var for gcflags based on MM_DEBUG.
This commit is contained in:
		
							parent
							
								
									d17821a331
								
							
						
					
					
						commit
						b874f4747e
					
				
					 1 changed files with 15 additions and 20 deletions
				
			
		
							
								
								
									
										35
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										35
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -31,6 +31,12 @@ ifneq ($(wildcard build/custom.mk),) | |||
| 	include build/custom.mk | ||||
| endif | ||||
| 
 | ||||
| ifneq ($(MM_DEBUG),) | ||||
| 	GO_BUILD_GCFLAGS = -gcflags "all=-N -l" | ||||
| else | ||||
| 	GO_BUILD_GCFLAGS = | ||||
| endif | ||||
| 
 | ||||
| ## Checks the code style, tests, builds and bundles the plugin.
 | ||||
| .PHONY: all | ||||
| all: check-style test dist | ||||
|  | @ -59,30 +65,19 @@ endif | |||
| .PHONY: server | ||||
| server: | ||||
| ifneq ($(HAS_SERVER),) | ||||
| 	mkdir -p server/dist; | ||||
| ifeq ($(MM_DEBUG),) | ||||
| ifneq ($(MM_SERVICESETTINGS_ENABLEDEVELOPER),) | ||||
| 	@echo Building plugin only for $(DEFAULT_GOOS)-$(DEFAULT_GOARCH) because MM_SERVICESETTINGS_ENABLEDEVELOPER is enabled | ||||
| 	cd server && $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-$(DEFAULT_GOOS)-$(DEFAULT_GOARCH); | ||||
| else | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-linux-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-linux-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-darwin-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-darwin-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -trimpath -o dist/plugin-windows-amd64.exe; | ||||
| endif | ||||
| else | ||||
| ifneq ($(MM_DEBUG),) | ||||
| 	$(info DEBUG mode is on; to disable, unset MM_DEBUG) | ||||
| endif | ||||
| 	mkdir -p server/dist; | ||||
| ifneq ($(MM_SERVICESETTINGS_ENABLEDEVELOPER),) | ||||
| 	@echo Building plugin only for $(DEFAULT_GOOS)-$(DEFAULT_GOARCH) because MM_SERVICESETTINGS_ENABLEDEVELOPER is enabled | ||||
| 	cd server && $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-$(DEFAULT_GOOS)-$(DEFAULT_GOARCH); | ||||
| 	cd server && env CGO_ENABLED=0 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-$(DEFAULT_GOOS)-$(DEFAULT_GOARCH); | ||||
| else | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-linux-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-linux-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-darwin-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-darwin-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) -gcflags "all=-N -l" -trimpath -o dist/plugin-windows-amd64.exe; | ||||
| endif | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-linux-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-linux-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-darwin-amd64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-darwin-arm64; | ||||
| 	cd server && env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(GO_BUILD_FLAGS) $(GO_BUILD_GCFLAGS) -trimpath -o dist/plugin-windows-amd64.exe; | ||||
| endif | ||||
| endif | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue