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
25 my $makefiles = `find . -name Makefile.in -print`;
29 # Programs that we want to install in the bin directory too
50 # Programs that we don't want to install at all
58 foreach my $i (split(/\s/,$makefiles))
62 next if $i =~ /\/tests\
/Makefile.in/;
70 # hack to disable this program... the MKPROG_SKIP comment must appear
71 # at the very top of the Makefile.in
72 last if (/^\#\s*MKPROG_SKIP/);
74 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
77 next if ($module eq "none");
78 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
79 die "invalid module $module in dir $directories{$module}\n" if "$directories{$module}.exe" ne $module;
82 if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
84 my @programs = split / /, $1;
85 foreach my $prog (@programs)
87 next unless $prog =~ /\.exe$/;
88 ($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
96 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
98 ################################################################
102 # Automatically generated by make_progs; DO NOT EDIT!!
104 TOPSRCDIR = \@top_srcdir\@
111 ################################################################
112 # output the subdirs list
114 # get rid of duplicates
116 foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
118 print NEWMAKE
"SUBDIRS =";
119 foreach my $dir (sort keys %alldirs)
121 printf NEWMAKE
" \\\n\t%s", $dir;
124 print NEWMAKE
"\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
125 foreach my $dir (sort keys %alldirs)
127 next if $dont_install{$dir};
128 printf NEWMAKE
" \\\n\t%s", $dir;
131 print NEWMAKE
"\n\n# Programs to install in bin directory\nINSTALLPROGS =";
132 foreach my $dir (sort keys %alldirs)
134 printf NEWMAKE
" \\\n\t%s", $dir if $bin_install{$dir};
137 ################################################################
138 # output the build and install targets
145 all: wineapploader winelauncher \$(SUBDIRS)
147 wineapploader: wineapploader.in
148 sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
150 winelauncher: winelauncher.in
151 sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
153 # Rules for installation
155 .PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
157 install-apploader: wineapploader dummy
158 \$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
159 \$(INSTALL_SCRIPT) wineapploader \$(DESTDIR)\$(bindir)/wineapploader
161 \$(INSTALLPROGS:%=%/__installprog__): install-apploader
162 \$(RM) \$(DESTDIR)\$(bindir)/`dirname \$\@` && \$(LN) \$(DESTDIR)\$(bindir)/wineapploader \$(DESTDIR)\$(bindir)/`dirname \$\@`
164 install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
165 \$(RM) \$(DESTDIR)\$(bindir)/wineapploader
167 install-progs: # nothing to do here
169 install:: winelauncher install-progs\$(DLLEXT)
170 \$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
171 \$(INSTALL_SCRIPT) winelauncher \$(DESTDIR)\$(bindir)/winelauncher
174 -cd \$(DESTDIR)\$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
175 -rmdir \$(DESTDIR)\$(dlldir)
178 \$(RM) wineapploader winelauncher
182 check test:: \$(SUBDIRS:%=%/__test__)
188 rename "Makefile.in.new", "Makefile.in";
189 printf "Successfully updated Makefile.in\n";