ifneq ($(wildcard ~/bin/.),) INSTALL_TARGET_DIR = ~/bin else INSTALL_TARGET_DIR = /usr/local/bin endif OUTPUTS = timerserver timerstart timerwp timerwaypoint timerstatus timerstop .PHONY: all clean install all: clean $(OUTPUTS) clean: rm -f $(OUTPUTS) install: all @echo Installing to $(INSTALL_TARGET_DIR)... @for f in $(OUTPUTS); do \ cmd="cp $$f $(INSTALL_TARGET_DIR)/$$f"; \ echo $$cmd; \ eval $$cmd; \ done timerserver: timerserver.cpp g++ -std=c++11 -Wall -O2 -o $@ $^ timerstart: timerserver ln -sf timerserver timerstart timerwp: timerserver ln -sf timerserver timerwp timerwaypoint: timerserver ln -sf timerserver timerwaypoint timerstatus: timerserver ln -sf timerserver timerstatus timerstop: timerserver ln -sf timerserver timerstop