server: Use the new set_fd_user function in create_serial().
[wine/multimedia.git] / programs / make_progs
blob5f77e19b0c3dcd6af33396041a93d7f89defece2
1 #!/usr/bin/perl -w
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
23 use strict;
25 my $makefiles = `find . -name Makefile.in -print`;
27 my %directories = ();
29 # Programs that we want to install in the bin directory too
30 my %bin_install =
32 "msiexec" => 1,
33 "notepad" => 1,
34 "progman" => 1,
35 "regedit" => 1,
36 "regsvr32" => 1,
37 "uninstaller" => 1,
38 "wcmd" => 1,
39 "wineboot" => 1,
40 "winebrowser" => 1,
41 "winecfg" => 1,
42 "wineconsole" => 1,
43 "winedbg" => 1,
44 "winefile" => 1,
45 "winemine" => 1,
46 "winepath" => 1,
47 "winhelp" => 1,
50 # Programs that we don't want to install at all
51 my %dont_install =
53 "cmdlgtst" => 1,
54 "view" => 1,
57 foreach my $i (split(/\s/,$makefiles))
59 my $module;
61 next if $i =~ /\/tests\/Makefile.in/;
63 open MAKE,$i;
65 $module = undef;
66 while (<MAKE>)
68 chop;
69 # hack to disable this program... the MKPROG_SKIP comment must appear
70 # at the very top of the Makefile.in
71 last if (/^\#\s*MKPROG_SKIP/);
73 if (/^MODULE\s*=\s*([a-zA-Z0-9_.]+)/)
75 $module = $1;
76 next if ($module eq "none");
77 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
78 last;
80 if (/^PROGRAMS\s*=((\s*[a-zA-Z0-9_.]+)+)/)
82 my @programs = split / /, $1;
83 foreach my $prog (@programs)
85 next unless $prog =~ /\.exe$/;
86 ($directories{$prog} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
88 last;
91 close MAKE;
94 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
96 ################################################################
97 # makefile header
99 print NEWMAKE <<EOF;
100 # Automatically generated by make_progs; DO NOT EDIT!!
102 TOPSRCDIR = \@top_srcdir\@
103 TOPOBJDIR = ..
104 SRCDIR = \@srcdir\@
105 VPATH = \@srcdir\@
109 ################################################################
110 # output the subdirs list
112 # get rid of duplicates
113 my %alldirs = ();
114 foreach my $dir (sort values %directories) { $alldirs{$dir} = 1; }
116 print NEWMAKE "SUBDIRS =";
117 foreach my $dir (sort keys %alldirs)
119 printf NEWMAKE " \\\n\t%s", $dir;
122 print NEWMAKE "\n\n# Sub-directories to run make install into\nINSTALLSUBDIRS =";
123 foreach my $dir (sort keys %alldirs)
125 next if $dont_install{$dir};
126 printf NEWMAKE " \\\n\t%s", $dir;
129 print NEWMAKE "\n\n# Programs to install in bin directory\nINSTALLPROGS =";
130 foreach my $dir (sort keys %alldirs)
132 printf NEWMAKE " \\\n\t%s", $dir if $bin_install{$dir};
135 print NEWMAKE "\n\n# Symlinks to apps that we want to run from inside the source tree\nSYMLINKS =";
136 foreach my $mod (sort keys %directories)
138 printf NEWMAKE " \\\n\t%s\$(DLLEXT)", $mod;
141 ################################################################
142 # output the build and install targets
144 print NEWMAKE <<EOF;
147 \@MAKE_RULES\@
149 all: wineapploader winelauncher \$(SUBDIRS) \$(SYMLINKS)
151 wineapploader: wineapploader.in
152 sed -e 's,\@bindir\\\@,\$(bindir),g' \$(SRCDIR)/wineapploader.in >\$\@ || (\$(RM) \$\@ && false)
154 winelauncher: winelauncher.in
155 sed -e 's,\@bindir\\\@,\$(bindir),g' -e 's,\@libdir\\\@,\$(libdir),g' -e 's,\@dlldir\\\@,\$(dlldir),g' \$(SRCDIR)/winelauncher.in >\$\@ || (\$(RM) \$\@ && false)
157 # Rules for installation
159 .PHONY: install-apploader install-progs install-progs.so \$(INSTALLPROGS:%=%/__installprog__)
161 install-apploader: wineapploader dummy
162 \$(MKINSTALLDIRS) \$(bindir)
163 \$(INSTALL_SCRIPT) wineapploader \$(bindir)/wineapploader
165 \$(INSTALLPROGS:%=%/__installprog__): install-apploader
166 \$(RM) \$(bindir)/`dirname \$\@` && \$(LN) \$(bindir)/wineapploader \$(bindir)/`dirname \$\@`
168 install-progs.so: \$(INSTALLPROGS:%=%/__installprog__)
169 \$(RM) \$(bindir)/wineapploader
171 install-progs: # nothing to do here
173 install:: winelauncher install-progs\$(DLLEXT)
174 \$(MKINSTALLDIRS) \$(bindir)
175 \$(INSTALL_SCRIPT) winelauncher \$(bindir)/winelauncher
177 uninstall::
178 -cd \$(bindir) && \$(RM) wineapploader winelauncher \$(INSTALLPROGS)
179 -rmdir \$(dlldir)
181 clean::
182 \$(RM) wineapploader winelauncher \$(SYMLINKS)
184 # Rules for testing
186 check test:: \$(SUBDIRS:%=%/__test__)
190 ################################################################
191 # output the symlinks rules
193 print NEWMAKE "# Rules for symlinks\n\n";
195 foreach my $mod (sort keys %directories)
197 printf NEWMAKE "%s\$(DLLEXT)", $mod;
198 printf NEWMAKE ": %s/%s\$(DLLEXT)\n", $directories{$mod}, $mod;
199 printf NEWMAKE "\t\$(RM) \$@ && \$(LN_S) %s/%s\$(DLLEXT) \$@\n\n", $directories{$mod}, $mod;
202 foreach my $mod (sort keys %directories)
204 printf NEWMAKE "%s/%s\$(DLLEXT): %s\n", $directories{$mod}, $mod, $directories{$mod};
207 ################################################################
208 # makefile trailer
210 print NEWMAKE "\n### Dependencies:\n";
212 close NEWMAKE;
213 rename "Makefile.in.new", "Makefile.in";
214 printf "Successfully updated Makefile.in\n";