github.com/NeowayLabs/nash@v0.2.2-0.20200127205349-a227041ffd50/Makefile (about)

     1  ifndef version
     2  version=$(shell git rev-list -1 HEAD)
     3  endif
     4  
     5  buildargs = -ldflags "-X main.VersionString=$(version)" -v
     6  
     7  all: build test install
     8  
     9  build:
    10  	cd cmd/nash && go build $(buildargs) 
    11  	cd cmd/nashfmt && go build $(buildargs) 
    12  	cd stdbin/mkdir && go build $(buildargs)
    13  	cd stdbin/pwd && go build $(buildargs)
    14  	cd stdbin/write && go build $(buildargs)
    15  	cd stdbin/strings && go build $(buildargs)
    16  
    17  NASHPATH?=$(HOME)/nash
    18  NASHROOT?=$(HOME)/nashroot
    19  
    20  # FIXME: binaries install do not work on windows this way (the .exe)
    21  install: build
    22  	@echo
    23  	@echo "Installing nash at: "$(NASHROOT)
    24  	mkdir -p $(NASHROOT)/bin
    25  	rm -f $(NASHROOT)/bin/nash
    26  	rm -f $(NASHROOT)/bin/nashfmt
    27  	cp -p ./cmd/nash/nash $(NASHROOT)/bin
    28  	cp -p ./cmd/nashfmt/nashfmt $(NASHROOT)/bin
    29  	rm -rf $(NASHROOT)/stdlib
    30  	cp -pr ./stdlib $(NASHROOT)/stdlib
    31  	cp -pr ./stdbin/mkdir/mkdir $(NASHROOT)/bin/mkdir
    32  	cp -pr ./stdbin/pwd/pwd $(NASHROOT)/bin/pwd
    33  	cp -pr ./stdbin/write/write $(NASHROOT)/bin/write
    34  	cp -pr ./stdbin/strings/strings $(NASHROOT)/bin/strings
    35  
    36  docsdeps:
    37  	go get github.com/madlambda/mdtoc/cmd/mdtoc
    38  
    39  docs: docsdeps
    40  	mdtoc -w ./README.md
    41  	mdtoc -w ./docs/interactive.md
    42  	mdtoc -w ./docs/reference.md
    43  	mdtoc -w ./docs/stdlib/fmt.md
    44  
    45  test: build
    46  	./hack/check.sh
    47  
    48  update-vendor:
    49  	cd cmd/nash && nash ./vendor.sh
    50  
    51  release: clean
    52  	./hack/releaser.sh $(version)
    53  
    54  coverage-html: test
    55  	go tool cover -html=coverage.txt -o coverage.html
    56  	@echo "coverage file: coverage.html"
    57  
    58  coverage-show: coverage-html
    59  	xdg-open coverage.html
    60  
    61  clean:
    62  	rm -f cmd/nash/nash
    63  	rm -f cmd/nashfmt/nashfmt
    64  	rm -rf dist