Skip to content

Commit

Permalink
Better Makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed May 12, 2015
1 parent dada32c commit 4fc85e2
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 42 deletions.
34 changes: 2 additions & 32 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,2 @@
all: regen check

regen:
go install ./...
make -C testdata regen

.PHONY: check
check: errcheck go-nyet golint
errcheck testdata/out/compress-memcopy.go
errcheck testdata/out/compress-nomemcopy.go
errcheck testdata/out/debug.go
errcheck testdata/out/nocompress-memcopy.go
errcheck testdata/out/nocompress-nomemcopy.go
go-nyet testdata/out/compress-memcopy.go
go-nyet testdata/out/compress-nomemcopy.go
go-nyet testdata/out/debug.go
go-nyet testdata/out/nocompress-memcopy.go
go-nyet testdata/out/nocompress-nomemcopy.go
golint testdata/out/compress-memcopy.go
golint testdata/out/compress-nomemcopy.go
golint testdata/out/debug.go
golint testdata/out/nocompress-memcopy.go
golint testdata/out/nocompress-nomemcopy.go

errcheck:
go get github.com/kisielk/errcheck

go-nyet:
go get github.com/barakmich/go-nyet

golint:
go get github.com/golang/lint/golint
all:
make -C testdata
38 changes: 32 additions & 6 deletions testdata/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
regen:
go-bindata -o out/compress-memcopy.go in/...
go-bindata -nomemcopy -o out/compress-nomemcopy.go in/...
go-bindata -debug -o out/debug.go in/...
go-bindata -nocompress -o out/nocompress-memcopy.go in/...
go-bindata -nocompress -nomemcopy -o out/nocompress-nomemcopy.go in/...
.PHONY: check
check: out/compress-memcopy.go out/compress-nomemcopy.go out/debug.go out/nocompress-memcopy.go out/nocompress-nomemcopy.go errcheck go-nyet golint
$(foreach file, $(wildcard out/*.go), errcheck $(file);)
$(foreach file, $(wildcard out/*.go), go-nyet $(file);)
$(foreach file, $(wildcard out/*.go), golint $(file);)

$(GOPATH)/bin/go-bindata: $(wildcard ../*.go) $(wildcard ../**/*.go)
go install ../...

out/compress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -o $@ in/...

out/compress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nomemcopy -o $@ in/...

out/debug.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -debug -o $@ in/...

out/nocompress-memcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nocompress -o $@ in/...

out/nocompress-nomemcopy.go: $(wildcard in/**/*) $(GOPATH)/bin/go-bindata
$(GOPATH)/bin/go-bindata -nocompress -nomemcopy -o $@ in/...

errcheck:
go get github.com/kisielk/errcheck

go-nyet:
go get github.com/barakmich/go-nyet

golint:
go get github.com/golang/lint/golint
2 changes: 1 addition & 1 deletion testdata/out/compress-memcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/out/compress-nomemcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/out/nocompress-memcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/out/nocompress-nomemcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func in_a_test_asset() (*asset, error) {
return nil, err
}

info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1430781941, 0)}
info := bindataFileInfo{name: "in/a/test.asset", size: 15, mode: os.FileMode(420), modTime: time.Unix(1431385279, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
Expand Down

0 comments on commit 4fc85e2

Please sign in to comment.