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
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/;
81 if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
83 my @programs = split / /, $1;
84 foreach my $prog (@programs)
86 next unless $prog =~ /\.exe$/;
87 ($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\
/]+$/$1/;
95 open NEWMAKE
,">Makefile.in.new" or die "cannot create Makefile.in.new";
97 ################################################################
101 # Automatically generated by make_progs; DO NOT EDIT!!
103 TOPSRCDIR = \@top_srcdir\@
110 ################################################################
111 # output the subdirs list
113 # get rid of duplicates
115 foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
117 print NEWMAKE
"SUBDIRS =";
118 foreach my $dir (sort keys %alldirs)
120 printf NEWMAKE
" \\\n\t%s", $dir;
123 print NEWMAKE
"\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
124 foreach my $dir (sort keys %alldirs)
126 next if $dont_install{$dir};
127 printf NEWMAKE
" \\\n\t%s", $dir;
130 print NEWMAKE
"\n\n# Programs to install in bin directory\nINSTALLPROGS =";
131 foreach my $dir (sort keys %alldirs)
133 printf NEWMAKE
" \\\n\t%s", $dir if $bin_install{$dir};
136 print NEWMAKE
"\n\n# Symlinks to apps that we want to run from inside the source tree\nSYMLINKS =";
137 foreach my $mod (sort keys %directories)
139 printf NEWMAKE
" \\\n\t%s\$(DLLEXT)", $mod;
142 ################################################################
143 # output the build and install targets
150 all: wineapploader winelauncher \$(SUBDIRS) \$(SYMLINKS)
152 wineapploader: wineapploader.in
153 sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
155 winelauncher: winelauncher.in
156 sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
158 # Rules for installation
160 .PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
162 install-apploader: wineapploader dummy
163 \$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
164 \$(INSTALL_SCRIPT) wineapploader \$(DESTDIR)\$(bindir)/wineapploader
166 \$(INSTALLPROGS:%=%/__installprog__): install-apploader
167 \$(RM) \$(DESTDIR)\$(bindir)/`dirname \$\@` && \$(LN) \$(DESTDIR)\$(bindir)/wineapploader \$(DESTDIR)\$(bindir)/`dirname \$\@`
169 install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
170 \$(RM) \$(DESTDIR)\$(bindir)/wineapploader
172 install-progs: # nothing to do here
174 install:: winelauncher install-progs\$(DLLEXT)
175 \$(MKINSTALLDIRS) \$(DESTDIR)\$(bindir)
176 \$(INSTALL_SCRIPT) winelauncher \$(DESTDIR)\$(bindir)/winelauncher
179 -cd \$(DESTDIR)\$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
180 -rmdir \$(DESTDIR)\$(dlldir)
183 \$(RM) wineapploader winelauncher \$(SYMLINKS)
187 check test:: \$(SUBDIRS:%=%/__test__)
191 ################################################################
192 # output the symlinks rules
194 print NEWMAKE
"# Rules for symlinks\n\n";
196 foreach my $mod (sort keys %directories)
198 printf NEWMAKE
"%s\$(DLLEXT)", $mod;
199 printf NEWMAKE
": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
200 printf NEWMAKE
"\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
203 foreach my $mod (sort keys %directories)
205 printf NEWMAKE
"%s/%s\$(DLLEXT): %s\n", $directories{$mod}, $mod, $directories{$mod};
208 ################################################################
211 print NEWMAKE
"\n### Dependencies:\n";
214 rename "Makefile.in.new", "Makefile.in";
215 printf "Successfully updated Makefile.in\n";