From 4fc85e2b3c1893fbfadbf2abf8c2de1974269e63 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 11 May 2015 19:31:38 -0400 Subject: [PATCH] Better Makefiles --- Makefile | 34 ++----------------------- testdata/Makefile | 38 +++++++++++++++++++++++----- testdata/out/compress-memcopy.go | 2 +- testdata/out/compress-nomemcopy.go | 2 +- testdata/out/nocompress-memcopy.go | 2 +- testdata/out/nocompress-nomemcopy.go | 2 +- 6 files changed, 38 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 769e9a4..84b661c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/testdata/Makefile b/testdata/Makefile index 2fcc757..c299a89 100644 --- a/testdata/Makefile +++ b/testdata/Makefile @@ -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 diff --git a/testdata/out/compress-memcopy.go b/testdata/out/compress-memcopy.go index 8e64124..52d66c2 100644 --- a/testdata/out/compress-memcopy.go +++ b/testdata/out/compress-memcopy.go @@ -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 } diff --git a/testdata/out/compress-nomemcopy.go b/testdata/out/compress-nomemcopy.go index a4ecb47..13d53a6 100644 --- a/testdata/out/compress-nomemcopy.go +++ b/testdata/out/compress-nomemcopy.go @@ -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 } diff --git a/testdata/out/nocompress-memcopy.go b/testdata/out/nocompress-memcopy.go index c97ec2d..65ac018 100644 --- a/testdata/out/nocompress-memcopy.go +++ b/testdata/out/nocompress-memcopy.go @@ -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 } diff --git a/testdata/out/nocompress-nomemcopy.go b/testdata/out/nocompress-nomemcopy.go index bf4c087..8a1ab73 100644 --- a/testdata/out/nocompress-nomemcopy.go +++ b/testdata/out/nocompress-nomemcopy.go @@ -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 }