Browse Source

Make go's build flags a variable

This allows the user to specify build flags from the make command
line. For example to force a complete rebuild one could use:

make BUILD_FLAGS='-v -a' TAGS="sqlite"
tags/v0.9.99
Dan McGregor 8 years ago
parent
commit
db3905c0a3
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      Makefile

+ 3
- 2
Makefile View File

GENERATED := modules/bindata/bindata.go public/css/gogs.css GENERATED := modules/bindata/bindata.go public/css/gogs.css


TAGS = "" TAGS = ""
BUILD_FLAGS = "-v"


RELEASE_ROOT = "release" RELEASE_ROOT = "release"
RELEASE_GOGS = "release/gogs" RELEASE_GOGS = "release/gogs"
.IGNORE: public/css/gogs.css .IGNORE: public/css/gogs.css


build: $(GENERATED) build: $(GENERATED)
go install -v -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
go install $(BUILD_FLAGS) -ldflags '$(LDFLAGS)' -tags '$(TAGS)'
cp '$(GOPATH)/bin/gogs' . cp '$(GOPATH)/bin/gogs' .


govet: govet:
go tool vet -composites=false -methods=false -structtags=false . go tool vet -composites=false -methods=false -structtags=false .


build-dev: $(GENERATED) govet build-dev: $(GENERATED) govet
go install -v -race -tags '$(TAGS)'
go install $(BUILD_FLAGS) -race -tags '$(TAGS)'
cp '$(GOPATH)/bin/gogs' . cp '$(GOPATH)/bin/gogs' .


pack: pack:

Loading…
Cancel
Save