av/cmd/audio-player/looper/Makefile

42 lines
848 B
Makefile

# Install rc.local file
USER := $(shell whoami)
PATH := /usr/local/go/bin:$(PATH)
.SILENT:copy_files
.SILENT:hard_copy_files
.SILENT:clean
install: as_root copy_files build
@echo "Install complete"
install_hard: as_root hard_copy_files build
@echo "Install complete"
as_root:
ifneq ($(USER),root)
$(error Must run as superuser!)
endif
copy_files:
if [ -f /etc/rc.local ] ; then \
echo "/etc/rc.local left unmodified" ; \
else \
cp rc.local /etc; \
fi
hard_copy_files:
if [ -f /etc/rc.local ] ; then \
echo "Backed up rc.local to /etc/rc.local.bak" ; \
cp /etc/rc.local /etc/rc.local.bak ; \
fi
cp -f rc.local /etc
build:
if grep -q 'Raspberry Pi 3' '/proc/device-tree/model'; then \
echo "Compiling for Raspberry pi 3";\
go build -tags pi3;\
else \
echo "Compiling for Raspberry pi 0";\
go build -tags pi0;\
fi