# This Makefile produces the files spp_anomsensor.c and spp_anomsensor.h from
# the multiple Spade source files.  To make changes, edit the source files in
# this directory and run make.  This will install spp_anomsensor.c and
# spp_anomsensor.h in the directory set for INSTALL_DIR.  To skip the
# install, run "make spp_anomsensor".

INSTALL_DIR=..

spade: sensor install

sensor: spp_anomsensor.c spp_anomsensor.h

spp_anomsensor.c: anomsensor_plug.c tree.c anommem.c store.c
	echo "/* DO NOT EDIT THIS FILE. EDIT THE ORIGINAL SOURCE FILES INSTEAD AND RUN make */" > spp_anomsensor.c
	cat anomsensor_plug.c >> spp_anomsensor.c
	grep -v -h '#include "' tree.c anommem.c store.c >> spp_anomsensor.c

spp_anomsensor.h: anomsensor_plug.h anomsensor.h params.h anommem.h tree.h store.h
	echo "/* DO NOT EDIT THIS FILE. EDIT THE ORIGINAL SOURCE FILES INSTEAD AND RUN make */" > spp_anomsensor.h
	echo "#ifndef _SPP_ANOMSENSOR_H" >> spp_anomsensor.h
	echo "#define _SPP_ANOMSENSOR_H" >> spp_anomsensor.h
	grep -v -h '#include "' anomsensor.h >> spp_anomsensor.h
	cat anomsensor_plug.h >> spp_anomsensor.h
	grep -v -h '#include "' params.h anommem.h tree.h store.h >> spp_anomsensor.h
	echo "#endif /*_SPP_ANOMSENSOR_H*/" >> spp_anomsensor.h

install:
	mv spp_anomsensor.[ch] $(INSTALL_DIR)
