1# Copyright 2018 Datawire. All rights reserved. 2# 3# Makefile snippet for managing pid file cleanup. 4# 5## Eager inputs ## 6# (none) 7## Lazy inputs ## 8# (none) 9## Outputs ## 10# - .PHONY Target: %.pid.clean 11## common.mk targets ## 12# (none) 13ifeq ($(words $(filter $(abspath $(lastword $(MAKEFILE_LIST))),$(abspath $(MAKEFILE_LIST)))),1) 14 15%.pid.clean: 16 if [ -e $*.pid ]; then kill $$(cat $*.pid) || true; fi 17 rm -f $*.pid 18.PHONY: %.pid.clean 19 20endif