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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 my $makefiles = `find . -name Makefile.in -print`;
29 # Programs that we want to install in the bin directory too
49 # Programs that we don't want to install at all
56 foreach my $i (split(/\s/,$makefiles))
60 next if $i =~ /\/tests\
/Makefile.in/;
68 # hack to disable this program... the MKPROG_SKIP comment must appear
69 # at the very top of the Makefile.in
70 last if (/^\#\s*MKPROG_SKIP/);
72 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
75 next if ($module eq "none");
76 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
79 if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
81 my @programs = split / /, $1;
82 foreach my $prog (@programs)
84 next unless $prog =~ /\.exe$/;
85 ($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
93 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
95 ################################################################
99 # Automatically generated by make_progs; DO NOT EDIT!!
101 TOPSRCDIR = \@top_srcdir\@
108 ################################################################
109 # output the subdirs list
111 # get rid of duplicates
113 foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
115 print NEWMAKE
"SUBDIRS =";
116 foreach my $dir (sort keys %alldirs)
118 printf NEWMAKE
" \\\n\t%s", $dir;
121 print NEWMAKE
"\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
122 foreach my $dir (sort keys %alldirs)
124 next if $dont_install{$dir};
125 printf NEWMAKE
" \\\n\t%s", $dir;
128 print NEWMAKE
"\n\n# Programs to install in bin directory\nINSTALLPROGS =";
129 foreach my $dir (sort keys %alldirs)
131 printf NEWMAKE
" \\\n\t%s", $dir if $bin_install{$dir};
134 print NEWMAKE
"\n\n# Symlinks to apps that we want to run from inside the source tree\nSYMLINKS =";
135 foreach my $mod (sort keys %directories)
137 printf NEWMAKE
" \\\n\t%s\$(DLLEXT)", $mod;
140 ################################################################
141 # output the build and install targets
148 all: wineapploader winelauncher \$(SUBDIRS) \$(SYMLINKS)
150 wineapploader: wineapploader.in
151 sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
153 winelauncher: winelauncher.in
154 sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
156 # Rules for installation
158 .PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
160 install-apploader: wineapploader dummy
161 \$(MKINSTALLDIRS) \$(bindir)
162 \$(INSTALL_SCRIPT) wineapploader \$(bindir)/wineapploader
164 \$(INSTALLPROGS:%=%/__installprog__): install-apploader
165 \$(RM) \$(bindir)/`dirname \$\@` && \$(LN) \$(bindir)/wineapploader \$(bindir)/`dirname \$\@`
167 install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
168 \$(RM) \$(bindir)/wineapploader
170 install-progs: # nothing to do here
172 install:: winelauncher install-progs\$(DLLEXT)
173 \$(MKINSTALLDIRS) \$(bindir)
174 \$(INSTALL_SCRIPT) winelauncher \$(bindir)/winelauncher
177 -cd \$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
181 \$(RM) wineapploader winelauncher \$(SYMLINKS)
185 check test:: \$(SUBDIRS:%=%/__test__)
189 ################################################################
190 # output the symlinks rules
192 print NEWMAKE
"# Rules for symlinks\n\n";
194 foreach my $mod (sort keys %directories)
196 printf NEWMAKE
"%s\$(DLLEXT)", $mod;
197 printf NEWMAKE
": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
198 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
201 foreach my $mod (sort keys %directories)
203 printf NEWMAKE
"%s/%s\$(DLLEXT): %s\n", $directories{$mod}, $mod, $directories{$mod};
206 ################################################################
209 print NEWMAKE
"\n### Dependencies:\n";
212 rename "Makefile.in.new", "Makefile.in";
213 printf "Successfully updated Makefile.in\n";