From c65b41dbd899bc7c6955138eca321780b95fc6cf Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 7 Jul 2022 13:53:07 -0500 Subject: Add make link target --- Makefile | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bea747e..b1fc5d9 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,12 @@ DESTDIR = PREFIX = /usr/local +BIN = $(DESTDIR)$(PREFIX)/bin +RADIO_SHARE = $(DESTDIR)$(PREFIX)/share/radio + +RADIO_BIN = $(BIN)/radio +RADIO_STATIONS = $(RADIO_SHARE)/stations + .PHONY: help help: @echo "radio : Play online radio" @@ -12,14 +18,24 @@ help: @echo "TARGETS:" @echo " install Install radio to $(DESTDIR)$(PREFIX)/bin/radio." @echo " An example configuration is at $(DESTDIR)$(PREFIX)/share/radio/stations." + @echo " link Install radio using symlinks." + @echo " Probably only useful for development." @echo " uninstall Uninstall radio-related files." +$(BIN) $(RADIO_SHARE): + mkdir -p $@ + .PHONY: install -install: radio radio.stations - install -D radio $(DESTDIR)$(PREFIX)/bin/radio - install -D radio.stations $(DESTDIR)$(PREFIX)/share/radio/stations +install: radio radio.stations $(BIN) $(RADIO_SHARE) + install -D radio $(RADIO_BIN) + install -D radio.stations $(RADIO_STATIONS) + +.PHONY: link +link: $(BIN) $(RADIO_SHARE) + ln -sf $(PWD)/radio $(RADIO_BIN) + ln -sf $(PWD)/radio.stations $(RADIO_STATIONS) .PHONY: uninstall uninstall: - rm $(DESTDIR)$(PREFIX)/bin/radio - rm -r $(DESTDIR)$(PREFIX)/share/radio/ + rm $(RADIO_BIN) + rm -r $(RADIO_SHARE) -- cgit 1.4.1-21-gabe81