Update Makefile to use install instad of cp. The manpage, systemd .service file, and README will also be installed. This change will allow the building of .deb packages.

This commit is contained in:
Herminio Hernandez Jr 2016-07-03 19:12:15 -07:00
parent 5db89e467f
commit 8e68a2b87b

View file

@ -6,6 +6,9 @@ OUTPUT_PATH = bin/
SOURCE_PATH = src/
EXE = bin/mbpfan
CONF = mbpfan.conf
SYSD = mbpfan.service
DOC = README.md
MAN = mbpfan.8.gz
ifeq ($(COMPILER), G++)
ifeq ($(OS),Windows_NT)
@ -23,8 +26,8 @@ ifeq ($(COMPILER), G++)
LIBS = -lm
# LIBPATH = -L../gc/.libs
LIBPATH =
CPPFLAGS = $(COPT) -g $(INCLUDES)
LDFLAGS = $(LIBPATH) -g $(LIBS)
CPPFLAGS += $(COPT) -g $(INCLUDES) -Wall
LDFLAGS += $(LIBPATH) -g $(LIBS) -Wall
DEP = dep
else
OBJ = obj
@ -61,11 +64,22 @@ tests:
uninstall:
rm /usr/sbin/mbpfan
rm /etc/mbpfan.conf
rm /lib/systemd/system/mbpfan.service
rm /usr/share/man/man8/mbpfan.8.gz
rm -rf /usr/share/doc/mbpfan
install:
make
cp $(EXE) /usr/sbin
cp -n $(CONF) /etc
install -d $(DESTDIR)/usr/sbin
install -d $(DESTDIR)/etc
install -d $(DESTDIR)/lib/systemd/system
install -d $(DESTDIR)/usr/share/doc/mbpfan
install $(EXE) $(DESTDIR)/usr/sbin
install -m644 $(CONF) $(DESTDIR)/etc
install -m644 $(SYSD) $(DESTDIR)/lib/systemd/system
install -m644 $(DOC) $(DESTDIR)/usr/share/doc/mbpfan
install -d $(DESTDIR)/usr/share/man/man8
install -m644 $(MAN) $(DESTDIR)/usr/share/man/man8
@echo ""
@echo "******************"
@echo "INSTALL COMPLETED"