all: axattach axl axsetcall beacon call listen mheard pms axassociate

CC = gcc
LD = gcc
CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer

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

install: all
#	install -m 755 -s -o bin -g bin axarp /usr/local/ax25/etc
#	install -m 755 -s -o bin -g bin axaddarp /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin axattach /usr/local/ax25/etc
#	install -m 755 -s -o bin -g bin axdelarp /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin axassociate /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin axl /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin axsetcall /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin beacon /usr/local/ax25/etc
	install -m 755 -s -o bin -g bin call /usr/local/ax25/bin
	install -m 4755 -s -o root -g bin listen /usr/local/ax25/bin
	install -m 755 -s -o bin -g bin mheard /usr/local/ax25/bin
	install -m 755 -s -o bin -g bin pms /usr/local/ax25/pms/bin

clean:
	rm -f *.o *~

distclean:
	rm -f *.o *~ axattach axl beacon call listen pms axsetcall mheard axassociate

#axarp: axarp.o convert.o
#	$(CC) axarp.o -o axarp

#axaddarp: axaddarp.o convert.o
#	$(CC) axaddarp.o convert.o -o axaddarp

axassociate: axassociate.o convert.o
	$(CC) axassociate.o convert.o -o axassociate

axattach: axattach.o convert.o
	$(CC) axattach.o convert.o -o axattach

#axdelarp: axdelarp.o convert.o
#	$(CC) axdelarp.o convert.o -o axdelarp

axl: axl.o convert.o config.o
	$(CC) axl.o convert.o config.o -o axl

axsetcall: axsetcall.o convert.o config.o
	$(CC) axsetcall.o convert.o config.o -o axsetcall

beacon: beacon.o convert.o config.o
	$(CC) beacon.o convert.o config.o -o beacon

call: call.o yapp.o convert.o dostime.o config.o
	$(CC) call.o yapp.o convert.o config.o dostime.o -o call

LISTEN_OBJS = listen.o kissdump.o ax25dump.o nrdump.o arpdump.o ipdump.o \
       icmpdump.o udpdump.o tcpdump.o

listen:	$(LISTEN_OBJS)
	$(LD) -o listen $(LISTEN_OBJS)

axattach.o: axattach.c
listen.o:   global.h listen.c
kissdump.o: global.h kissdump.c
ax25dump.o: global.h ax25dump.c
nrdump.o:   global.h nrdump.c
arpdump.o:  global.h arpdump.c
ipdump.o:   global.h ipdump.c
icmpdump.o: global.h icmpdump.c
udpdump.o:  global.h udpdump.c
tcpdump.o:  global.h tcpdump.c
dostime.o:  dostime.c

pms: pms.o
	$(CC) pms.o convert.o config.o -o pms

config.o: config.h
call.o: call.h config.h
yapp.o: call.h config.h
convert.o: config.h
axarp.o: config.h
axaddarp.o: config.h
axattach.o: config.h
axdelarp.o: config.h
beacon.o: config.h
listen.o: config.h
pms.o: config.h
axassociate.o: config.h
