File: populatemkfiles.sh

package info (click to toggle)
geda-doc 1%3A1.4.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 5,344 kB
  • ctags: 1,363
  • sloc: sh: 742; makefile: 145
file content (97 lines) | stat: -rwxr-xr-x 1,972 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh

# Issues:
#
# * dot files (like .gitignore) aren't handled correctly.
#

# $1 is the name of the directory
do_work()
{
	if [ "$2" = "." ]
	then
		thisdir=
	else
		if [ "$2" != "" ]
		then
			thisdir=/$1/$2
		else
			thisdir=/$1
		fi
	fi

	thisdir=`echo $thisdir | sed "s%//%/%g"`

	mv -f Makefile.am Makefile.am.old >& /dev/null
	echo "" > Makefile.am

	echo "" >> Makefile.am
	echo "docname=wiki" >> Makefile.am
	echo 'docsdir = @GEDADOCDIR@/$(docname)'$thisdir >> Makefile.am
	echo "" >> Makefile.am

	dirs=`find . -maxdepth 1 -type d -print | grep -v CVS | sed "s%^./%%" | sed "s%^\.%%"`

	if [ "$dirs" != "" ]
	then
		echo -n "SUBDIRS = " >> Makefile.am
		for i in $dirs
		do
			echo -n "$i " >> Makefile.am
		done
		echo "" >> Makefile.am
		echo "" >> Makefile.am
	fi

	files=`find . -maxdepth 1 -type f -print | grep -v Makefile | grep -v CVS | grep -v .cvsignore  | sed "s%^./%%" | sed "s%^\.%%"`
	files=`echo $files`
	echo files: _${files}_

	if [ "$files" != "" ]
	then
		echo -n "docs_DATA = " >> Makefile.am
		for i in $files
		do
			if [ ! -d $i ]
			then
				echo -n "$i " >> Makefile.am
			fi
		done
		echo "" >> Makefile.am
		echo "" >> Makefile.am

		echo 'EXTRA_DIST = $(docs_DATA)' >> Makefile.am

		echo "" >> Makefile.am
		echo 'MAINTAINERCLEANFILES = *.log core FILE *~ Makefile.in' >> Makefile.am
	
	fi
	echo "" >> Makefile.am

	# Remove any references to (.)gitignore files (should not be
	# distributed)
	mv Makefile.am Makefile.am.before
	cat Makefile.am.before | sed "s/.gitignore//" > Makefile.am
	rm -f Makefile.am.before
}

pwd=`pwd`
thisprogram=/home/ahvezda/gaf/docs/scripts/populatemkfiles.sh
basedir=/home/ahvezda/gaf/docs/wip

subdir=`echo $pwd | awk -F$basedir '{print $2}'`

do_work $1 $2

subdirs=`find . -maxdepth 1 -type d -print | grep -v CVS | sed "s%^./%%" | sed "s%^\.%%"`
subdirs=`echo $subdirs`

for i in $subdirs
do
	currentpwd=`pwd`
	cd $i
	echo Handling: $subdir $i
	$thisprogram $subdir $i
	cd $currentpwd
done