From c733ec166745288d5f7f49b72d37cf4e58bf08aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Sun, 11 Jul 2021 15:09:24 +0200 Subject: [PATCH] Updated Makefile to be more friendly for distro packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jaroslav Škarvada --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fe69b75b..eb5fde0a 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ GIT_DATE := $(firstword $(shell git --no-pager show --date=short --format="%ai" --name-only)) GIT_VERSION := $(shell git describe --abbrev=0 --tags) +PREFIX=/usr/local +BINDIR=$(DESTDIR)$(PREFIX)/bin + # uncomment the line below to include GPIO (For original piHPSDR Controller and Controller2 with i2c) GPIO_INCLUDE=GPIO @@ -397,7 +400,7 @@ protocols.o $(PROGRAM): $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \ $(LOCALCW_OBJS) $(GPIO_OBJS) $(PURESIGNAL_OBJS) \ $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) - $(LINK) -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(GPIO_OBJS) \ + $(LINK) -o $(PROGRAM) $(LDFLAGS) $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(GPIO_OBJS) \ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \ $(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS) @@ -436,7 +439,8 @@ clean: .PHONY: install install: $(PROGRAM) - cp $(PROGRAM) /usr/local/bin + mkdir -p $(BINDIR); \ + cp -a $(PROGRAM) $(BINDIR) .PHONY: release release: $(PROGRAM) @@ -475,13 +479,13 @@ controller2v2: clean $(PROGRAM) ############################################################################# hpsdrsim.o: hpsdrsim.c hpsdrsim.h - $(CC) -c -O -DALSASOUND hpsdrsim.c + $(CC) $(CFLAGS) -c -O -DALSASOUND hpsdrsim.c newhpsdrsim.o: newhpsdrsim.c hpsdrsim.h - $(CC) -c -O newhpsdrsim.c + $(CC) $(CFLAGS) -c -O newhpsdrsim.c hpsdrsim: hpsdrsim.o newhpsdrsim.o - $(LINK) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lasound -lm -lpthread + $(LINK) $(LDFLAGS) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lasound -lm -lpthread debian: