# This is an extrememly rudimentary Makefile
# Since the code is in perl this file only copies files to
# suggested locations

BIN=/usr/bin
MAN=/usr/man/man1
DOC=/usr/share/doc/examiner
SHARE=/usr/share/examiner

all:
	@echo "This script merely simplifies the install"
	@echo "Usage: make install - Copies files"
	@echo "       make hashes  - (Re)Generates examiner_hashes.pl"

install:
	cp examiner $(BIN)/examiner
	@pod2man man/examiner.pod > man/examiner.1
	cp man/examiner.1 $(MAN)
	-mkdir -p $(SHARE)/os
	-cp -rf os/* $(SHARE)/os
	-mkdir -p $(DOC)
	-cp -f docs/* $(DOC)
	-mkdir $(DOC)/utils
	-cp -f utils/* $(DOC)/utils

hashes:
	@echo '$$loaded_library=1;' > examiner_hashes.pl
	@echo Generating examiner_hashes.pl...
	# Linux syscalls
	@utils/convert-headers.pl -f /usr/src/linux/include/asm-i386/unistd.h -n syscalls -m __NR_ >> examiner_hashes.pl
	# BSD syscalls
	@utils//convert-headers.pl -f /usr/include/sys/syscall.h -n syscalls -m SYS_ >> examiner_hashes.pl
	@utils/convert-headers.pl -f /usr/include/linux/net.h -n socketcall -m SYS_ >> examiner_hashes.pl
	@echo "return 1;" >> examiner_hashes.pl
	@echo done.

uninstall:
	rm -f $(BIN)/examiner
	rm -f $(MAN)/examiner.1
	rm -rf $(DOC) $(SHARE)

clean:
	rm -f *.bak man/examiner.1 examiner_hashes.pl

