all: sakura_bind_test sakura_capability_test sakura_filesystem_test sakura_trace_test tomoyo_capability_test tomoyo_file_test tomoyo_info_test tomoyo_name_test tomoyo_port_test tomoyo_signal_test newns pipegrep
	@echo "You have compiled all programs for testing TOMOYO Linux's kernel."
	@echo "Don't forget to register the pathname of these programs to /root/security/manager.txt"
	@echo "because these program needs to write to /proc/ccs/ interface."

#
# If you want to suppress "warning: pointer targets in passing argument ... differ in signedness" warning messages,
# you can add "-Wno-pointer-sign" options to CFLAGS.
#
#CFLAGS=-Wall -Wno-pointer-sign -O3
#
CFLAGS=-Wall -O3

#
# Tools for kernel testing.
#

sakura_bind_test: sakura_bind_test.c include.h
	gcc $(CFLAGS) -o sakura_bind_test sakura_bind_test.c
	chmod 700 sakura_bind_test 

sakura_capability_test: sakura_capability_test.c include.h
	gcc $(CFLAGS) -o sakura_capability_test sakura_capability_test.c
	chmod 700 sakura_capability_test

sakura_filesystem_test: sakura_filesystem_test.c include.h
	gcc $(CFLAGS) -o sakura_filesystem_test sakura_filesystem_test.c
	chmod 700 sakura_filesystem_test

sakura_trace_test: sakura_trace_test.c include.h
	gcc $(CFLAGS) -o sakura_trace_test sakura_trace_test.c
	chmod 700 sakura_trace_test

tomoyo_capability_test: tomoyo_capability_test.c include.h
	gcc $(CFLAGS) -o tomoyo_capability_test tomoyo_capability_test.c -lutil
	chmod 700 tomoyo_capability_test

tomoyo_file_test: tomoyo_file_test.c include.h
	gcc $(CFLAGS) -o tomoyo_file_test tomoyo_file_test.c
	chmod 700 tomoyo_file_test

tomoyo_info_test: tomoyo_info_test.c include.h
	gcc $(CFLAGS) -o tomoyo_info_test tomoyo_info_test.c
	chmod 700 tomoyo_info_test

tomoyo_name_test: tomoyo_name_test.c include.h
	gcc $(CFLAGS) -o tomoyo_name_test tomoyo_name_test.c
	chmod 700 tomoyo_name_test

tomoyo_port_test: tomoyo_port_test.c include.h
	gcc $(CFLAGS) -o tomoyo_port_test tomoyo_port_test.c
	chmod 700 tomoyo_port_test

tomoyo_signal_test: tomoyo_signal_test.c include.h
	gcc $(CFLAGS) -o tomoyo_signal_test tomoyo_signal_test.c
	chmod 700 tomoyo_signal_test

newns: newns.c
	gcc $(CFLAGS) -o newns newns.c

pipegrep: pipegrep.c
	gcc $(CFLAGS) -o pipegrep pipegrep.c

#
# Delete all tools in this package.
#

clean:
	rm -f sakura_bind_test sakura_capability_test sakura_filesystem_test sakura_trace_test
	rm -f tomoyo_capability_test tomoyo_file_test tomoyo_info_test tomoyo_name_test tomoyo_port_test tomoyo_signal_test
	rm -f newns pipegrep
