|
| 1 | +########################################################################## |
| 2 | +# Configurable options # |
| 3 | +########################################################################## |
| 4 | +# Install Base location |
| 5 | +PREFIX=/usr/local |
| 6 | +# Bin Dir |
| 7 | +BINDIR=$(PREFIX)/sbin |
| 8 | +# Set the name of predictable tty |
| 9 | +TTY_NAME := /dev/ttyMySensorsGateway |
| 10 | +# Set the group name for the raw tty |
| 11 | +TTY_GROUPNAME := tty |
| 12 | +########################################################################## |
| 13 | +# Please do not change anything below this line # |
| 14 | +########################################################################## |
1 | 15 | CC=g++
|
2 | 16 | # get PI Revision from cpuinfo
|
3 | 17 | PIREV := $(shell cat /proc/cpuinfo | grep Revision | cut -f 2 -d ":" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$$//')
|
4 |
| -CCFLAGS=-Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s |
| 18 | +CCFLAGS=-Wall -Ofast -mfpu=vfp -lpthread -g -D__Raspberry_Pi -mfloat-abi=hard -mtune=arm1176jzf-s -D_TTY_NAME=\"${TTY_NAME}\" -D_TTY_GROUPNAME=\"${TTY_GROUPNAME}\" |
5 | 19 |
|
6 | 20 | ifeq (${PIREV},$(filter ${PIREV},a01041 a21041))
|
7 | 21 | # a01041 and a21041 are PI 2 Model B and armv7
|
@@ -51,3 +65,42 @@ ${GATEWAY_SERIAL}: ${OBJS} ${GATEWAY_SERIAL_OBJS}
|
51 | 65 | clean:
|
52 | 66 | rm -rf $(PROGRAMS) $(GATEWAY) $(GATEWAY_SERIAL) ${OBJS} $(GATEWAY_OBJS) $(GATEWAY_SERIAL_OBJS)
|
53 | 67 |
|
| 68 | +install: all install-gatewayserial install-gateway install-initscripts |
| 69 | + |
| 70 | +install-gatewayserial: |
| 71 | + @echo "Installing ${GATEWAY_SERIAL} to ${BINDIR}" |
| 72 | + @install -m 0755 ${GATEWAY_SERIAL} ${BINDIR} |
| 73 | + |
| 74 | +install-gateway: |
| 75 | + @echo "Installing ${GATEWAY} to ${BINDIR}" |
| 76 | + @install -m 0755 ${GATEWAY} ${BINDIR} |
| 77 | + |
| 78 | +install-initscripts: |
| 79 | + @echo "Installing initscripts to /etc/init.d" |
| 80 | + @install -m 0755 initscripts/PiGatewaySerial /etc/init.d |
| 81 | + @install -m 0755 initscripts/PiGateway /etc/init.d |
| 82 | + @echo "Installing syslog config to /etc/rsyslog.d" |
| 83 | + @install -m 0755 initscripts/30-PiGatewaySerial.conf /etc/rsyslog.d |
| 84 | + @install -m 0755 initscripts/30-PiGateway.conf /etc/rsyslog.d |
| 85 | + @service rsyslog restart |
| 86 | + |
| 87 | +enable-gw: install |
| 88 | + @update-rc.d PiGateway defaults |
| 89 | + |
| 90 | +enable-gwserial: install |
| 91 | + @update-rc.d PiGatewaySerial defaults |
| 92 | + |
| 93 | +remove-gw: |
| 94 | + @update-rc.d -f PiGateway remove |
| 95 | + |
| 96 | +remove-gwserial: |
| 97 | + @update-rc.d -f PiGatewaySerial remove |
| 98 | + |
| 99 | +uninstall: remove-gw remove-gwserial |
| 100 | + @echo "Stopping daemon PiGatewaySerial (ignore errors)" |
| 101 | + -@service PiGatewaySerial stop |
| 102 | + @echo "Stopping daemon PiGateway (ignore errors)" |
| 103 | + -@service PiGateway stop |
| 104 | + @echo "removing files" |
| 105 | + rm ${BINDIR}/PiGatewaySerial ${BINDIR}/PiGateway /etc/init.d/PiGatewaySerial /etc/init.d/PiGateway /etc/rsyslog.d/30-PiGatewaySerial.conf /etc/rsyslog.d/30-PiGateway.conf |
| 106 | + |
0 commit comments