CC		= gcc
CFLAGS          = -g -W -Wall -O2
OPTFLAGS        = -D_FILE_OFFSET_BITS=64 -D_MAJ=2 -D_MIN=41

prefix          = /usr/local
bindir          = $(prefix)/bin
datadir         = $(prefix)/share
docdir          = $(datadir)/aircrack

DESTDIR         = 
BINFILES        = aircrack airdecap arpforge aireplay airodump airmon.sh mergeivs pcap2ivs
DOCFILES        = ChangeLog README.html README.txt

all: aircrack airdecap arpforge aireplay airodump mergeivs pcap2ivs

aircrack: linux/aircrack.c linux/crypto.c linux/sha1-mmx.S
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/aircrack.c linux/crypto.c linux/sha1-mmx.S -o aircrack -lpthread

airdecap: linux/airdecap.c linux/crypto.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/airdecap.c linux/crypto.c -o airdecap

arpforge: linux/arpforge.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/arpforge.c -o arpforge

aireplay: linux/aireplay.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/aireplay.c -o aireplay

airodump: linux/airodump.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/airodump.c -o airodump

mergeivs: linux/mergeivs.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/mergeivs.c -o mergeivs

pcap2ivs: linux/pcap2ivs.c
	$(CC) $(CFLAGS) $(OPTFLAGS) linux/pcap2ivs.c -o pcap2ivs

install:
	install -d $(DESTDIR)$(bindir)
	install -m 755 $(BINFILES) $(DESTDIR)$(bindir)

doc:
	install -d $(DESTDIR)$(docdir)
	install -m 644 $(DOCFILES) $(DESTDIR)$(docdir)

clean:
	rm -f aircrack airdecap arpforge aireplay airodump mergeivs pcap2ivs
