github.com/mmrath/gobase@v0.0.1/Makefile (about)

     1  PROJ=gobase
     2  ORG_PATH=github.com/mmrath
     3  REPO_PATH=$(ORG_PATH)/$(PROJ)
     4  export PATH := $(PWD)/bin:$(PATH)
     5  
     6  VERSION ?= $(shell ./scripts/git-version)
     7  
     8  $( shell mkdir -p bin )
     9  
    10  user=$(shell id -u -n)
    11  group=$(shell id -g -n)
    12  
    13  export GOBIN=$(PWD)/bin
    14  
    15  LD_FLAGS="-w -X $(REPO_PATH)/version.Version=$(VERSION)"
    16  
    17  build: bin/uaa-server bin/uaa-client-example bin/db_migration
    18  
    19  bin/uaa-server: uaa/uaa-server
    20  	go install -v -ldflags $(LD_FLAGS) $(REPO_PATH)/uaa/uaa-server
    21  
    22  bin/uaa-client-example:
    23  	@go install -v -ldflags $(LD_FLAGS) $(REPO_PATH)/uaa/uaa-client-example
    24  
    25  bin/db_migration:
    26  	@go install -v -ldflags $(LD_FLAGS) $(REPO_PATH)/db_migration
    27  
    28  
    29  
    30  test:
    31  	@go test -v ./...
    32  
    33  testrace:
    34  	@go test -v --race ./...
    35  
    36  vet:
    37  	@go vet ./...
    38  
    39  fmt:
    40  	@./scripts/gofmt ./...
    41  
    42  lint: bin/golint
    43  	@./bin/golint -set_exit_status $(shell go list ./...)
    44  
    45  .PHONY: docker-image
    46  docker-image:
    47  	@sudo docker build -t $(DOCKER_IMAGE) .
    48  
    49  .PHONY: proto
    50  proto: bin/protoc bin/protoc-gen-go
    51  	@./bin/protoc --go_out=plugins=grpc:. --plugin=protoc-gen-go=./bin/protoc-gen-go api/*.proto
    52  	@./bin/protoc --go_out=. --plugin=protoc-gen-go=./bin/protoc-gen-go server/internal/*.proto
    53  
    54  .PHONY: verify-proto
    55  verify-proto: proto
    56  	@./scripts/git-diff
    57  
    58  bin/protoc: scripts/get-protoc
    59  	@./scripts/get-protoc bin/protoc
    60  
    61  bin/protoc-gen-go:
    62  	@go install -v $(REPO_PATH)/vendor/github.com/golang/protobuf/protoc-gen-go
    63  
    64  bin/golint:
    65  	@go install -v $(REPO_PATH)/vendor/golang.org/x/lint/golint
    66  
    67  clean:
    68  	@rm -rf bin/
    69  
    70  testall: testrace vet fmt lint
    71  
    72  FORCE:
    73  
    74  .PHONY: test testrace vet fmt lint testall
    75  
    76  generate_certs:
    77    generate_certs:
    78    	@mkdir -p dist/ssl_certs
    79    	@mkdir -p dist/key_pair
    80    	@openssl req \
    81           -newkey rsa:2048 -nodes -keyout dist/ssl_certs/ssl_private.key \
    82           -x509 -days 365 -out dist/ssl_certs/ssl_public.crt \
    83           -subj "/C=CA/ST=British Columbia/L=Vancouver/O=Sample SSL Certificate/CN=localhost"
    84    	@openssl req \
    85           -newkey rsa:2048 -nodes -keyout dist/key_pair/sso_private.key \
    86           -x509 -days 365 -out dist/key_pair/sso_public.crt \
    87           -subj "/C=CA/ST=British Columbia/L=Vancouver/O=Sample SSL Certificate/CN=localhost"