Commit 4324ea79 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* include/generate_headers.sh: Remove stray context files.

parent 3cdd79bb
2009-09-16 Alexandre Duret-Lutz <adl@lrde.epita.fr>
* include/generate_headers.sh: Remove stray context files.
2009-09-15 Alexandre Duret-Lutz <adl@lrde.epita.fr>
 
More make portability for FreeBSD.
......
......@@ -2,7 +2,7 @@
# generate_headers.sh: this file is part of the Vaucanson project.
#
# Vaucanson, a generic library for finite state machines.
# Copyright (C) 2007, 2008 The Vaucanson Group.
# Copyright (C) 2007, 2008, 2009 The Vaucanson Group.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
......@@ -16,8 +16,7 @@
#
MK_FILE=generic_contexts.mk
FIND="find"
IMPL_SET=`$FIND vaucanson/automata/implementation -name '*_graph_impl.hh' -exec basename {} \; 2>/dev/null | sed -e 's/_graph_impl.hh//g' | sort`
IMPL_SET=`find vaucanson/automata/implementation -name '*_graph_impl.hh' -exec basename {} \; 2>/dev/null | sed -e 's/_graph_impl.hh//g' | sort`
write_namespace_alias()
{
......@@ -25,7 +24,7 @@ write_namespace_alias()
if $3; then
conditional_alias=" && defined(VCSN_ALIAS_NAMESPACE)"
fi
cat >> $1 <<-EOF
# if !defined(ALIAS_$2)$conditional_alias
# define ALIAS_$2
......@@ -69,7 +68,7 @@ write_default_context()
UpperName=`echo $fullname| sed -e 's/[\.\/]/\_/g' | tr "[:lower:]" "[:upper:]"`
context=`echo $1 | cut -d '.' -f 1 | sed -e 's/_structures//g'`
cat > $fullname <<-EOF
cat > $fullname <<-EOF
#ifndef $UpperName
# define $UpperName
......@@ -95,7 +94,7 @@ EOF
write_context()
{
UpperName=`echo $1| sed -e 's/[\.\/]/\_/g' | tr "[:lower:]" "[:upper:]"`
cat > $1 <<-EOF
cat > $1 <<-EOF
#ifndef $UpperName
# define $UpperName
# ifndef VCSN_GRAPH_IMPL
......@@ -110,7 +109,7 @@ write_context()
# define VCSN_DEFAULT_GRAPH_IMPL $2
# define VCSN_ALIAS_NAMESPACE
# endif
# include <vaucanson/misc/usual_macros.hh>
# include <vaucanson/automata/generic_contexts/$3>
EOF
......@@ -118,7 +117,7 @@ EOF
write_namespace_alias $1 $context true
insert_specific_alias $1 $context true
cat >> $1 <<-EOF
cat >> $1 <<-EOF
# ifndef DONT_UNDEF
# undef VCSN_GRAPH_IMPL
......@@ -166,7 +165,7 @@ main()
mkdir -p vaucanson/contexts/$impl
done
for header in `$FIND vaucanson/automata/generic_contexts/ -name '*.hh' -exec basename {} \; 2>/dev/null | sort`; do
for header in `find vaucanson/automata/generic_contexts/ -name '*.hh' -exec basename {} \; 2>/dev/null | sort`; do
printf "\\\\\n" >> $MK_FILE
write_default_context $header
for impl in $IMPL_SET; do
......@@ -177,6 +176,21 @@ main()
printf "\\n" >> $MK_FILE
printf "nobase_include_HEADERS += \$(GENERIC_CONTEXTS)\n" >> $MK_FILE
printf "MAINTAINERCLEANFILES = \$(GENERIC_CONTEXTS)\n" >> $MK_FILE
# Sometimes we creates some context on a Git branch, and when
# switching to another branch without this context we are left with
# some generated files that should not be there. These cause some
# problems because other parts of Vaucanson
# (e.g. src/tests/sanity/generate_files.sh) will glob for files to
# generate code. Let's remove these files. (This fix is only a
# hack; the real fix is to stop globbing. Globbing is evil.)
for header in `find vaucanson/contexts -type f -name '*.hh'`; do
base=${header##*/}
if ! test -f "vaucanson/automata/generic_contexts/$base"; then
echo deleting $base
rm -f $base
fi
done
}
main
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment