-rw-r--r-- | Makefile.test | 53 | ||||
-rw-r--r-- | Rules.make | 15 | ||||
-rwxr-xr-x | scripts/deps.pl | 73 |
3 files changed, 103 insertions, 38 deletions
diff --git a/Makefile.test b/Makefile.test index 526aa5d..3311cde 100644 --- a/Makefile.test +++ b/Makefile.test | |||
@@ -4,70 +4,59 @@ export TOPDIR:=$(OPIEDIR) | |||
4 | 4 | ||
5 | export QMAKESPECSDIR=$(OPIEDIR)/mkspecs | 5 | export QMAKESPECSDIR=$(OPIEDIR)/mkspecs |
6 | export QMAKESPEC=$(QMAKESPECSDIR)/qws/linux-generic-g++ | 6 | export QMAKESPEC=$(QMAKESPECSDIR)/qws/linux-generic-g++ |
7 | 7 | ||
8 | # The following are config.in's which are generated, to avoid numerous manual edits when | 8 | all : |
9 | # adding packages to the build. | ||
10 | # | ||
11 | # NOTE: There currently exists a bug regarding this, the toplevel config.in -must- be created | ||
12 | # -after- the lower level config.ins, as makecfg.pl does a find for config.in files! | ||
13 | # | ||
14 | # solution: generate this list and stuff into .depends, and also | ||
15 | # generate config.in interdependencies (i.e. topdir config.in depends on | ||
16 | # config.ins within dirs below it. dependencies are solely dir structure | ||
17 | # driven) | ||
18 | 9 | ||
19 | configs = $(TOPDIR)/x11/ipc/server/config.in $(TOPDIR)/x11/ipc/config.in $(TOPDIR)/x11/config.in $(TOPDIR)/noncore/unsupported/opiemail/ifaces/config.in $(TOPDIR)/noncore/unsupported/config.in $(TOPDIR)/noncore/tools/config.in $(TOPDIR)/noncore/tools/calc2/config.in $(TOPDIR)/noncore/todayplugins/config.in $(TOPDIR)/noncore/styles/config.in $(TOPDIR)/noncore/settings/config.in $(TOPDIR)/noncore/net/opietooth/config.in $(TOPDIR)/noncore/net/config.in $(TOPDIR)/noncore/multimedia/config.in $(TOPDIR)/noncore/graphics/config.in $(TOPDIR)/noncore/games/config.in $(TOPDIR)/noncore/decorations/config.in $(TOPDIR)/noncore/config.in $(TOPDIR)/noncore/comm/config.in $(TOPDIR)/noncore/apps/config.in $(TOPDIR)/noncore/applets/config.in $(TOPDIR)/libsql/config.in $(TOPDIR)/libopie/pim/config.in $(TOPDIR)/libopie/ofileselector/config.in $(TOPDIR)/inputmethods/config.in $(TOPDIR)/development/config.in $(TOPDIR)/core/settings/config.in $(TOPDIR)/core/pim/today/plugins/config.in $(TOPDIR)/core/pim/config.in $(TOPDIR)/core/multimedia/config.in $(TOPDIR)/core/config.in $(TOPDIR)/core/apps/config.in $(TOPDIR)/core/applets/restartapplet2/config.in $(TOPDIR)/core/applets/config.in $(TOPDIR)/config.in | 10 | clean-configs : $(TOPDIR)/.depends |
20 | |||
21 | all : configs | ||
22 | |||
23 | configs : $(shell echo $(configs) | sort -r) | ||
24 | |||
25 | clean-configs : | ||
26 | @echo "Wiping generated config.in files..." | 11 | @echo "Wiping generated config.in files..." |
27 | @-rm -f $(configs) | 12 | @-rm -f $(configs) |
28 | 13 | ||
29 | ./.config: | 14 | -include $(TOPDIR)/.config |
15 | -include $(TOPDIR)/..config.cmd | ||
16 | -include $(TOPDIR)/.depends | ||
17 | |||
18 | all : $(TOPDIR)/.depends $(configs) $(subdir-y) | ||
19 | |||
20 | ./.config: $(configs) | ||
30 | $(call descend,scripts/kconfig,conf) | 21 | $(call descend,scripts/kconfig,conf) |
31 | @$(MAKE) -C scripts/kconfig conf | 22 | @if [ ! -e $@ ]; then \ |
23 | cp $(TOPDIR)/def-configs/opie $@; \ | ||
24 | fi; | ||
25 | @$(MAKE) -C scripts/kconfig conf; | ||
32 | ./scripts/kconfig/conf -s ./config.in | 26 | ./scripts/kconfig/conf -s ./config.in |
33 | 27 | ||
34 | xconfig: | 28 | xconfig: $(configs) |
35 | $(call descend,scripts/kconfig,qconf) | 29 | $(call descend,scripts/kconfig,qconf) |
36 | ./scripts/kconfig/qconf ./config.in | 30 | ./scripts/kconfig/qconf ./config.in |
37 | 31 | ||
38 | menuconfig: scripts/lxdialog/lxdialog | 32 | menuconfig: $(configs) scripts/lxdialog/lxdialog |
39 | $(call descend,scripts/kconfig,mconf) | 33 | $(call descend,scripts/kconfig,mconf) |
40 | ./scripts/kconfig/mconf ./config.in | 34 | ./scripts/kconfig/mconf ./config.in |
41 | 35 | ||
42 | config: | 36 | config: $(configs) |
43 | $(call descend,scripts/kconfig,conf) | 37 | $(call descend,scripts/kconfig,conf) |
44 | ./scripts/kconfig/conf ./config.in | 38 | ./scripts/kconfig/conf ./config.in |
45 | 39 | ||
46 | oldconfig: | 40 | oldconfig: $(configs) |
47 | $(call descend,scripts/kconfig,conf) | 41 | $(call descend,scripts/kconfig,conf) |
48 | ./scripts/kconfig/conf -o ./config.in | 42 | ./scripts/kconfig/conf -o ./config.in |
49 | 43 | ||
50 | randconfig: | 44 | randconfig: $(configs) |
51 | $(call descend,scripts/kconfig,conf) | 45 | $(call descend,scripts/kconfig,conf) |
52 | ./scripts/kconfig/conf -r ./config.in | 46 | ./scripts/kconfig/conf -r ./config.in |
53 | 47 | ||
54 | allyesconfig: | 48 | allyesconfig: $(configs) |
55 | $(call descend,scripts/kconfig,conf) | 49 | $(call descend,scripts/kconfig,conf) |
56 | ./scripts/kconfig/conf -y ./config.in | 50 | ./scripts/kconfig/conf -y ./config.in |
57 | 51 | ||
58 | allnoconfig: | 52 | allnoconfig: $(configs) |
59 | $(call descend,scripts/kconfig,conf) | 53 | $(call descend,scripts/kconfig,conf) |
60 | ./scripts/kconfig/conf -n ./config.in | 54 | ./scripts/kconfig/conf -n ./config.in |
61 | 55 | ||
62 | defconfig: | 56 | defconfig: $(configs) |
63 | $(call descend,scripts/kconfig,conf) | 57 | $(call descend,scripts/kconfig,conf) |
64 | ./scripts/kconfig/conf -d ./config.in | 58 | ./scripts/kconfig/conf -d ./config.in |
65 | 59 | ||
66 | -include $(TOPDIR)/.config | ||
67 | -include $(TOPDIR)/..config.cmd | ||
68 | -include $(TOPDIR)/.depends | ||
69 | |||
70 | all : $(TOPDIR)/.depends $(subdir-y) | ||
71 | 60 | ||
72 | include $(TOPDIR)/Rules.make | 61 | include $(TOPDIR)/Rules.make |
73 | 62 | ||
@@ -2,24 +2,27 @@ | |||
2 | 2 | ||
3 | $(configs) : | 3 | $(configs) : |
4 | $(call makecfg,$@) | 4 | $(call makecfg,$@) |
5 | 5 | ||
6 | $(TOPDIR)/.depends : $(TOPDIR)/config.in | 6 | $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) |
7 | # add to subdir-y, and add descend rules | 7 | @echo Generating dependency information... |
8 | # add to subdir-y, and add descend rules | ||
8 | @cat $(TOPDIR)/packages | \ | 9 | @cat $(TOPDIR)/packages | \ |
9 | awk '/^#/ { next }; {print \ | 10 | awk '/^#/ { next }; {print \ |
10 | ".PHONY : " $$2 "\n" \ | 11 | ".PHONY : " $$2 "\n" \ |
11 | "subdir-$$(" $$1 ") += " $$2 "\n\n" \ | 12 | "subdir-$$(" $$1 ") += " $$2 "\n\n" \ |
12 | $$2 "/Makefile : " $$2 "/" $$3 " $$(TOPDIR)/qmake/qmake\n\t" \ | 13 | $$2 "/Makefile : " $$2 "/" $$3 " $$(TOPDIR)/qmake/qmake\n\t" \ |
13 | "$$(call makefilegen,$$@)\n\n" \ | 14 | "$$(call makefilegen,$$@)\n\n" \ |
14 | $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@)\n"}'\ | 15 | $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@)\n"}'\ |
15 | > $(TOPDIR)/.depends | 16 | > $(TOPDIR)/.depends |
16 | # interpackage dependency generation | 17 | # interpackage dependency generation |
17 | @cat $(TOPDIR)/packages | \ | 18 | @cat $(TOPDIR)/packages | \ |
18 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends | 19 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends |
19 | # generation of config.in files, and config.in interdependencies | 20 | # generation of config.in files, and config.in interdependencies |
20 | find ./ -name config.in | ( for cfg in `cat`; do dir=`dirname $cfg`; name=`basename $dir`; if [ ! -e $dir/$name.pro ]; then echo $dir; fi; done; ) > dirs | 21 | @find $(TOPDIR)/ -name config.in | ( for cfg in `cat`; do dir=`dirname $$cfg`; name=`basename $$dir`; if [ ! -e $$dir/$$name.pro ]; then echo $$dir; fi; done; ) > dirs |
21 | cat dirs | for i in `cat`; do numlines="`cat dirs|grep $i 2>/dev/null|wc -l`"; if [ "$numlines" -ne "1" ]; then deps=`cat dirs|grep $i| grep -v "^$i$"|for i in \`cat|sed -e's,^./,$(TOPDIR)/,g'\`; do echo $i/config.in; done`; echo `echo $i|sed -e 's,^./,$(TOPDIR)/,'` : $deps; fi; done; | 22 | @echo "configs += `echo \`cat dirs | sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g' -e's,$$,/config.in,g'\``" >> .depends |
23 | @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $(TOPDIR)/.depends | ||
24 | @-rm -f dirs | ||
22 | 25 | ||
23 | $(TOPDIR)/qmake/qmake : | 26 | $(TOPDIR)/qmake/qmake : |
24 | $(call descend,$(TOPDIR)/qmake) | 27 | $(call descend,$(TOPDIR)/qmake) |
25 | 28 | ||
diff --git a/scripts/deps.pl b/scripts/deps.pl new file mode 100755 index 0000000..56c4e77 --- a/dev/null +++ b/scripts/deps.pl | |||
@@ -0,0 +1,73 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | |||
3 | use strict; | ||
4 | |||
5 | my %depends; | ||
6 | my %tokenpath; | ||
7 | |||
8 | sub getdepends ($$) | ||
9 | { | ||
10 | my ($token, $path, $intoken); | ||
11 | $token = shift || return; | ||
12 | $token =~ s/CONFIG_//; | ||
13 | $path = shift || return; | ||
14 | #print "opening $path/config.in\n"; | ||
15 | #print "token is $token\n"; | ||
16 | open( FILE, "< $path/config.in" ) || return; | ||
17 | $intoken = 0; | ||
18 | while( <FILE> ) { | ||
19 | if( $intoken == 1 ) { | ||
20 | /depends\S*(.*)/ && return $1; | ||
21 | if( /\S*(config|menu)/ ) { | ||
22 | $intoken = 0; | ||
23 | return; | ||
24 | } | ||
25 | } else { | ||
26 | /$token/ || next; | ||
27 | $intoken = 1; | ||
28 | } | ||
29 | /$token/ || next; | ||
30 | } | ||
31 | close( FILE ); | ||
32 | return; | ||
33 | } | ||
34 | |||
35 | sub makedepends ($$) | ||
36 | { | ||
37 | my ($depends, $tokenpath, $token, $depword, $mustbesep, $state); | ||
38 | $depends = shift || return; | ||
39 | $tokenpath = shift || return; | ||
40 | $mustbesep = 0; | ||
41 | |||
42 | for $token (keys %$depends){ | ||
43 | print ${$tokenpath}{$token} . " : "; | ||
44 | for (split(/\s+/, ${$depends}{$token})){ | ||
45 | /^\s+$/ && next; | ||
46 | /\&\&/ && next; | ||
47 | /\|\|/ && next; | ||
48 | /^$/ && next; | ||
49 | if(defined(${$tokenpath}{"CONFIG_" . $_})){ | ||
50 | print '$(if $(CONFIG_' . $_ . '),' . ${$tokenpath}{"CONFIG_" . $_} . ') '; | ||
51 | } else { | ||
52 | print STDERR "ERROR in dependency generation, unable to locate path for token CONFIG_$_\n"; | ||
53 | } | ||
54 | } | ||
55 | print "\n"; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | while( <> ) { | ||
60 | my $dep; | ||
61 | my ($token, $path, $pro); | ||
62 | chomp; | ||
63 | s/^\s*//g; | ||
64 | s/\s*$//g; | ||
65 | ($token, $path, $pro) = split(/\s+/,$_); | ||
66 | $tokenpath{$token} = $path; | ||
67 | $dep = getdepends($token, $path); | ||
68 | if( $dep ) { | ||
69 | $depends{$token} = $dep; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | makedepends(\%depends, \%tokenpath); | ||