3 # Update the dependencies in the programs main Makefile.in.
4 # Must be run in the programs/ directory of the Wine tree.
6 # Copyright 2003 Alexandre Julliard
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 # Programs that we want to install in the bin directory too
48 # Programs that we don't want to install at all
59 if (!system "cmp $file $file.new >/dev/null")
62 print "$file is unchanged\n";
66 rename "$file.new", "$file";
67 print "$file updated\n";
71 # if we are inside the programs dir, go up one level
72 if (! -f
"configure.ac" && -f
"../configure.ac") { chdir(".."); }
74 my $makefiles = `find programs -name Makefile.in -print`;
76 foreach my $i (split(/\s/,$makefiles))
86 # hack to disable this program... the MKPROG_SKIP comment must appear
87 # at the very top of the Makefile.in
88 last if (/^\#\s*MKPROG_SKIP/);
90 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
93 next if ($module eq "none");
94 ($directories{$module} = $i) =~ s/^programs\/(.*)\/[^\
/]+$/$1/;
95 die "invalid module $module in dir $directories{$module}\n" if "$directories{$module}.exe" ne $module;
98 if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
100 my @programs = split / /, $1;
101 foreach my $prog (@programs)
103 next unless $prog =~ /\.exe$/;
104 ($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
112 open NEWMAKE
,">programs/Makefile.in.new" or die "cannot create programs/Makefile.in.new";
114 ################################################################
118 # Automatically generated by make_progs; DO NOT EDIT!!
120 TOPSRCDIR = \@top_srcdir\@
127 ################################################################
128 # output the subdirs list
130 # get rid of duplicates
132 foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
134 print NEWMAKE
"SUBDIRS =";
135 foreach my $dir (sort keys %alldirs)
137 printf NEWMAKE
" \\\n\t%s", $dir;
140 print NEWMAKE
"\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
141 foreach my $dir (sort keys %alldirs)
143 next if $dont_install{$dir};
144 printf NEWMAKE
" \\\n\t%s", $dir;
147 print NEWMAKE
"\n\n# Programs to install in bin directory\nINSTALLPROGS =";
148 foreach my $dir (sort keys %alldirs)
150 printf NEWMAKE
" \\\n\t%s", $dir if $bin_install{$dir};
153 ################################################################
154 # output the build and install targets
159 INSTALLDIRS = \$(DESTDIR)\$(bindir)
163 all: wineapploader winelauncher \$(SUBDIRS)
165 wineapploader: wineapploader.in
166 sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
168 winelauncher: winelauncher.in
169 sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
171 # Rules for installation
173 .PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
175 install-apploader: wineapploader \$(INSTALLDIRS) dummy
176 \$(INSTALL_SCRIPT) wineapploader \$(DESTDIR)\$(bindir)/wineapploader
178 \$(INSTALLPROGS:%=%/__installprog__): install-apploader
179 \$(RM) \$(DESTDIR)\$(bindir)/`dirname \$\@` && \$(LN) \$(DESTDIR)\$(bindir)/wineapploader \$(DESTDIR)\$(bindir)/`dirname \$\@`
181 install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
182 \$(RM) \$(DESTDIR)\$(bindir)/wineapploader
184 install-progs: # nothing to do here
186 install:: winelauncher install-progs\$(DLLEXT) \$(INSTALLDIRS)
187 \$(INSTALL_SCRIPT) winelauncher \$(DESTDIR)\$(bindir)/winelauncher
190 -cd \$(DESTDIR)\$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
191 -rmdir \$(DESTDIR)\$(dlldir)
194 \$(RM) wineapploader winelauncher
198 check test:: \$(SUBDIRS:%=%/__test__)
204 update_file
("programs/Makefile.in");
206 ################################################################
209 open GITIGNORE
, ">programs/.gitignore.new" or die "cannot create programs/.gitignore.new";
210 print GITIGNORE
"# Automatically generated by make_dlls; DO NOT EDIT!!\n";
219 foreach my $dir (sort keys %alldirs)
221 push @ignores, "$dir/$dir";
224 print GITIGNORE
join("\n", sort @ignores) . "\n";
227 update_file
("programs/.gitignore");
229 ################################################################
232 open OLD_CONFIG
, "configure.ac" or die "cannot open configure.ac";
233 open NEW_CONFIG
, ">configure.ac.new" or die "cannot create configure.ac.new";
238 last if /^programs\/Makefile
/;
241 foreach my $dir (sort values %directories)
243 print NEW_CONFIG
"programs/$dir/Makefile\n";
249 $skip = 0 unless /^programs\//;
250 print NEW_CONFIG
$_ unless $skip;
255 update_file
("configure.ac");