-rw-r--r-- | Makefile.test | 8 | ||||
-rw-r--r-- | Rules.make | 7 | ||||
-rwxr-xr-x | scripts/makecfg.pl | 98 |
3 files changed, 111 insertions, 2 deletions
diff --git a/Makefile.test b/Makefile.test index dc0eec7..64f2f41 100644 --- a/Makefile.test +++ b/Makefile.test | |||
@@ -1,13 +1,19 @@ | |||
1 | #!/usr/bin/make -f | 1 | #!/usr/bin/make -f |
2 | 2 | ||
3 | # The following are config.in's which are generated, to avoid numerous manual edits when | ||
4 | # adding packages to the build. | ||
5 | |||
6 | configs += config.in core/applets/config.in core/applets/restartapplet2/config.in core/apps/config.in core/config.in core/multimedia/config.in core/pim/config.in core/pim/today/plugins/config.in core/settings/config.in development/config.in inputmethods/config.in libopie/ofileselector/config.in libopie/pim/config.in libsql/config.in noncore/applets/config.in noncore/apps/config.in noncore/apps/opie-console/test/config.in noncore/comm/config.in noncore/config.in noncore/decorations/config.in noncore/games/config.in noncore/graphics/config.in noncore/multimedia/config.in noncore/net/config.in noncore/net/opietooth/config.in noncore/settings/config.in noncore/styles/config.in noncore/todayplugins/config.in noncore/tools/calc2/config.in noncore/tools/config.in noncore/unsupported/config.in noncore/unsupported/opiemail/ifaces/config.in x11/config.in x11/ipc/config.in x11/ipc/server/config.in | ||
7 | |||
3 | OPIEDIR:=$(shell pwd) | 8 | OPIEDIR:=$(shell pwd) |
4 | TOPDIR:=$(OPIEDIR) | 9 | TOPDIR:=$(OPIEDIR) |
5 | 10 | ||
6 | all : | 11 | all : $(configs) |
7 | 12 | ||
8 | -include $(TOPDIR)/.config | 13 | -include $(TOPDIR)/.config |
9 | -include $(TOPDIR)/.depends | 14 | -include $(TOPDIR)/.depends |
10 | 15 | ||
11 | all : $(TOPDIR)/.depends $(subdir-y) | 16 | all : $(TOPDIR)/.depends $(subdir-y) |
12 | 17 | ||
13 | include $(TOPDIR)/Rules.make | 18 | include $(TOPDIR)/Rules.make |
19 | |||
@@ -1,19 +1,20 @@ | |||
1 | ## targets ## | 1 | ## targets ## |
2 | 2 | ||
3 | $(TOPDIR)/config.in : | 3 | $(configs) : |
4 | $(call makecfg,$@) | ||
4 | 5 | ||
5 | $(TOPDIR)/.depends : $(TOPDIR)/config.in | 6 | $(TOPDIR)/.depends : $(TOPDIR)/config.in |
6 | @cat $(TOPDIR)/packages | \ | 7 | @cat $(TOPDIR)/packages | \ |
7 | awk '/^#/ { next }; {print \ | 8 | awk '/^#/ { next }; {print \ |
8 | ".PHONY : " $$2 "\n" \ | 9 | ".PHONY : " $$2 "\n" \ |
9 | "subdir-$$(" $$1 ") += " $$2 "\n\n" \ | 10 | "subdir-$$(" $$1 ") += " $$2 "\n\n" \ |
10 | $$2 "/Makefile : " $$2 "/" $$3 " $$(TOPDIR)/qmake/qmake\n\t" \ | 11 | $$2 "/Makefile : " $$2 "/" $$3 " $$(TOPDIR)/qmake/qmake\n\t" \ |
11 | "$$(call makefilegen,$$@)\n\n" \ | 12 | "$$(call makefilegen,$$@)\n\n" \ |
12 | $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@)\n"}'\ | 13 | $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@)\n"}'\ |
13 | > $(TOPDIR)/.depends | 14 | > $(TOPDIR)/.depends |
14 | @cat $(TOPDIR)/packages | \ | 15 | @cat $(TOPDIR)/packages | \ |
15 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends | 16 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends |
16 | 17 | ||
17 | $(TOPDIR)/qmake/qmake : | 18 | $(TOPDIR)/qmake/qmake : |
18 | $(call descend,$(TOPDIR)/qmake) | 19 | $(call descend,$(TOPDIR)/qmake) |
19 | 20 | ||
@@ -25,16 +26,20 @@ $(TOPDIR)/scripts/kconfig/conf scripts/kconfig/conf: | |||
25 | 26 | ||
26 | $(TOPDIR)/scripts/kconfig/mconf scripts/kconfig/mconf: | 27 | $(TOPDIR)/scripts/kconfig/mconf scripts/kconfig/mconf: |
27 | $(call descend,$(TOPDIR)/scripts/kconfig,mconf) | 28 | $(call descend,$(TOPDIR)/scripts/kconfig,mconf) |
28 | 29 | ||
29 | $(TOPDIR)/scripts/kconfig/qconf scripts/kconfijg/qconf: | 30 | $(TOPDIR)/scripts/kconfig/qconf scripts/kconfijg/qconf: |
30 | $(call descend,$(TOPDIR)/scripts/kconfig,qconf) | 31 | $(call descend,$(TOPDIR)/scripts/kconfig,qconf) |
31 | 32 | ||
32 | ## general rules ## | 33 | ## general rules ## |
33 | 34 | ||
34 | define descend | 35 | define descend |
35 | $(MAKE) -C $(1) $(2) | 36 | $(MAKE) -C $(1) $(2) |
36 | endef | 37 | endef |
37 | 38 | ||
38 | define makefilegen | 39 | define makefilegen |
39 | cd $(shell dirname $(1)); $(TOPDIR)/qmake/qmake $(3) -o $(shell basename $(1)) `echo $(1)|sed -e 's,/Makefile$$,,g' -e 's,.*/,,g'`.pro | 40 | cd $(shell dirname $(1)); $(TOPDIR)/qmake/qmake $(3) -o $(shell basename $(1)) `echo $(1)|sed -e 's,/Makefile$$,,g' -e 's,.*/,,g'`.pro |
40 | endef | 41 | endef |
42 | |||
43 | define makecfg | ||
44 | $(TOPDIR)/scripts/makecfg.pl $1 | ||
45 | endef | ||
diff --git a/scripts/makecfg.pl b/scripts/makecfg.pl new file mode 100755 index 0000000..20c23f5 --- a/dev/null +++ b/scripts/makecfg.pl | |||
@@ -0,0 +1,98 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' | ||
3 | if 0; #$running_under_some_shell | ||
4 | |||
5 | use strict; | ||
6 | use File::Find; | ||
7 | |||
8 | my $packages=""; | ||
9 | open(FILE, "<./packages"); | ||
10 | while(<FILE>){$packages.=$_;} | ||
11 | close(FILE); | ||
12 | |||
13 | my ($dirname,$dir,$cfg,$filename,$tagname,$name,$caps,$pre,$post,$sources,@dupecheck); | ||
14 | $cfg = shift || die; | ||
15 | ($dirname=$cfg)=~s,(.*)/(.*),$1,; | ||
16 | ($filename=$cfg)=~s,(.*/)(.*),$2,; | ||
17 | ($tagname=$dirname)=~s,.*/,,; | ||
18 | ($caps=$tagname)=~tr/[a-z]/[A-Z]/; | ||
19 | #print "cfg is $cfg\n"; | ||
20 | #print "dir is $dirname\n"; | ||
21 | #print "filename is $filename\n"; | ||
22 | sub wanted; | ||
23 | |||
24 | if(-e "$dirname/config.in.in"){ | ||
25 | my $contents; | ||
26 | open(FILE, "<$dirname/config.in.in"); | ||
27 | while(<FILE>){ $contents.=$_; } | ||
28 | close(FILE); | ||
29 | if($contents=~/\@sources\@/){ | ||
30 | ($post = $contents) =~ s/^.*\@sources\@//s; | ||
31 | ($pre = $contents) =~ s/\@sources\@.*$//s; | ||
32 | } else { | ||
33 | $pre = $contents; | ||
34 | } | ||
35 | } else { | ||
36 | $pre = "menu \"$tagname\"\n"; | ||
37 | $post = "endmenu\n"; | ||
38 | } | ||
39 | |||
40 | open(CFG, ">$cfg") || die "Unable to open $cfg for writing\n"; | ||
41 | select(CFG); | ||
42 | print $pre; | ||
43 | @dupecheck=(); | ||
44 | File::Find::find({wanted => \&wanted}, $dirname); | ||
45 | print $post; | ||
46 | select(STDOUT); | ||
47 | close(CFG); | ||
48 | |||
49 | exit; | ||
50 | |||
51 | open(FILE,">$dir/config.in"); | ||
52 | select(FILE); | ||
53 | print "menu \"$name\"\n"; | ||
54 | print "\n"; | ||
55 | my @subdirs=(); | ||
56 | my @dirs; | ||
57 | foreach(grep(/^$dir/, @dirs)){ | ||
58 | chomp; | ||
59 | /^$dir\/$name.pro$/ && next; | ||
60 | my $localdir=$_; | ||
61 | if($dir=~m,^$localdir$,){ | ||
62 | next; | ||
63 | } | ||
64 | #($locadir=$_)~s,/[^/]+$,,g; | ||
65 | if($localdir=~/^\.$/){next;} | ||
66 | if(grep(/^$localdir$/, @subdirs)){next;} | ||
67 | my $nslashes = $localdir =~ tr!/!!; | ||
68 | my $dirnslashes = $dir =~ tr!/!!; | ||
69 | $dirnslashes++; | ||
70 | if($dirnslashes != $nslashes ){next;} | ||
71 | print STDERR "$localdir/config.in\n"; | ||
72 | print " source $localdir/config.in\n"; | ||
73 | push(@subdirs, $localdir); | ||
74 | print "endmenu\n"; | ||
75 | select(STDOUT); | ||
76 | close(FILE); | ||
77 | } | ||
78 | |||
79 | use vars qw/*name *dir *prune/; | ||
80 | *name = *File::Find::name; | ||
81 | *dir = *File::Find::dir; | ||
82 | *prune = *File::Find::prune; | ||
83 | |||
84 | sub wanted { | ||
85 | if( /config.in/s ) { | ||
86 | if(grep(/^$File::Find::dir\/config.in$/, @dupecheck)){ | ||
87 | return; | ||
88 | } | ||
89 | my $nslashes = $File::Find::dir =~ tr!/!!; | ||
90 | my $dirnslashes = $dirname =~ tr!/!!; | ||
91 | $dirnslashes++; | ||
92 | # print STDERR "dirnslashes is $dirnslashes\n"; | ||
93 | # print STDERR "nslashes is $nslashes\n"; | ||
94 | if($dirnslashes != $nslashes){return;} | ||
95 | print " source " . $File::Find::dir . "/config.in\n"; | ||
96 | push(@dupecheck, $File::Find::dir . "/config.in"); | ||
97 | } | ||
98 | } | ||