| 1 |
# |
| 2 |
# Makefile for the Linkstation AVR Event daemon running under Linux |
| 3 |
# |
| 4 |
# Copyright 2008 Bob Perry |
| •5 |
# Copyright 2008, 2009 Rogério Theodoro de Brito <[email protected]> |
| 6 |
TITLE=Linkstation AVR Event daemon |
| 7 |
|
| 8 |
# |
| 9 |
# User configurable variables |
| 10 |
# |
| 11 |
# Add -DUBOOT to the build process if you are using U-Boot as this will |
| 12 |
# remove the redundant EM-Mode NGNGNG poke into flash |
| 13 |
# |
| 14 |
CC = cc |
| •15 |
CFLAGS += -Wall -Wextra -Os |
| 16 |
CFLAGS += -DUBOOT |
| 17 |
|
| 18 |
###################################################################### |
| 19 |
# Almost no user should need to change the contents below |
| 20 |
###################################################################### |
| 21 |
# We have the option to build the daemon for PPC or MIPS |
| 22 |
|
| 23 |
ifeq (, $(PREFIX)) |
| 24 |
PREFIX := usr/local |
| 25 |
endif |
| 26 |
|
| 27 |
MACHINE = $(shell uname -m) |
| 28 |
ifeq (${MACHINE}, mips) |
| 29 |
CFLAGS += -DMIPS |
| 30 |
endif |
| 31 |
|
| 32 |
ifneq (, $(shell test -d /etc/melco)) |
| 33 |
CFLAGS += -DNO_MELCO |
| 34 |
endif |
| 35 |
|
| 36 |
|
| 37 |
# Main targets |
| 38 |
all: avr-evtd |
| 39 |
|
| 40 |
avr-evtd: avr-evtd.c |
| •41 |
$(CC) $(CPPFLAGS) $(CFLAGS) -o avr-evtd avr-evtd.c $(LDFLAGS) |
| 42 |
|
| 43 |
clean: |
| 44 |
rm -f avr-evtd |
| 45 |
rm -f /etc/init.d/avr-evtd |
| 46 |
rm -f /etc/default/avr-evtd.sample |
| 47 |
rm -f /etc/avr_evtd/EventScript |
| 48 |
rm -f /usr/local/sbin/avr-evtd |
| 49 |
rm -f /usr/local/man/man8/avr-evtd.8 |
| 50 |
|
| 51 |
install: avr-evtd |
| 52 |
# ENSURE DAEMON IS STOPPED |
| 53 |
if [ -e /etc/init.d/avr-evtd ]; then /etc/init.d/avr-evtd stop ; fi |
| 54 |
install -D -m 755 Install/avr-evtd.init $(DESTDIR)/etc/init.d/avr-evtd |
| 55 |
|
| 56 |
# ENSURE LOCAL DIRECTORY EXISTS AND UPDATE EXECUTABLE |
| 57 |
install -D -m 755 avr-evtd $(DESTDIR)/$(PREFIX)/sbin/avr-evtd |
| 58 |
|
| 59 |
# TRANSFER EVENT SCRIPT |
| 60 |
install -D -m 755 Install/EventScript $(DESTDIR)/etc/avr-evtd/EventScript |
| 61 |
install -D Install/emergency-eth0 $(DESTDIR)/etc/avr-evtd/emergency-eth0 |
| 62 |
install -D -m 644 Install/recovery.tar $(DESTDIR)/etc/avr-evtd/recovery.tar |
| 63 |
|
| 64 |
# ENSURE DEFAULT AVAILABLE |
| 65 |
if [ ! -e /etc/default/avr-evtd.config ]; then \ |
| 66 |
install -D Install/avr-evtd.config $(DESTDIR)/etc/default/avr-evtd.config ; else \ |
| 67 |
install -D Install/avr-evtd.config $(DESTDIR)/etc/default/avr-evtd.sample ; fi |
| 68 |
|
| 69 |
# ENSURE LOCAL MAN AVAILABLE |
| 70 |
install -D Install/avr-evtd.8 $(DESTDIR)/$(PREFIX)/share/man/man8/avr-evtd.8 |
| 71 |
|
| 72 |
start: |
| 73 |
/etc/init.d/avr-evtd start |