Makes makefile structure more modular and fixes clean to not remove installed binary
This commit is contained in:
parent
32e769c9da
commit
33bca45b98
33
Makefile
33
Makefile
|
@ -17,34 +17,31 @@ endif
|
|||
|
||||
LDFLAGS := -ldflags "-s -X main.version=${VERSION} -X main.build=${BUILD_TIME}"
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo ${LDFLAGS}
|
||||
@echo ${VERSION}
|
||||
@echo ${BUILD_PATH}
|
||||
.PHONY: install
|
||||
install: build install-bin install-man clean
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
@go build ${LDFLAGS} -o ${BINARY}
|
||||
|
||||
.PHONY: install
|
||||
install: install-man
|
||||
@go build ${LDFLAGS} -o ${BUILD_PATH}/${BINARY}
|
||||
go build ${LDFLAGS} -o ${BINARY}
|
||||
|
||||
.PHONY: install-man
|
||||
install-man: bombadillo.1
|
||||
@gzip -k ./bombadillo.1
|
||||
@install -d ${man1dir}
|
||||
@install -m 0644 ./bombadillo.1.gz ${man1dir}
|
||||
gzip -k ./bombadillo.1
|
||||
install -d ${man1dir}
|
||||
install -m 0644 ./bombadillo.1.gz ${man1dir}
|
||||
|
||||
.PHONY: install-bin
|
||||
install-bin:
|
||||
install -d ${BUILD_PATH}
|
||||
install ./${BINARY} ${BUILD_PATH}/${BINARY}
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@go clean -i
|
||||
@rm -f ./bombadillo.1.gz 2> /dev/null
|
||||
go clean
|
||||
rm -f ./bombadillo.1.gz 2> /dev/null
|
||||
|
||||
.PHONY: uninstall
|
||||
uninstall: clean
|
||||
@rm -f ${man1dir}/bombadillo.1.gz
|
||||
@echo Removing ${BINARY}
|
||||
@rm -f ${BUILD_PATH}/${BINARY}
|
||||
rm -f ${man1dir}/bombadillo.1.gz
|
||||
rm -f ${BUILD_PATH}/${BINARY}
|
||||
|
||||
|
|
Loading…
Reference in New Issue