Add "make install" target with INSTALL and prefix variables

pull/91/head
Patrick Tudor 2020-01-19 14:31:13 -08:00
parent 2095540d53
commit 5474693dfd
No known key found for this signature in database
GPG Key ID: 2C12D022F591B853
1 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,11 @@ CXXFLAGS:= -std=gnu++17 -Wall -O0 -MMD -MP -fno-omit-frame-pointer -Iext/CLI11 \
# CXXFLAGS += -Wno-delete-non-virtual-dtor
# If unset, create a variable for the path or binary to use as "install" for debuild.
INSTALL ?= install
# If unset, create a variable with the path used by "make install"
prefix ?= /usr/local/ubxtool
ifneq (,$(wildcard ubxsec.c))
EXTRADEP = ubxsec.o
else ifneq (,$(wildcard ubxsec.o))
@ -33,6 +38,19 @@ clean:
rm -f *~ *.o *.d ext/*/*.o $(PROGRAMS) navmon.pb.h navmon.pb.cc $(patsubst %.cc,%.o,$(wildcard ext/sgp4/libsgp4/*.cc)) $(H2OPP) $(SIMPLESOCKETS)
rm -f ext/fmt-5.2.1/src/format.o
install: $(PROGRAMS)
$(INSTALL) -s -m 755 -D navparse $(DESTDIR)$(prefix)/bin/navparse
$(INSTALL) -s -m 755 -D ubxtool $(DESTDIR)$(prefix)/bin/ubxtool
$(INSTALL) -s -m 755 -D navnexus $(DESTDIR)$(prefix)/bin/navnexus
$(INSTALL) -s -m 755 -D navcat $(DESTDIR)$(prefix)/bin/navcat
$(INSTALL) -s -m 755 -D navrecv $(DESTDIR)$(prefix)/bin/navrecv
$(INSTALL) -s -m 755 -D navdump $(DESTDIR)$(prefix)/bin/navdump
$(INSTALL) -s -m 755 -D navdisplay $(DESTDIR)$(prefix)/bin/navdisplay
$(INSTALL) -s -m 755 -D tlecatch $(DESTDIR)$(prefix)/bin/tlecatch
$(INSTALL) -s -m 755 -D reporter $(DESTDIR)$(prefix)/bin/reporter
$(INSTALL) -s -m 755 -D galmonmon $(DESTDIR)$(prefix)/bin/galmonmon
$(INSTALL) -s -m 755 -D testrunner $(DESTDIR)$(prefix)/bin/testrunner
decrypt: decrypt.o bits.o ext/fmt-5.2.1/src/format.o
$(CXX) -std=gnu++17 $^ -o $@