prefix=/usr/local
bindir=${prefix}/bin
mandir=${prefix}/man

CC = gcc
LIBS = -lm -lncurses
CFLAGS = -O2 -Wall -g

OBJECTS = conf.o llist.o ui.o error.o timer.o info_scr.o lhist_scr.o aplst_scr.o conf_scr.o help_scr.o about_scr.o iw_if.o net_if.o

all: wavemon

wavemon: wavemon.o $(OBJECTS)
	$(CC) $(CFLAGS) $(LIBS) -o wavemon wavemon.o $(OBJECTS)

wavemon.o: wavemon.c defs.h $(OBJECTS)

conf.o: conf.c conf.h defs.h

llist.o :llist.c llist.h defs.h

ui.o: ui.c ui.h defs.h

error.o: error.c error.h defs.h

timer.o: timer.c timer.h defs.h

info_scr.o: info_scr.c info_scr.h defs.h

lhist_scr.o: lhist_scr.c lhist_scr.h defs.h

aplst_scr.o: aplst_scr.c aplst_scr.h defs.h

conf_scr.o: conf_scr.c conf_scr.h defs.h

help_scr.o: help_scr.c help_scr.h defs.h

about_scr.o: about_scr.c about_scr.h defs.h

iw_if.o: iw_if.c iw_if.h defs.h

net_if.o: net_if.c net_if.h defs.h

install: wavemon wavemon.1 wavemonrc.5
	cp wavemon $(bindir)
	cp wavemon.1 $(mandir)/man1
	cp wavemonrc.5 $(mandir)/man5
	
uninstall:
	rm -f $(bindir)/wavemon
	rm -f $(mandir)/man1/wavemon.1
	rm -f $(mandir)/man5/wavemonrc.5

clean:
	rm -f *.o wavemon
