CC = gcc
CFLAGS = -O2 -Wall -fpack-struct -I/usr/include -I./include -march=amdfam10 -mtune=amdfam10

# uncomment the following line if compiling on a 64 bit machine
BIT64 = -Dbit64

INSTALLSITEMAN1DIR = ${mandir}/man1
DISTMAN1DIR = docs/man
bindir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
exec_prefix = ${prefix}
mandir = ${datarootdir}/man
prefix = /usr/local

TARGET = aurora

.PHONY: install

all:	$(TARGET)

$(TARGET): main.o comm.o
	$(CC) main.o comm.o -o $(TARGET)

main.o: main.c include/main.h include/comm.h include/names.h include/states.h
	$(CC) $(CFLAGS) ${BIT64} -c main.c

comm.o: comm.c include/main.h include/comm.h include/names.h include/states.h
	$(CC) $(CFLAGS) ${BIT64} -c comm.c

clean:
	rm -f $(TARGET) *.o

install: aurora
	install -m 0700 $(TARGET) $(bindir)
	install -m 0644 ${DISTMAN1DIR}/$(TARGET).1 ${INSTALLSITEMAN1DIR}

uninstall:
	rm -f $(bindir)/$(TARGET) ${INSTALLSITEMAN1DIR}/$(TARGET).1
	

