########################################################################
# File: Makefile
# 	(Extracted from
#	   "$Id: Makefile,v 1.4 2009/05/30 23:48:56 maoyam Exp maoyam $")
#
# Abstracts:
#  	This make file builds the test program of "load configuration
#  files" API-s.
#
# Copyright (C) 2005-2007 Maoyam Tokyo, Japan (mailto:maoyam@mail.goo.ne.jp)
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
########################################################################

## CC=g++ -ansi
CC=gcc -ansi

PROG=conf_file_loader
SRC=conf_file_loader-test.c conf_file_loader.c
CFLAGS=	-Wall -pedantic -Wshadow -Wredundant-decls -Werror
SPLINTOPTS=+posixlib -unrecog -exitarg -nullpass -nullret	\
			-nullderef -mustfreefresh -mustfreeonly			\
			-branchstate -aliasunique -temptrans -kepttrans	\
			-usereleased -usedef -dependenttrans			\
			-exportlocal -compdestroy

$(PROG): $(SRC)
	$(CC) -g $(CFLAGS) -o $(PROG) $(SRC)

splint:
	splint $(SPLINTOPTS) conf_file_loader-test.c
	splint $(SPLINTOPTS) conf_file_loader.c

valgrind:
	make clean;
	make;
	(date; uname -a; $(CC) --version; echo; valgrind -v --leak-check=full ./$(PROG) DELETEFI.INI) > valgrind.DELETEFI.INI.out`date +'%Y%m%d'`.txt 2>&1
	(date; uname -a; $(CC) --version; echo; valgrind -v --leak-check=full ./$(PROG) flavormap.properties ) > valgrind.flavormap.properties.out`date +'%Y%m%d'`.txt 2>&1

gprof:
	make clean;
	$(CC) -pg $(CFLAGS) -o $(PROG) $(SRC)
	./$(PROG) DELETEFI.INI -P > /dev/null 2>&1
	(date; uname -a; $(CC) --version; echo; gprof --version; gprof $(PROG) gmon.out) > gprof.DELETEFI.INI.out`date +'%Y%m%d'`.txt 2>&1;
	./$(PROG) flavormap.properties -P > /dev/null 2>&1
	(date; uname -a; $(CC) --version; echo; gprof --version; gprof $(PROG) gmon.out) > gprof.flavormap.properties.out`date +'%Y%m%d'`.txt 2>&1;
	rm gmon.out
	make clean;

utest:
	./$(PROG) DELETEFI.INI > $(PROG).DELETEFI.INI.out`date +'%Y%m%d'`.txt 2>&1
	./$(PROG) COMMENTONLY.INI > $(PROG).COMMENTONLY.INI.out`date +'%Y%m%d'`.txt 2>&1
	./$(PROG) flavormap.properties > $(PROG).flavormap.properties.out`date +'%Y%m%d'`.txt 2>&1
	./$(PROG) commentonly.properties > $(PROG).commentonly.properties.out`date +'%Y%m%d'`.txt 2>&1

clean:
	rm -f $(PROG) $(PROG).exe

rcs:
	ci							\
		COMMENTONLY.INI			\
		DELETEFI.INI			\
		GPL.txt					\
		Makefile				\
		commentonly.properties	\
		conf_file_loader-test.c	\
		conf_file_loader.c		\
		conf_file_loader.h		\
		flavormap.properties	\
		index.html
	co -l						\
		COMMENTONLY.INI			\
		DELETEFI.INI			\
		GPL.txt					\
		Makefile				\
		commentonly.properties	\
		conf_file_loader-test.c	\
		conf_file_loader.c		\
		conf_file_loader.h		\
		flavormap.properties	\
		index.html
	rlog						\
		COMMENTONLY.INI			\
		DELETEFI.INI			\
		GPL.txt					\
		Makefile				\
		commentonly.properties	\
		conf_file_loader-test.c	\
		conf_file_loader.c		\
		conf_file_loader.h		\
		flavormap.properties	\
		index.html				> CHANGELOGS.txt

