1 #!#############################################################################
3 #! Purpose: tmake template file from which the VC++ 6.0 project file for
4 #! building wxWindows applications are generated by running
5 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp
6 #! you may append CONFIG+= to the end of the line, i.e.
7 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp CONFIG+=unicode
8 #! tmake -t vc6lib wxwin.pro -o wxvc.dsp CONFIG+=dll
9 #! Author: Vadim Zeitlin
12 #!#############################################################################
14 #! what kind of app are we building - this is used as prefix for the build
19 Project('CONFIG += windows');
21 if ( Config("wxbase") || Config("wxuniv") ) {
22 Project('CONFIG += wx');
25 if ( Config("wxnodir") ) {
29 #! VC 6.0 supports env vars in include path
30 #! $WXDIR = $ENV{'WX'};
39 AddIncludePath($WXDIR . "\\include");
42 if ( Config("unicode") ) {
45 $UNICODE_FLAGS="/D _UNICODE /D UNICODE ";
47 $project{"TARGET"} .= "Unicode";
48 $project{"MAKEFILE"} .= "Unicode";
57 if ( Config("wxbase") ) {
61 elsif ( Config("wxuniv") ) {
69 if ( Config("dll") ) {
73 $DLL_FLAGS="/D WXUSINGDLL ";
76 $project{"TARGET"} .= "Dll";
77 $project{"MAKEFILE"} .= "Dll";
82 #! actually this should depend on the contents of setup.h!
83 $EXTRA_LIBS="zlib regex";
84 if ( !Config("wxbase") ) {
85 $EXTRA_LIBS.=" png jpeg tiff";
92 #! let's be smart: if no extension is given, add .lib (this allows for
93 #! LIBS=libname in project files which map either on -l libname.lib under
94 #! Windows or on -llibname under Unix).
95 @libs = split(/\s+/, Project('LIBS'));
96 foreach $lib (@libs) {
97 if ( $lib !~ "\.lib\$" ) { $lib .= ".lib"; }
98 Project('TMAKE_LIBS *= ' . $lib);
101 if ( Config("windows") ) {
102 $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Application';
103 $project{"VC_PROJ_CODE"} = '0x0101';
104 $vc_base_libs = 'kernel32.lib user32.lib gdi32.lib winspool.lib ' .
105 'comdlg32.lib advapi32.lib shell32.lib ole32.lib ' .
106 'oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ';
107 if ( Config("wx") ) {
108 $vc_base_libs .= "comctl32.lib rpcrt4.lib wsock32.lib ";
110 $vc_link_release = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
111 $vc_link_debug = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
112 foreach ( split(/ /, $EXTRA_LIBS) ) {
113 $vc_link_release .= "$WXDIR\\lib\\$_.lib ";
114 $vc_link_debug .= "$WXDIR\\lib\\$_" . "d.lib ";
117 $vc_link_release .= '/nologo /subsystem:windows /machine:I386';
118 $vc_link_debug .= '/nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept';
120 $vc_cpp_def_common = '/D "WIN32" /D "_WINDOWS" ' . $UNICODE_FLAGS . $DLL_FLAGS;
121 $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
122 $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
124 $project{"VC_PROJ_TYPE"} = 'Win32 (x86) Console Application';
125 $project{"VC_PROJ_CODE"} = '0x0103';
126 $vc_base_libs = 'kernel32.lib user32.lib advapi32.lib ';
127 if ( Config("wx") ) {
128 $vc_base_libs .= 'wsock32.lib ';
129 $vc_link_release = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX.lib ";
130 $vc_link_debug = "$WXDIR\\lib\\$DLL_OR_LIB$UNICODE_SUFFIX$DEBUG_SUFFIX.lib ";
131 foreach ( split(/ /, $EXTRA_LIBS) ) {
132 $vc_link_release .= "$WXDIR\\lib\\$_.lib ";
133 $vc_link_debug .= "$WXDIR\\lib\\$_" . "d.lib ";
136 $vc_link_release .= '/nologo /subsystem:console /machine:I386';
137 $vc_link_debug .= '/nologo /subsystem:console /debug /machine:I386 /pdbtype:sept';
139 $vc_cpp_def_common = '/D "WIN32" /D "_CONSOLE" ' . $UNICODE_FLAGS . $DLL_FLAGS;
140 $vc_cpp_def_release = '/D "NDEBUG" ' . $vc_cpp_def_common;
141 $vc_cpp_def_debug = '/D "_DEBUG" ' . $vc_cpp_def_common;
144 foreach ( split(/ /, Project('LIBPATH')) ) {
145 $vc_link_release .= " /libpath:$_\\Release";
146 $vc_link_debug .= " /libpath:$_\\Debug";
149 #! define wxWin debug flags in debug build
150 if ( Config("wx") ) {
151 $vc_cpp_def_debug .= '/MDd /D "__WXDEBUG__" /D "WXDEBUG=1" ';
152 $vc_cpp_def_release .= '/MD '
155 $project{"VC_BASE_LINK_RELEASE"} = $vc_base_libs . $vc_link_release;
156 $project{"VC_BASE_LINK_DEBUG"} = $vc_base_libs . $vc_link_debug;
157 $tmake_libs = Project('TMAKE_LIBS') ? (Project('TMAKE_LIBS') . " ") : "";
158 $project{"VC_LINK_RELEASE"} = $vc_base_libs . $tmake_libs . $vc_link_release;
159 $project{"VC_LINK_DEBUG"} = $vc_base_libs . $tmake_libs . $vc_link_debug;
161 $vc_cpp_opt_common1 = '/nologo /W4 ';
163 $vc_cpp_opt_release = $vc_cpp_opt_common1 . '/O2 ';
164 $vc_cpp_opt_debug = $vc_cpp_opt_common1 . '/Zi /Od ';
165 $vc_cpp_opt_common = '/YX /FD /c';
166 $project{"VC_BASE_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_cpp_def_release . $vc_cpp_opt_common;
167 $project{"VC_BASE_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_cpp_def_debug . $vc_cpp_opt_common;
168 ExpandGlue("INCPATH",'/I "','" /I "','"');
169 if ( $text ne "" ) { $vc_inc = $text . " "; $text = ""; } else { $vc_inc = ""; }
170 ExpandGlue("DEFINES",'/D "','" /D "','"');
171 if ( $text ne "" ) { $vc_def = $text . " "; $text = ""; } else { $vc_def = ""; }
172 if ( Config("wx") ) {
173 #! define wxWindows compilation flags
174 $vc_def .= '/D WIN32 /D WINVER=0x400 /D _MT ';
176 if ( Config("wxbase") ) {
177 $vc_def .= '/D wxUSE_GUI=0 ';
178 $vc_inc_debug .= "/I$WXDIR\\lib\\based ";
179 $vc_inc_release .= "/I$WXDIR\\lib\\base ";
182 $vc_def .= '/D wxUSE_GUI=1 ';
184 if ( Config("wxuniv") ) {
185 $vc_def .= '/D "__WXUNIVERSAL__" ';
187 $vc_inc_debug .= "/I$WXDIR\\lib\\univd ";
188 $vc_inc_release .= "/I$WXDIR\\lib\\univ ";
191 $vc_inc_debug .= "/I$WXDIR\\lib\\mswd ";
192 $vc_inc_release .= "/I$WXDIR\\lib\\msw ";
198 $vc_inc_release = "";
201 $project{"VC_CPP_INCLUDE"} = $vc_inc;
202 $project{"VC_CPP_RELEASE"} = $vc_cpp_opt_release . $vc_inc . $vc_inc_release . $vc_cpp_def_release . $vc_def . $vc_cpp_opt_common;
203 $project{"VC_CPP_DEBUG"} = $vc_cpp_opt_debug . $vc_inc . $vc_inc_debug . $vc_cpp_def_debug . $vc_def . $vc_cpp_opt_common;
205 if ( Project('RES_FILE') ) {
206 tmake_error(".res files are not supported, use .rc.");
209 $project{"MAKEFILE"} = $project{"PROJECT"} . ".mak";
210 $project{"TARGETAPP"} = $project{"TARGET"} . ".exe";
211 Project('TMAKE_FILETAGS = HEADERS SOURCES TARGET DESTDIR $$FILETAGS');
212 foreach ( split(/\s/,Project('TMAKE_FILETAGS')) ) {
213 $project{$_} =~ s-/-\\-g;
216 if ( defined($project{"DESTDIR"}) ) {
217 $project{"TARGETAPP"} = $project{"DESTDIR"} . "\\" . $project{"TARGETAPP"};
218 $project{"TARGETAPP"} =~ s/\\+/\\/g;
221 @files = split(/\s+/,$project{"HEADERS"});
222 foreach ( @files ) { $all_files{$_} = "h" };
223 @files = split(/\s+/,$project{"SOURCES"});
224 foreach ( @files ) { $all_files{$_} = "s" };
225 @files = split(/\s+/,$project{"RC_FILE"});
226 foreach ( @files ) { $all_files{$_} = "r" };
229 foreach $f ( %all_files ) {
232 $file_names{$n} = $f;
233 $file_path{$n} = ".\\" . $f;
234 $file_path2{$n} = (($f =~ /^\./) ? "" : ".\\") . $f;
238 # Microsoft Developer Studio Project File - #$ Substitute('Name="$$TARGET" - Package Owner=<4>');
239 # Microsoft Developer Studio Generated Build File, Format Version 6.00
242 # TARGTYPE #$ Substitute('"$$VC_PROJ_TYPE" $$VC_PROJ_CODE');
244 CFG=#$ Substitute('$$TARGET - Win32 Debug');
245 !MESSAGE This is not a valid makefile. To build this project using NMAKE,
246 !MESSAGE use the Export Makefile command and run
248 !MESSAGE NMAKE /f "#$ ExpandGlue('MAKEFILE','','','".');
250 !MESSAGE You can specify a configuration when running NMAKE
251 !MESSAGE by defining the macro CFG on the command line. For example:
253 !MESSAGE NMAKE /f #$ Substitute('"$$MAKEFILE" CFG="$$TARGET - Win32 Debug"');
255 !MESSAGE Possible choices for configuration are:
257 !MESSAGE #$ Substitute('"$$TARGET - Win32 Release" (based on "$$VC_PROJ_TYPE")');
258 !MESSAGE #$ Substitute('"$$TARGET - Win32 Debug" (based on "$$VC_PROJ_TYPE")');
262 # PROP Scc_ProjName ""
263 # PROP Scc_LocalPath ""
265 #$ Config("windows") && ($text='MTL=midl.exe');
268 !IF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Release"');
270 # PROP BASE Use_MFC 0
271 # PROP BASE Use_Debug_Libraries 0
272 # PROP BASE Output_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
273 # PROP BASE Intermediate_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
274 # PROP BASE Target_Dir ""
276 # PROP Use_Debug_Libraries 0
277 # PROP Output_Dir #$ $text = "\"${KIND}Release$UNICODE$DLL\""
278 # PROP Intermediate_Dir #$ $text = "${KIND}Release$UNICODE$DLL\""
279 #$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
281 # ADD BASE CPP #$ Expand("VC_BASE_CPP_RELEASE");
282 # ADD CPP #$ Expand("VC_CPP_RELEASE");
283 #$ Config("windows") || DisableOutput();
284 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
285 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
286 #$ Config("windows") || EnableOutput();
287 # ADD BASE RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE");
288 # ADD RSC /l 0x409 /d "NDEBUG" #$ Expand("VC_CPP_INCLUDE");
290 # ADD BASE BSC32 /nologo
293 # ADD BASE LINK32 #$ Expand("VC_BASE_LINK_RELEASE");
294 # ADD LINK32 #$ Expand("VC_LINK_RELEASE");
296 !ELSEIF "$(CFG)" == #$ Substitute('"$$TARGET - Win32 Debug"');
298 # PROP BASE Use_MFC 0
299 # PROP BASE Use_Debug_Libraries 1
300 # PROP BASE Output_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
301 # PROP BASE Intermediate_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
302 # PROP BASE Target_Dir ""
304 # PROP Use_Debug_Libraries 1
305 # PROP Output_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
306 # PROP Intermediate_Dir #$ $text = "\"${KIND}Debug$UNICODE$DLL\""
307 #$ Config("windows") && ($text='# PROP Ignore_Export_Lib 0');
309 # ADD BASE CPP #$ Expand("VC_BASE_CPP_DEBUG");
310 # ADD CPP #$ Expand("VC_CPP_DEBUG");
311 #$ Config("windows") || DisableOutput();
312 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
313 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
314 #$ Config("windows") || EnableOutput();
315 # ADD BASE RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE");
316 # ADD RSC /l 0x409 /d "_DEBUG" #$ Expand("VC_CPP_INCLUDE");
318 # ADD BASE BSC32 /nologo
321 # ADD BASE LINK32 #$ Expand("VC_BASE_LINK_DEBUG");
322 # ADD LINK32 #$ Expand("VC_LINK_DEBUG");
328 # Name #$Substitute('"$$TARGET - Win32 Release"');
329 # Name #$Substitute('"$$TARGET - Win32 Debug"');
331 foreach $n ( sort keys %file_names ) {
332 $f = $file_names{$n};
335 if ( $t eq "s" || $t eq "h" || $t eq "r" ) {
336 $text .= "# Begin Source File\n\nSOURCE=$file_path{$n}\n";
337 $text .= "# End Source File\n";
344 #! vi: set sta ts=8 sw=4 noet nolist tw=0 ft=make: