all: netromd nodesave nrattach nrctl nrparms

CC = gcc
LD = gcc
CFLAGS = -Wall -Wstrict-prototypes -O2 -I../lib
LDFLAGS = -L../lib
LIBS = -lax25

.c.o:
	$(CC) $(CFLAGS) -c $<

install: installbin installman

installbin: all
	install -m 755 -s -o bin -g bin netromd   	/usr/sbin
	install -m 755 -s -o bin -g bin nodesave  	/usr/sbin
	install -m 755 -s -o bin -g bin nrattach  	/usr/sbin
	install -m 755 -s -o bin -g bin nrctl     	/usr/sbin
	install -m 755 -s -o bin -g bin nrparms   	/usr/sbin

installconf:
	install -m 755 -o root -g root -d		  /etc/ax25
	install -m 644 -o root -g root ../etc/nrbroadcast /etc/ax25
	install -m 644 -o root -g root ../etc/nrports     /etc/ax25

installman:
	install -m 644 -o bin -g bin netrom.4		/usr/man/man4
	install -m 644 -o bin -g bin nrports.5		/usr/man/man5
	install -m 644 -o bin -g bin nrbroadcast.5	/usr/man/man5
	install -m 644 -o bin -g bin netromd.8		/usr/man/man8
	install -m 644 -o bin -g bin nodesave.8		/usr/man/man8
	install -m 644 -o bin -g bin nrattach.8		/usr/man/man8
	install -m 644 -o bin -g bin nrctl.8		/usr/man/man8
	install -m 644 -o bin -g bin nrparms.8		/usr/man/man8

clean:
	rm -f *.o *~ *.bak *.orig

distclean: clean
	rm -f netromd nodesave nrattach nrattach nrctl nrparms

netromd: netromd.o netromr.o netromt.o
	$(LD) $(LDFLAGS) -o netromd netromd.o netromt.o netromr.o $(LIBS)

nodesave: nodesave.o
	$(LD) $(LDFLAGS) -o nodesave nodesave.o $(LIBS)

nrattach: nrattach.o
	$(LD) $(LDFLAGS) -o nrattach nrattach.o $(LIBS)

nrctl: nrctl.o
	$(LD) $(LDFLAGS) -o nrctl nrctl.o $(LIBS)

nrparms: nrparms.o
	$(LD) $(LDFLAGS) -o nrparms nrparms.o $(LIBS)

netromr.o:	netromd.h netromr.c
netromt.o:	netromd.h netromt.c
netromd.o:	netromd.h netromd.c
nodesave.o:	nodesave.c
nrattach.o:	nrattach.c
nrctl.o:	nrctl.c
nrparms.o:	nrparms.c
