Get rid of the X11DRV_DC_Funcs hack.
[wine.git] / programs / make_progs
blob261d63765a5040ee5dc94215cb4bac7261a9a06d
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 "notepad" => 1,
33 "progman" => 1,
34 "regedit" => 1,
35 "regsvr32" => 1,
36 "uninstaller" => 1,
37 "wcmd" => 1,
38 "wineboot" => 1,
39 "winebrowser" => 1,
40 "winecfg" => 1,
41 "wineconsole" => 1,
42 "winedbg" => 1,
43 "winefile" => 1,
44 "winemine" => 1,
45 "winepath" => 1,
46 "winhelp" => 1,
49 # Programs that we don't want to install at all
50 my %dont_install =
52 "cmdlgtst" => 1,
53 "view" => 1,
56 foreach my $i (split(/\s/,$makefiles))
58 my $module;
60 next if $i =~ /\/tests\/Makefile.in/;
62 open MAKE,$i;
64 $module = undef;
65 while (<MAKE>)
67 chop;
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_.]+)/)
74 $module = $1;
75 next if ($module eq "none");
76 ($directories{$module} = $i) =~ s/^\.\/(.*)\/[^\/]+$/$1/;
77 last;
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/;
87 last;
90 close MAKE;
93 open NEWMAKE,">Makefile.in.new" or die "cannot create Makefile.in.new";
95 ################################################################
96 # makefile header
98 print NEWMAKE <<EOF;
99 # Automatically generated by make_progs; DO NOT EDIT!!
101 TOPSRCDIR = \@top_srcdir\@
102 TOPOBJDIR = ..
103 SRCDIR = \@srcdir\@
104 VPATH = \@srcdir\@
108 ################################################################
109 # output the subdirs list
111 # get rid of duplicates
112 my %alldirs = ();
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", $mod;
140 ################################################################
141 # output the build and install targets
143 print NEWMAKE <<EOF;
146 \@MAKE_RULES\@
148 all: wineapploader winelauncher \$(SUBDIRS) \$(SYMLINKS:%=%\$(DLLEXT))
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
176 uninstall::
177 \$(RM) \$(bindir)/wineapploader \$(bindir)/winelauncher \$(INSTALLPROGS:%=\$(bindir)/%)
178 -rmdir \$(dlldir)
180 clean::
181 \$(RM) wineapploader winelauncher \$(SYMLINKS)
183 # Rules for testing
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 ################################################################
207 # makefile trailer
209 print NEWMAKE "\n### Dependencies:\n";
211 close NEWMAKE;
212 rename "Makefile.in.new", "Makefile.in";
213 printf "Successfully updated Makefile.in\n";