Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Makefile to be more friendly for distro packaging #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Author

@yarda yarda Jul 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow PREFIX, BINDIR, DESTDIR override.

BINDIR=$(DESTDIR)$(PREFIX)/bin

# uncomment the line below to include GPIO (For original piHPSDR Controller and Controller2 with i2c)
GPIO_INCLUDE=GPIO

Expand Down Expand Up @@ -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) \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support distro LDFLAGS.

$(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS)

Expand Down Expand Up @@ -436,7 +439,8 @@ clean:

.PHONY: install
install: $(PROGRAM)
cp $(PROGRAM) /usr/local/bin
mkdir -p $(BINDIR); \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make target dir, use variables, support parallel build.

cp -a $(PROGRAM) $(BINDIR)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preserve built timestamp (maybe better to use install command).


.PHONY: release
release: $(PROGRAM)
Expand Down Expand Up @@ -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:
Expand Down