#makefile for APRS Server 2.1.4
all: aprsd aprspass
CC = g++
CPU = -m386
#GDB = -ggdb
#EFENCE = -lefence
DEPENDS = utils.o history.o serialp.o cpqueue.o aprsString.o mic_e.o validate.o queryResp.o dupCheck.o	crc32.o
DEPENDS_H = constant.h aprsString.h  dupCheck.h
#
#
aprspass: aprspass.o validate.o validate.h
	$(CC) $(CPU) $(GDB)  -o aprspass aprspass.cpp validate.o /usr/lib/libcrypt.so
#
aprsd: aprsd.o  $(DEPENDS) $(DEPENDS_H)
	$(CC) $(CPU) $(GDB)  -o  aprsd aprsd.cpp -D_REENTRANT  $(DEPENDS) -lpthread /usr/lib/libcrypt.so	 $(EFENCE)
	
	
aprsd.o: aprsd.cpp $(DEPENDS)  $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)   -c aprsd.cpp
cpqueue.o: utils.o cpqueue.cpp cpqueue.h $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c cpqueue.cpp
serialp.o: serialp.cpp serialp.h    $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c serialp.cpp
history.o: utils.o history.cpp history.h $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c history.cpp
utils.o: utils.h	utils.cpp utils.h $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c utils.cpp
aprsString.o: aprsString.cpp   $(DEPENDS_H) crc.h
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c aprsString.cpp
mic_e.o: mic_e.cpp mic_e.h
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c mic_e.cpp
validate.o: validate.cpp validate.h
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c validate.cpp
	
dupCheck.o: dupCheck.cpp dupCheck.h $(DEPENDS_H)
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c dupCheck.cpp
	
queryResp.o: queryResp.cpp queryResp.h constant.h
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c queryResp.cpp
	
crc32.o: crc32.c crc.h
	$(CC) -Wall $(CPU) -D_REENTRANT $(GDB)  -c crc32.c
	

aprspass.o: aprspass.cpp
	$(CC) $(CPU) $(GDB)  -c aprspass.cpp
	
	
clean:
	rm *.o
	rm aprsd
	rm aprspass
       	
