More regexp documentation
[p5sagit/p5-mst-13.2.git] / win32 / makefile.mk
1 #
2 # Makefile to build perl on Windows NT using DMAKE.
3 # Supported compilers:
4 #       Visual C++ 2.0 through 7.0 (and possibly newer versions)
5 #       Borland C++ 5.02 or better
6 #       MinGW with gcc-2.95.2 or better
7 #       MS Platform SDK 64-bit compiler and tools **experimental**
8 #
9 # This is set up to build a perl.exe that runs off a shared library
10 # (perl59.dll).  Also makes individual DLLs for the XS extensions.
11 #
12
13 ##
14 ## Make sure you read README.win32 *before* you mess with anything here!
15 ##
16
17 ##
18 ## Build configuration.  Edit the values below to suit your needs.
19 ##
20
21 #
22 # Set these to wherever you want "dmake install" to put your
23 # newly built perl.
24 #
25 INST_DRV        *= c:
26 INST_TOP        *= $(INST_DRV)\perl
27
28 #
29 # Comment this out if you DON'T want your perl installation to be versioned.
30 # This means that the new installation will overwrite any files from the
31 # old installation at the same INST_TOP location.  Leaving it enabled is
32 # the safest route, as perl adds the extra version directory to all the
33 # locations it installs files to.  If you disable it, an alternative
34 # versioned installation can be obtained by setting INST_TOP above to a
35 # path that includes an arbitrary version string.
36 #
37 #INST_VER       *= \5.9.5
38
39 #
40 # Comment this out if you DON'T want your perl installation to have
41 # architecture specific components.  This means that architecture-
42 # specific files will be installed along with the architecture-neutral
43 # files.  Leaving it enabled is safer and more flexible, in case you
44 # want to build multiple flavors of perl and install them together in
45 # the same location.  Commenting it out gives you a simpler
46 # installation that is easier to understand for beginners.
47 #
48 #INST_ARCH      *= \$(ARCHNAME)
49
50 #
51 # Uncomment this if you want perl to run
52 #       $Config{sitelibexp}\sitecustomize.pl
53 # before anything else.  This script can then be set up, for example,
54 # to add additional entries to @INC.
55 #
56 #USE_SITECUST   *= define
57
58 #
59 # uncomment to enable multiple interpreters.  This is need for fork()
60 # emulation and for thread support.
61 #
62 USE_MULTI       *= define
63
64 #
65 # Interpreter cloning/threads; now reasonably complete.
66 # This should be enabled to get the fork() emulation.  
67 # This needs USE_MULTI above.
68 #
69 USE_ITHREADS    *= define
70
71 #
72 # uncomment to enable the implicit "host" layer for all system calls
73 # made by perl.  This needs USE_MULTI above.  
74 # This is also needed to get fork().
75 #
76 USE_IMP_SYS     *= define
77
78 #
79 # Comment out next assign to disable perl's I/O subsystem and use compiler's 
80 # stdio for IO - depending on your compiler vendor and run time library you may 
81 # then get a number of fails from make test i.e. bugs - complain to them not us ;-). 
82 # You will also be unable to take full advantage of perl5.8's support for multiple 
83 # encodings and may see lower IO performance. You have been warned.
84 USE_PERLIO      *= define
85
86 #
87 # Comment this out if you don't want to enable large file support for
88 # some reason.  Should normally only be changed to maintain compatibility
89 # with an older release of perl.
90 USE_LARGE_FILES *= define
91
92 #
93 # uncomment exactly one of the following
94 #
95 # Visual C++ 2.x
96 #CCTYPE         *= MSVC20
97 # Visual C++ > 2.x and < 6.x
98 #CCTYPE         *= MSVC
99 # Visual C++ 6.x (aka Visual C++ 98)
100 #CCTYPE         *= MSVC60
101 # Visual C++ Toolkit 2003 (aka Visual C++ 7.x) (free command-line tools)
102 #CCTYPE         *= MSVC70FREE
103 # Visual C++ .NET 2003 (aka Visual C++ 7.x) (full version)
104 #CCTYPE         *= MSVC70
105 # Visual C++ 2005 Express Edition (aka Visual C++ 8.x) (free version)
106 #CCTYPE         *= MSVC80FREE
107 # Visual C++ 2005 (aka Visual C++ 8.x) (full version)
108 #CCTYPE         *= MSVC80
109 # Borland 5.02 or later
110 #CCTYPE         *= BORLAND
111 # MinGW with gcc-2.95.2 or later
112 CCTYPE          *= GCC
113
114 #
115 # uncomment this if your Borland compiler is older than v5.4.
116 #BCCOLD         *= define
117 #
118 # uncomment this if you want to use Borland's VCL as your CRT
119 #BCCVCL         *= define
120
121 #
122 # uncomment this if you are compiling under Windows 95/98 and command.com
123 # (not needed if you're running under 4DOS/NT 6.01 or later)
124 #IS_WIN95       *= define
125
126 #
127 # uncomment next line if you want debug version of perl (big,slow)
128 # If not enabled, we automatically try to use maximum optimization
129 # with all compilers that are known to have a working optimizer.
130 #
131 #CFG            *= Debug
132
133 #
134 # uncomment to enable use of PerlCRT.DLL when using the Visual C compiler.
135 # It has patches that fix known bugs in older versions of MSVCRT.DLL.
136 # This currently requires VC 5.0 with Service Pack 3 or later.
137 # Get it from CPAN at http://www.cpan.org/authors/id/D/DO/DOUGL/
138 # and follow the directions in the package to install.
139 #
140 # Not recommended if you have VC 6.x and you're not running Windows 9x.
141 #
142 #USE_PERLCRT    *= define
143
144 #
145 # uncomment to enable linking with setargv.obj under the Visual C
146 # compiler. Setting this options enables perl to expand wildcards in
147 # arguments, but it may be harder to use alternate methods like
148 # File::DosGlob that are more powerful.  This option is supported only with
149 # Visual C.
150 #
151 #USE_SETARGV    *= define
152
153 #
154 # if you want to have the crypt() builtin function implemented, leave this or
155 # CRYPT_LIB uncommented.  The fcrypt.c file named here contains a suitable
156 # version of des_fcrypt().
157 #
158 CRYPT_SRC       *= fcrypt.c
159
160 #
161 # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
162 # library, uncomment this, and make sure the library exists (see README.win32)
163 # Specify the full pathname of the library.
164 #
165 #CRYPT_LIB      *= fcrypt.lib
166
167 #
168 # set this if you wish to use perl's malloc
169 # WARNING: Turning this on/off WILL break binary compatibility with extensions
170 # you may have compiled with/without it.  Be prepared to recompile all
171 # extensions if you change the default.  Currently, this cannot be enabled
172 # if you ask for USE_IMP_SYS above.
173 #
174 #PERL_MALLOC    *= define
175
176 #
177 # set this to enable debugging mstats
178 # This must be enabled to use the Devel::Peek::mstat() function.  This cannot
179 # be enabled without PERL_MALLOC as well.
180 #
181 #DEBUG_MSTATS   *= define
182
183 #
184 # set the install locations of the compiler include/libraries
185 # Running VCVARS32.BAT is *required* when using Visual C.
186 # Some versions of Visual C don't define MSVCDIR in the environment,
187 # so you may have to set CCHOME explicitly (spaces in the path name should
188 # not be quoted)
189 #
190 .IF "$(CCTYPE)" == "BORLAND"
191 CCHOME          *= C:\Borland\BCC55
192 .ELIF "$(CCTYPE)" == "GCC"
193 CCHOME          *= C:\MinGW
194 .ELSE
195 CCHOME          *= $(MSVCDIR)
196 .ENDIF
197 CCINCDIR        *= $(CCHOME)\include
198 CCLIBDIR        *= $(CCHOME)\lib
199
200 #
201 # Additional compiler flags can be specified here.
202 #
203 BUILDOPT        *= $(BUILDOPTEXTRA)
204
205 #
206 # Adding -DPERL_HASH_SEED_EXPLICIT will disable randomization of Perl's
207 # internal hash function unless the PERL_HASH_SEED environment variable is set.
208 # Alternatively, adding -DNO_HASH_SEED will completely disable the
209 # randomization feature. 
210 # The latter is required to maintain binary compatibility with Perl 5.8.0.
211 #
212 #BUILDOPT       += -DPERL_HASH_SEED_EXPLICIT
213 #BUILDOPT       += -DNO_HASH_SEED
214
215 #
216 # This should normally be disabled.  Adding -DPERL_POLLUTE enables support
217 # for old symbols by default, at the expense of extreme pollution.  You most
218 # probably just want to build modules that won't compile with
219 #         perl Makefile.PL POLLUTE=1
220 # instead of enabling this.  Please report such modules to the respective
221 # authors.
222 #
223 #BUILDOPT       += -DPERL_POLLUTE
224
225 #
226 # This should normally be disabled.  Enabling it will disable the File::Glob
227 # implementation of CORE::glob.
228 #
229 #BUILDOPT       += -DPERL_EXTERNAL_GLOB
230
231 #
232 # This should normally be disabled.  Enabling it causes perl to read scripts
233 # in text mode (which is the 5.005 behavior) and will break ByteLoader.
234 #
235 #BUILDOPT       += -DPERL_TEXTMODE_SCRIPTS
236
237 #
238 # specify semicolon-separated list of extra directories that modules will
239 # look for libraries (spaces in path names need not be quoted)
240 #
241 EXTRALIBDIRS    *=
242
243 #
244 # set this to point to cmd.exe (only needed if you use some
245 # alternate shell that doesn't grok cmd.exe style commands)
246 #
247 #SHELL          *= g:\winnt\system32\cmd.exe
248
249 #
250 # set this to your email address (perl will guess a value from
251 # from your loginname and your hostname, which may not be right)
252 #
253 #EMAIL          *=
254
255 ##
256 ## Build configuration ends.
257 ##
258
259 ##################### CHANGE THESE ONLY IF YOU MUST #####################
260
261 .IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
262 D_CRYPT         = undef
263 .ELSE
264 D_CRYPT         = define
265 CRYPT_FLAG      = -DHAVE_DES_FCRYPT
266 .ENDIF
267
268 PERL_MALLOC     *= undef
269 DEBUG_MSTATS    *= undef
270
271 USE_SITECUST    *= undef
272 USE_MULTI       *= undef
273 USE_ITHREADS    *= undef
274 USE_IMP_SYS     *= undef
275 USE_PERLIO      *= undef
276 USE_LARGE_FILES *= undef
277 USE_PERLCRT     *= undef
278
279 .IF "$(USE_IMP_SYS)" == "define"
280 PERL_MALLOC     = undef
281 .ENDIF
282
283 .IF "$(PERL_MALLOC)" == "undef"
284 DEBUG_MSTATS    = undef
285 .ENDIF
286
287 .IF "$(DEBUG_MSTATS)" == "define"
288 BUILDOPT        += -DPERL_DEBUGGING_MSTATS
289 .ENDIF
290
291 .IF "$(USE_IMP_SYS) $(USE_MULTI)" == "define undef"
292 USE_MULTI       != define
293 .ENDIF
294
295 .IF "$(USE_ITHREADS) $(USE_MULTI)" == "define undef"
296 USE_MULTI       != define
297 .ENDIF
298
299 .IF "$(USE_SITECUST)" == "define"
300 BUILDOPT        += -DUSE_SITECUSTOMIZE
301 .ENDIF
302
303 .IF "$(USE_MULTI)" != "undef"
304 BUILDOPT        += -DPERL_IMPLICIT_CONTEXT
305 .ENDIF
306
307 .IF "$(USE_IMP_SYS)" != "undef"
308 BUILDOPT        += -DPERL_IMPLICIT_SYS
309 .ENDIF
310
311 .IMPORT .IGNORE : PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITEW6432
312
313 PROCESSOR_ARCHITECTURE *= x86
314
315 .IF "$(WIN64)" == ""
316 # When we are running from a 32bit cmd.exe on AMD64 then
317 # PROCESSOR_ARCHITECTURE is set to x86 and PROCESSOR_ARCHITEW6432
318 # is set to AMD64
319 .IF "$(PROCESSOR_ARCHITEW6432)" != ""
320 PROCESSOR_ARCHITECTURE  != $(PROCESSOR_ARCHITEW6432)
321 WIN64                   = define
322 .ELIF "$(PROCESSOR_ARCHITECTURE)" == "AMD64" || "$(PROCESSOR_ARCHITECTURE)" == "IA64"
323 WIN64                   = define
324 .ELSE
325 WIN64                   = undef
326 .ENDIF
327 .ENDIF
328
329 ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
330 .IF "$(ARCHITECTURE)" == "AMD64"
331 ARCHITECTURE    = x64
332 .ENDIF
333 .IF "$(ARCHITECTURE)" == "IA64"
334 ARCHITECTURE    = ia64
335 .ENDIF
336
337 .IF "$(USE_MULTI)" == "define"
338 ARCHNAME        = MSWin32-$(ARCHITECTURE)-multi
339 .ELSE
340 .IF "$(USE_PERLIO)" == "define"
341 ARCHNAME        = MSWin32-$(ARCHITECTURE)-perlio
342 .ELSE
343 ARCHNAME        = MSWin32-$(ARCHITECTURE)
344 .ENDIF
345 .ENDIF
346
347 .IF "$(USE_ITHREADS)" == "define"
348 ARCHNAME        !:= $(ARCHNAME)-thread
349 .ENDIF
350
351 # Visual C++ 98, .NET 2003 and 2005 specific.
352 # VC++ 6.x, 7.x and 8.x can load DLL's on demand.  Makes the test suite run in
353 # about 10% less time.  (The free version of 7.x can't do this, but the free
354 # version of 8.x can.)
355 .IF "$(CCTYPE)" == "MSVC60" || "$(CCTYPE)" == "MSVC70" \
356     "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC80FREE"
357 DELAYLOAD       *= -DELAYLOAD:ws2_32.dll -DELAYLOAD:shell32.dll delayimp.lib
358 .ENDIF
359
360 ARCHDIR         = ..\lib\$(ARCHNAME)
361 COREDIR         = ..\lib\CORE
362 AUTODIR         = ..\lib\auto
363 LIBDIR          = ..\lib
364 EXTDIR          = ..\ext
365 PODDIR          = ..\pod
366 EXTUTILSDIR     = $(LIBDIR)\ExtUtils
367 HTMLDIR         = .\html
368
369 #
370 INST_SCRIPT     = $(INST_TOP)$(INST_VER)\bin
371 INST_BIN        = $(INST_SCRIPT)$(INST_ARCH)
372 INST_LIB        = $(INST_TOP)$(INST_VER)\lib
373 INST_ARCHLIB    = $(INST_LIB)$(INST_ARCH)
374 INST_COREDIR    = $(INST_ARCHLIB)\CORE
375 INST_HTML       = $(INST_TOP)$(INST_VER)\html
376
377 #
378 # Programs to compile, build .lib files and link
379 #
380
381 .USESHELL :
382
383 .IF "$(CCTYPE)" == "BORLAND"
384
385 CC              = bcc32
386 .IF "$(BCCOLD)" != "define"
387 LINK32          = ilink32
388 .ELSE
389 LINK32          = tlink32
390 .ENDIF
391 LIB32           = tlib /P128
392 IMPLIB          = implib -c
393 RSC             = brcc32
394
395 #
396 # Options
397 #
398 INCLUDES        = -I$(COREDIR) -I.\include -I. -I.. -I"$(CCINCDIR)"
399 #PCHFLAGS       = -H -Hc -H=c:\temp\bcmoduls.pch
400 DEFINES         = -DWIN32 $(CRYPT_FLAG)
401 LOCDEFS         = -DPERLDLL -DPERL_CORE
402 SUBSYS          = console
403 CXX_FLAG        = -P
404
405 LIBC            = cw32mti.lib
406
407 # same libs as MSVC, except Borland doesn't have oldnames.lib
408 LIBFILES        = $(CRYPT_LIB) \
409                 kernel32.lib user32.lib gdi32.lib winspool.lib \
410                 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
411                 netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \
412                 version.lib odbc32.lib odbccp32.lib \
413                 import32.lib $(LIBC)
414
415 .IF  "$(CFG)" == "Debug"
416 OPTIMIZE        = -v -D_RTLDLL -DDEBUGGING
417 LINK_DBG        = -v
418 .ELSE
419 OPTIMIZE        = -O2 -D_RTLDLL
420 LINK_DBG        =
421 .ENDIF
422
423 EXTRACFLAGS     =
424 CFLAGS          = -w -g0 -tWM -tWD $(INCLUDES) $(DEFINES) $(LOCDEFS) \
425                 $(PCHFLAGS) $(OPTIMIZE)
426 LINK_FLAGS      = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)" \
427                 -L"$(CCLIBDIR)\PSDK"
428 OBJOUT_FLAG     = -o
429 EXEOUT_FLAG     = -e
430 LIBOUT_FLAG     =
431 .IF "$(BCCOLD)" != "define"
432 LINK_FLAGS      += -Gn
433 DEFINES  += -D_MT -D__USELOCALES__ -D_WIN32_WINNT=0x0410
434 .END
435 .IF "$(BCCVCL)" == "define"
436 LIBC            = cp32mti.lib vcl.lib vcl50.lib vclx50.lib vcle50.lib
437 LINK_FLAGS      += -L"$(CCLIBDIR)\Release"
438 .END
439
440
441 .ELIF "$(CCTYPE)" == "GCC"
442
443 CC              = gcc
444 LINK32          = g++
445 LIB32           = ar rc
446 IMPLIB          = dlltool
447 RSC             = windres
448
449 i = .i
450 o = .o
451 a = .a
452
453 #
454 # Options
455 #
456
457 INCLUDES        = -I.\include -I. -I.. -I$(COREDIR)
458 DEFINES         = -DWIN32 $(CRYPT_FLAG)
459 LOCDEFS         = -DPERLDLL -DPERL_CORE
460 SUBSYS          = console
461 CXX_FLAG        = -xc++
462
463 LIBC            = -lmsvcrt
464
465 # same libs as MSVC
466 LIBFILES        = $(CRYPT_LIB) $(LIBC) \
467                   -lmoldname -lkernel32 -luser32 -lgdi32 \
468                   -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 \
469                   -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr \
470                   -lwinmm -lversion -lodbc32 -lodbccp32
471
472 .IF  "$(CFG)" == "Debug"
473 OPTIMIZE        = -g -O2 -DDEBUGGING
474 LINK_DBG        = -g
475 .ELSE
476 OPTIMIZE        = -s -O2
477 LINK_DBG        = -s
478 .ENDIF
479
480 EXTRACFLAGS     =
481 CFLAGS          = $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE)
482 LINK_FLAGS      = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)"
483 OBJOUT_FLAG     = -o
484 EXEOUT_FLAG     = -o
485 LIBOUT_FLAG     =
486
487 # NOTE: we assume that GCC uses MSVCRT.DLL
488 BUILDOPT        += -fno-strict-aliasing -DPERL_MSVCRT_READFIX
489
490 .ELSE
491
492 CC              = cl
493 LINK32          = link
494 LIB32           = $(LINK32) -lib
495 RSC             = rc
496
497 #
498 # Options
499 #
500
501 INCLUDES        = -I$(COREDIR) -I.\include -I. -I..
502 #PCHFLAGS       = -Fpc:\temp\vcmoduls.pch -YX
503 DEFINES         = -DWIN32 -D_CONSOLE -DNO_STRICT $(CRYPT_FLAG)
504 LOCDEFS         = -DPERLDLL -DPERL_CORE
505 SUBSYS          = console
506 CXX_FLAG        = -TP -GX
507
508 .IF "$(USE_PERLCRT)" != "define"
509 LIBC    = msvcrt.lib
510 .ELSE
511 LIBC    = PerlCRT.lib
512 .ENDIF
513
514 .IF  "$(CFG)" == "Debug"
515 .IF "$(CCTYPE)" == "MSVC20"
516 OPTIMIZE        = -Od -MD -Z7 -DDEBUGGING
517 .ELSE
518 OPTIMIZE        = -O1 -MD -Zi -DDEBUGGING
519 .ENDIF
520 LINK_DBG        = -debug
521 .ELSE
522 OPTIMIZE        = -MD -Zi -DNDEBUG
523 # we enable debug symbols in release builds also
524 LINK_DBG        = -debug -opt:ref,icf
525 # you may want to enable this if you want COFF symbols in the executables
526 # in addition to the PDB symbols.  The default Dr. Watson that ships with
527 # Windows can use the the former but not latter.  The free WinDbg can be
528 # installed to get better stack traces from just the PDB symbols, so we
529 # avoid the bloat of COFF symbols by default.
530 #LINK_DBG       = $(LINK_DBG) -debugtype:both
531 .IF "$(WIN64)" == "define"
532 # enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG)
533 OPTIMIZE        += -Ox -GL
534 LINK_DBG        += -ltcg
535 .ELSE
536 # -O1 yields smaller code, which turns out to be faster than -O2 on x86
537 OPTIMIZE        += -O1
538 #OPTIMIZE       += -O2
539 .ENDIF
540 .ENDIF
541
542 .IF "$(WIN64)" == "define"
543 DEFINES         += -DWIN64 -DCONSERVATIVE
544 OPTIMIZE        += -Wp64 -fp:precise
545 .ENDIF
546
547 .IF "$(USE_PERLCRT)" != "define"
548 BUILDOPT        += -DPERL_MSVCRT_READFIX
549 .ENDIF
550
551 LIBBASEFILES    = $(CRYPT_LIB) \
552                 oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
553                 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
554                 netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \
555                 version.lib odbc32.lib odbccp32.lib
556
557 # The 64 bit Platform SDK compilers contain a runtime library that doesn't
558 # include the buffer overrun verification code used by the /GS switch.
559 # Since the code links against libraries that are compiled with /GS, this
560 # "security cookie verification" must be included via bufferoverlow.lib.
561 .IF "$(WIN64)" == "define"
562 LIBBASEFILES    = $(LIBBASEFILES) bufferoverflowU.lib
563 .ENDIF
564
565 # we add LIBC here, since we may be using PerlCRT.dll
566 LIBFILES        = $(LIBBASEFILES) $(LIBC)
567
568 EXTRACFLAGS     = -nologo -GF -W3
569 CFLAGS          = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
570                 $(PCHFLAGS) $(OPTIMIZE)
571 LINK_FLAGS      = -nologo -nodefaultlib $(LINK_DBG) \
572                 -libpath:"$(INST_COREDIR)" \
573                 -machine:$(PROCESSOR_ARCHITECTURE)
574 OBJOUT_FLAG     = -Fo
575 EXEOUT_FLAG     = -Fe
576 LIBOUT_FLAG     = /out:
577
578 .ENDIF
579
580 CFLAGS_O        = $(CFLAGS) $(BUILDOPT)
581
582 # used to allow local linking flags that are not propogated into Config.pm,
583 # currently unused
584 #   -- BKS, 12-12-1999
585 PRIV_LINK_FLAGS *=
586 BLINK_FLAGS     = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
587
588 #################### do not edit below this line #######################
589 ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
590
591 # Some dmake's built with Borland C++, including Sarathy's one at:
592 # http://search.cpan.org/CPAN/authors/id/G/GS/GSAR/dmake-4.1pl1-win32.zip
593 # require backslashes to be doubled-up when written to $(mktmp) files.
594 # Other dmake's do not require this and would actually output a double
595 # backslash if they were doubled-up.
596 .IF "$(shell @type $(mktmp \\))"=="\\"
597 B=\\
598 .ELSE
599 B=\\\
600 .ENDIF
601
602 # There is a related issue with other escape sequences: Sarathy's old
603 # dmake automatically maps escape sequences like \n to their ASCII values
604 # when used in macros, while other dmake's only do so if this behaviour
605 # is explicitly requested with the :m modifier.
606 DONTUSETHIS=\n
607 .IF "$(shell @type $(mktmp \n))"=="\n"
608 N=$(DONTUSETHIS:m)
609 .ELSE
610 N=$(DONTUSETHIS)
611 .ENDIF
612
613 o *= .obj
614 a *= .lib
615
616 LKPRE           = INPUT (
617 LKPOST          = )
618
619 #
620 # Rules
621 #
622
623 .SUFFIXES : .c .i $(o) .dll $(a) .exe .rc .res
624
625 .c$(o):
626         $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
627
628 .c.i:
629         $(CC) -c $(null,$(<:d) $(NULL) -I$(<:d)) $(CFLAGS_O) -E $< >$@
630
631 .y.c:
632         $(NOOP)
633
634 $(o).dll:
635 .IF "$(CCTYPE)" == "BORLAND"
636         $(LINK32) -Tpd -ap $(BLINK_FLAGS) c0d32$(o) $<,$@,,$(LIBFILES),$(*B).def
637         $(IMPLIB) $(*B).lib $@
638 .ELIF "$(CCTYPE)" == "GCC"
639         $(LINK32) -o $@ $(BLINK_FLAGS) $< $(LIBFILES)
640         $(IMPLIB) --input-def $(*B).def --output-lib $(*B).a $@
641 .ELSE
642         $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
643             -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
644 .ENDIF
645
646 .rc.res:
647 .IF "$(CCTYPE)" == "GCC"
648         $(RSC) --use-temp-file -i $< -o $@
649 .ELSE
650         $(RSC) -i.. $<
651 .ENDIF
652
653 #
654 # various targets
655 MINIPERL        = ..\miniperl.exe
656 MINIDIR         = .\mini
657 PERLEXE         = ..\perl.exe
658 WPERLEXE        = ..\wperl.exe
659 GLOBEXE         = ..\perlglob.exe
660 CONFIGPM        = ..\lib\Config.pm ..\lib\Config_heavy.pl
661 MINIMOD         = ..\lib\ExtUtils\Miniperl.pm
662 X2P             = ..\x2p\a2p.exe
663
664 # Unicode data files generated by mktables
665 UNIDATAFILES     = ..\lib\unicore\Canonical.pl ..\lib\unicore\Exact.pl \
666                    ..\lib\unicore\Properties ..\lib\unicore\Decomposition.pl \
667                    ..\lib\unicore\CombiningClass.pl ..\lib\unicore\Name.pl \
668                    ..\lib\unicore\PVA.pl
669
670 # Directories of Unicode data files generated by mktables
671 UNIDATADIR1     = ..\lib\unicore\To
672 UNIDATADIR2     = ..\lib\unicore\lib
673
674 PERLEXE_ICO     = .\perlexe.ico
675 PERLEXE_RES     = .\perlexe.res
676 PERLDLL_RES     =
677
678 # Nominate a target which causes extensions to be re-built
679 # This used to be $(PERLEXE), but at worst it is the .dll that they depend
680 # on and really only the interface - i.e. the .def file used to export symbols
681 # from the .dll
682 PERLDEP = perldll.def
683
684
685 PL2BAT          = bin\pl2bat.pl
686 GLOBBAT         = bin\perlglob.bat
687
688 UTILS           =                       \
689                 ..\utils\h2ph           \
690                 ..\utils\splain         \
691                 ..\utils\dprofpp        \
692                 ..\utils\perlbug        \
693                 ..\utils\pl2pm          \
694                 ..\utils\c2ph           \
695                 ..\utils\pstruct        \
696                 ..\utils\h2xs           \
697                 ..\utils\perldoc        \
698                 ..\utils\perlivp        \
699                 ..\utils\libnetcfg      \
700                 ..\utils\enc2xs         \
701                 ..\utils\piconv         \
702                 ..\utils\config_data    \
703                 ..\utils\corelist       \
704                 ..\utils\cpan           \
705                 ..\utils\xsubpp         \
706                 ..\utils\prove          \
707                 ..\utils\ptar           \
708                 ..\utils\ptardiff       \
709                 ..\utils\shasum         \
710                 ..\utils\instmodsh      \
711                 ..\pod\checkpods        \
712                 ..\pod\pod2html         \
713                 ..\pod\pod2latex        \
714                 ..\pod\pod2man          \
715                 ..\pod\pod2text         \
716                 ..\pod\pod2usage        \
717                 ..\pod\podchecker       \
718                 ..\pod\podselect        \
719                 ..\x2p\find2perl        \
720                 ..\x2p\psed             \
721                 ..\x2p\s2p              \
722                 bin\exetype.pl          \
723                 bin\runperl.pl          \
724                 bin\pl2bat.pl           \
725                 bin\perlglob.pl         \
726                 bin\search.pl
727
728 .IF "$(CCTYPE)" == "BORLAND"
729
730 CFGSH_TMPL      = config.bc
731 CFGH_TMPL       = config_H.bc
732
733 .ELIF "$(CCTYPE)" == "GCC"
734
735 CFGSH_TMPL      = config.gc
736 CFGH_TMPL       = config_H.gc
737 PERLIMPLIB      = ..\libperl59$(a)
738
739 .ELSE
740
741 .IF "$(WIN64)" == "define"
742 CFGSH_TMPL      = config.vc64
743 CFGH_TMPL       = config_H.vc64
744 .ELSE
745 CFGSH_TMPL      = config.vc
746 CFGH_TMPL       = config_H.vc
747 .ENDIF
748
749 .ENDIF
750
751 # makedef.pl must be updated if this changes, and this should normally
752 # only change when there is an incompatible revision of the public API.
753 PERLIMPLIB      *= ..\perl59$(a)
754 PERLDLL         = ..\perl59.dll
755
756 XCOPY           = xcopy /f /r /i /d /y
757 RCOPY           = xcopy /f /r /i /e /d /y
758 NOOP            = @rem
759
760 #
761 # filenames given to xsubpp must have forward slashes (since it puts
762 # full pathnames in #line strings)
763 XSUBPP          = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \
764                 -C++ -prototypes
765
766 MICROCORE_SRC   =               \
767                 ..\av.c         \
768                 ..\deb.c        \
769                 ..\doio.c       \
770                 ..\doop.c       \
771                 ..\dump.c       \
772                 ..\globals.c    \
773                 ..\gv.c         \
774                 ..\hv.c         \
775                 ..\locale.c     \
776                 ..\mathoms.c    \
777                 ..\mg.c         \
778                 ..\numeric.c    \
779                 ..\op.c         \
780                 ..\pad.c        \
781                 ..\perl.c       \
782                 ..\perlapi.c    \
783                 ..\perly.c      \
784                 ..\pp.c         \
785                 ..\pp_ctl.c     \
786                 ..\pp_hot.c     \
787                 ..\pp_pack.c    \
788                 ..\pp_sort.c    \
789                 ..\pp_sys.c     \
790                 ..\reentr.c     \
791                 ..\regcomp.c    \
792                 ..\regexec.c    \
793                 ..\run.c        \
794                 ..\scope.c      \
795                 ..\sv.c         \
796                 ..\taint.c      \
797                 ..\toke.c       \
798                 ..\universal.c  \
799                 ..\utf8.c       \
800                 ..\util.c       \
801                 ..\xsutils.c
802
803 EXTRACORE_SRC   += perllib.c
804
805 .IF "$(PERL_MALLOC)" == "define"
806 EXTRACORE_SRC   += ..\malloc.c
807 .ENDIF
808
809 EXTRACORE_SRC   += ..\perlio.c
810
811 WIN32_SRC       =               \
812                 .\win32.c       \
813                 .\win32sck.c    \
814                 .\win32thread.c
815
816 # We need this for miniperl build unless we override canned 
817 # config.h #define building mini\*
818 #.IF "$(USE_PERLIO)" == "define"
819 WIN32_SRC       += .\win32io.c
820 #.ENDIF
821
822 .IF "$(CRYPT_SRC)" != ""
823 WIN32_SRC       += .\$(CRYPT_SRC)
824 .ENDIF
825
826 DLL_SRC         = $(DYNALOADER).c
827
828 X2P_SRC         =               \
829                 ..\x2p\a2p.c    \
830                 ..\x2p\hash.c   \
831                 ..\x2p\str.c    \
832                 ..\x2p\util.c   \
833                 ..\x2p\walk.c
834
835 CORE_NOCFG_H    =               \
836                 ..\av.h         \
837                 ..\cop.h        \
838                 ..\cv.h         \
839                 ..\dosish.h     \
840                 ..\embed.h      \
841                 ..\form.h       \
842                 ..\gv.h         \
843                 ..\handy.h      \
844                 ..\hv.h         \
845                 ..\iperlsys.h   \
846                 ..\mg.h         \
847                 ..\nostdio.h    \
848                 ..\op.h         \
849                 ..\opcode.h     \
850                 ..\perl.h       \
851                 ..\perlapi.h    \
852                 ..\perlsdio.h   \
853                 ..\perlsfio.h   \
854                 ..\perly.h      \
855                 ..\pp.h         \
856                 ..\proto.h      \
857                 ..\regcomp.h    \
858                 ..\regexp.h     \
859                 ..\scope.h      \
860                 ..\sv.h         \
861                 ..\thread.h     \
862                 ..\unixish.h    \
863                 ..\utf8.h       \
864                 ..\util.h       \
865                 ..\warnings.h   \
866                 ..\XSUB.h       \
867                 ..\EXTERN.h     \
868                 ..\perlvars.h   \
869                 ..\intrpvar.h   \
870                 ..\thrdvar.h    \
871                 .\include\dirent.h      \
872                 .\include\netdb.h       \
873                 .\include\sys\socket.h  \
874                 .\win32.h
875
876 CORE_H          = $(CORE_NOCFG_H) .\config.h
877
878 MICROCORE_OBJ   = $(MICROCORE_SRC:db:+$(o))
879 CORE_OBJ        = $(MICROCORE_OBJ) $(EXTRACORE_SRC:db:+$(o))
880 WIN32_OBJ       = $(WIN32_SRC:db:+$(o))
881 MINICORE_OBJ    = $(MINIDIR)\{$(MICROCORE_OBJ:f) miniperlmain$(o) perlio$(o)}
882 MINIWIN32_OBJ   = $(MINIDIR)\{$(WIN32_OBJ:f)}
883 MINI_OBJ        = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
884 DLL_OBJ         = $(DLL_SRC:db:+$(o))
885 X2P_OBJ         = $(X2P_SRC:db:+$(o))
886
887 PERLDLL_OBJ     = $(CORE_OBJ)
888 PERLEXE_OBJ     = perlmain$(o)
889
890 PERLDLL_OBJ     += $(WIN32_OBJ) $(DLL_OBJ)
891
892 .IF "$(USE_SETARGV)" != ""
893 SETARGV_OBJ     = setargv$(o)
894 .ENDIF
895
896 DYNAMIC_EXT     = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \
897                 Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob \
898                 Sys/Hostname Storable Filter/Util/Call Encode \
899                 Digest/MD5 Digest/SHA PerlIO/scalar MIME/Base64 Time/HiRes \
900                 Unicode/Normalize Math/BigInt/FastCalc Compress/Zlib Win32 \
901                 Win32API/File
902 STATIC_EXT      = 
903 NONXS_EXT       = Errno
904
905 DYNALOADER      = $(EXTDIR)\DynaLoader\DynaLoader
906
907 # vars must be separated by "\t+~\t+", since we're using the tempfile
908 # version of config_sh.pl (we were overflowing someone's buffer by
909 # trying to fit them all on the command line)
910 #       -- BKS 10-17-1999
911 CFG_VARS        =                                       \
912                 INST_DRV=$(INST_DRV)            ~       \
913                 INST_TOP=$(INST_TOP:s,\,$B,)    ~       \
914                 INST_VER=$(INST_VER:s,\,$B,)    ~       \
915                 INST_ARCH=$(INST_ARCH)          ~       \
916                 archname=$(ARCHNAME)            ~       \
917                 cc=$(CC)                        ~       \
918                 ld=$(LINK32)                    ~       \
919                 ccflags=$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT)       ~       \
920                 cf_email=$(EMAIL)               ~       \
921                 d_crypt=$(D_CRYPT)              ~       \
922                 d_mymalloc=$(PERL_MALLOC)       ~       \
923                 libs=$(LIBFILES:f)              ~       \
924                 incpath=$(CCINCDIR:s,\,$B,)     ~       \
925                 libperl=$(PERLIMPLIB:f)         ~       \
926                 libpth=$(CCLIBDIR:s,\,$B,);$(EXTRALIBDIRS:s,\,$B,)      ~       \
927                 libc=$(LIBC)                    ~       \
928                 make=dmake                      ~       \
929                 _o=$(o)                         ~       \
930                 obj_ext=$(o)                    ~       \
931                 _a=$(a)                         ~       \
932                 lib_ext=$(a)                    ~       \
933                 static_ext=$(STATIC_EXT)        ~       \
934                 usethreads=$(USE_ITHREADS)      ~       \
935                 useithreads=$(USE_ITHREADS)     ~       \
936                 usemultiplicity=$(USE_MULTI)    ~       \
937                 useperlio=$(USE_PERLIO)         ~       \
938                 uselargefiles=$(USE_LARGE_FILES)        ~       \
939                 usesitecustomize=$(USE_SITECUST)        ~       \
940                 LINK_FLAGS=$(LINK_FLAGS:s,\,$B,)        ~       \
941                 optimize=$(OPTIMIZE)
942
943 #
944 # set up targets varying between Win95 and WinNT builds
945 #
946
947 .IF "$(IS_WIN95)" == "define"
948 MK2             = .\makefile.95
949 RIGHTMAKE       = __switch_makefiles
950 .ELSE
951 MK2             = __not_needed
952 RIGHTMAKE       =
953 .ENDIF
954
955 .IMPORT .IGNORE : SystemRoot windir
956
957 # Don't just .IMPORT OS from the environment because dmake sets OS itself.
958 ENV_OS=$(subst,OS=, $(shell @set OS))
959
960 .IF "$(ENV_OS)" == "Windows_NT"
961 ODBCCP32_DLL = $(SystemRoot)\system32\odbccp32.dll
962 .ELSE
963 ODBCCP32_DLL = $(windir)\system\odbccp32.dll
964 .ENDIF
965
966 #
967 # Top targets
968 #
969
970 all : .\config.h $(GLOBEXE) $(MINIPERL) $(MK2)          \
971         $(RIGHTMAKE) $(MINIMOD) $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE)  \
972         $(X2P) MakePPPort Extensions
973
974 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
975
976 #----------------------------------------------------------------
977
978 #-------------------- BEGIN Win95 SPECIFIC ----------------------
979
980 # this target is a jump-off point for Win95
981 #  1. it switches to the Win95-specific makefile if it exists
982 #     (__do_switch_makefiles)
983 #  2. it prints a message when the Win95-specific one finishes (__done)
984 #  3. it then kills this makefile by trying to make __no_such_target
985
986 __switch_makefiles: __do_switch_makefiles __done __no_such_target
987
988 __do_switch_makefiles:
989 .IF "$(NOTFIRST)" != "true"
990         if exist $(MK2) $(MAKE:s/-S//) -f $(MK2) $(MAKETARGETS) NOTFIRST=true
991 .ELSE
992         $(NOOP)
993 .ENDIF
994
995 .IF "$(NOTFIRST)" != "true"
996 __done:
997         @echo Build process complete. Ignore any errors after this message.
998         @echo Run "dmake test" to test and "dmake install" to install
999
1000 .ELSE
1001 # dummy targets for Win95-specific makefile
1002
1003 __done:
1004         $(NOOP)
1005
1006 __no_such_target:
1007         $(NOOP)
1008
1009 .ENDIF
1010
1011 # This target is used to generate the new makefile (.\makefile.95) for Win95
1012
1013 .\makefile.95: .\makefile.mk
1014         $(MINIPERL) genmk95.pl makefile.mk $(MK2)
1015
1016 #--------------------- END Win95 SPECIFIC ---------------------
1017
1018 # a blank target for when builds don't need to do certain things
1019 # this target added for Win95 port but used to keep the WinNT port able to
1020 # use this file
1021 __not_needed:
1022         $(NOOP)
1023
1024 $(GLOBEXE) : perlglob$(o)
1025 .IF "$(CCTYPE)" == "BORLAND"
1026         $(CC) -c -w -v -tWM -I"$(CCINCDIR)" perlglob.c
1027         $(LINK32) -Tpe -ap $(BLINK_FLAGS) c0x32$(o) perlglob$(o) \
1028             "$(CCLIBDIR)\32BIT\wildargs$(o)",$@,,import32.lib cw32mt.lib,
1029 .ELIF "$(CCTYPE)" == "GCC"
1030         $(LINK32) $(BLINK_FLAGS) -mconsole -o $@ perlglob$(o) $(LIBFILES)
1031 .ELSE
1032         $(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
1033             perlglob$(o) setargv$(o)
1034 .ENDIF
1035
1036 perlglob$(o)  : perlglob.c
1037
1038 config.w32 : $(CFGSH_TMPL)
1039         copy $(CFGSH_TMPL) config.w32
1040
1041 .\config.h : $(CFGH_TMPL) $(CORE_NOCFG_H)
1042         -del /f config.h
1043         copy $(CFGH_TMPL) config.h
1044
1045 ..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
1046         $(MINIPERL) -I..\lib config_sh.PL --cfgsh-option-file \
1047             $(mktmp $(CFG_VARS)) config.w32 > ..\config.sh
1048
1049 # this target is for when changes to the main config.sh happen
1050 # edit config.{b,v,g}c and make this target once for each supported
1051 # compiler (e.g. `dmake CCTYPE=BORLAND regen_config_h`)
1052 regen_config_h:
1053         perl config_sh.PL --cfgsh-option-file $(mktmp $(CFG_VARS)) \
1054             $(CFGSH_TMPL) > ..\config.sh
1055         -cd .. && del /f perl.exe
1056         -cd .. && del /f perl*.dll
1057         cd .. && perl configpm
1058         -del /f $(CFGH_TMPL)
1059         -mkdir $(COREDIR)
1060         -perl config_h.PL "INST_VER=$(INST_VER)"
1061         rename config.h $(CFGH_TMPL)
1062
1063 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
1064         cd .. && miniperl configpm
1065         if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
1066         $(XCOPY) ..\*.h $(COREDIR)\*.*
1067         $(XCOPY) *.h $(COREDIR)\*.*
1068         $(XCOPY) ..\ext\re\re.pm $(LIBDIR)\*.*
1069         $(RCOPY) include $(COREDIR)\*.*
1070         $(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
1071             || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
1072
1073 $(MINIPERL) : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS)
1074 .IF "$(CCTYPE)" == "BORLAND"
1075         if not exist $(CCLIBDIR)\PSDK\odbccp32.lib \
1076             cd $(CCLIBDIR)\PSDK && implib odbccp32.lib $(ODBCCP32_DLL)
1077         $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
1078             @$(mktmp c0x32$(o) $(MINI_OBJ:s,\,$B,),$(@:s,\,$B,),,$(LIBFILES),)
1079 .ELIF "$(CCTYPE)" == "GCC"
1080         $(LINK32) -v -mconsole -o $@ $(BLINK_FLAGS) \
1081             $(mktmp $(LKPRE) $(MINI_OBJ:s,\,$B,) $(LIBFILES) $(LKPOST))
1082 .ELSE
1083         $(LINK32) -subsystem:console -out:$@ \
1084             @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(MINI_OBJ:s,\,$B,))
1085 .ENDIF
1086
1087 $(MINIDIR) :
1088         if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
1089
1090 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
1091         $(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB $(OBJOUT_FLAG)$@ ..\$(*B).c
1092
1093 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
1094         $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*B).c
1095
1096 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
1097 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
1098 # unless the .IF is true), so instead we use a .ELSE with the default.
1099 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
1100
1101 perllib$(o)     : perllib.c .\perlhost.h .\vdir.h .\vmem.h
1102 .IF "$(USE_IMP_SYS)" == "define"
1103         $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
1104 .ELSE
1105         $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ perllib.c
1106 .ENDIF
1107
1108 # 1. we don't want to rebuild miniperl.exe when config.h changes
1109 # 2. we don't want to rebuild miniperl.exe with non-default config.h
1110 $(MINI_OBJ)     : $(CORE_NOCFG_H)
1111
1112 $(WIN32_OBJ)    : $(CORE_H)
1113
1114 $(CORE_OBJ)     : $(CORE_H)
1115
1116 $(DLL_OBJ)      : $(CORE_H)
1117
1118 $(X2P_OBJ)      : $(CORE_H)
1119
1120 perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym ..\pp.sym ..\makedef.pl
1121         $(MINIPERL) -I..\lib buildext.pl --create-perllibst-h
1122         $(MINIPERL) -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
1123         $(BUILDOPT) CCTYPE=$(CCTYPE) > perldll.def
1124
1125 $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
1126 .IF "$(CCTYPE)" == "BORLAND"
1127         $(LINK32) -Tpd -ap $(BLINK_FLAGS) \
1128             @$(mktmp c0d32$(o) $(PERLDLL_OBJ:s,\,$B,)$N \
1129                 $@,$N \
1130                 $(subst,\,$B $(shell @type Extensions_static)) $(LIBFILES)$N \
1131                 perldll.def$N)
1132         $(IMPLIB) $*.lib $@
1133 .ELIF "$(CCTYPE)" == "GCC"
1134         $(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \
1135             $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,$B,) \
1136                 $(subst,\,$B $(shell @type Extensions_static)) \
1137                 $(LIBFILES) $(LKPOST))
1138         dlltool --output-lib $(PERLIMPLIB) \
1139                 --dllname $(PERLDLL:b).dll \
1140                 --def perldll.def \
1141                 --base-file perl.base \
1142                 --output-exp perl.exp
1143         $(LINK32) -mdll -o $@ $(BLINK_FLAGS) \
1144             $(mktmp $(LKPRE) $(PERLDLL_OBJ:s,\,$B,) \
1145                 $(subst,\,$B $(shell @type Extensions_static)) \
1146                 $(LIBFILES) perl.exp $(LKPOST))
1147 .ELSE
1148         $(LINK32) -dll -def:perldll.def -out:$@ \
1149             @Extensions_static \
1150             @$(mktmp -base:0x28000000 $(BLINK_FLAGS) $(DELAYLOAD) $(LIBFILES) \
1151                 $(PERLDLL_RES) $(PERLDLL_OBJ:s,\,$B,))
1152 .ENDIF
1153         $(XCOPY) $(PERLIMPLIB) $(COREDIR)
1154
1155
1156 $(PERLEXE_ICO): $(MINIPERL) makeico.pl
1157         $(MINIPERL) makeico.pl > $@
1158
1159 $(PERLEXE_RES): perlexe.rc $(PERLEXE_ICO)
1160
1161 $(MINIMOD) : $(MINIPERL) ..\minimod.pl
1162         cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
1163
1164 ..\x2p\a2p$(o) : ..\x2p\a2p.c
1165         $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
1166
1167 ..\x2p\hash$(o) : ..\x2p\hash.c
1168         $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c
1169
1170 ..\x2p\str$(o) : ..\x2p\str.c
1171         $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c
1172
1173 ..\x2p\util$(o) : ..\x2p\util.c
1174         $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c
1175
1176 ..\x2p\walk$(o) : ..\x2p\walk.c
1177         $(CC) -I..\x2p  $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c
1178
1179 $(X2P) : $(MINIPERL) $(X2P_OBJ)
1180         $(MINIPERL) ..\x2p\find2perl.PL
1181         $(MINIPERL) ..\x2p\s2p.PL
1182 .IF "$(CCTYPE)" == "BORLAND"
1183         $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
1184             @$(mktmp c0x32$(o) $(X2P_OBJ:s,\,$B,),$(@:s,\,$B,),,$(LIBFILES),)
1185 .ELIF "$(CCTYPE)" == "GCC"
1186         $(LINK32) -v -o $@ $(BLINK_FLAGS) \
1187             $(mktmp $(LKPRE) $(X2P_OBJ:s,\,$B,) $(LIBFILES) $(LKPOST))
1188 .ELSE
1189         $(LINK32) -subsystem:console -out:$@ \
1190             @$(mktmp $(BLINK_FLAGS) $(LIBFILES) $(X2P_OBJ:s,\,$B,))
1191 .ENDIF
1192
1193 perlmain.c : runperl.c
1194         copy runperl.c perlmain.c
1195
1196 perlmain$(o) : perlmain.c
1197         $(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
1198
1199 $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
1200 .IF "$(CCTYPE)" == "BORLAND"
1201         $(LINK32) -Tpe -ap $(BLINK_FLAGS) \
1202             @$(mktmp c0x32$(o) $(PERLEXE_OBJ:s,\,$B,)$N \
1203             $(@:s,\,$B,),$N \
1204             $(PERLIMPLIB) $(LIBFILES)$N)
1205 .ELIF "$(CCTYPE)" == "GCC"
1206         $(LINK32) -mconsole -o $@ $(BLINK_FLAGS)  \
1207             $(PERLEXE_OBJ) $(PERLIMPLIB) $(LIBFILES)
1208 .ELSE
1209         $(LINK32) -subsystem:console -out:$@ -stack:0x1000000 $(BLINK_FLAGS) \
1210             $(LIBFILES) $(PERLEXE_OBJ) $(SETARGV_OBJ) $(PERLIMPLIB) $(PERLEXE_RES)
1211 .ENDIF
1212         copy $(PERLEXE) $(WPERLEXE)
1213         $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
1214         copy splittree.pl ..
1215         $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
1216
1217 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
1218         if not exist $(AUTODIR) mkdir $(AUTODIR)
1219         cd $(EXTDIR)\$(*B) && ..\$(MINIPERL) -I..\..\lib $(*B)_pm.PL
1220         cd $(EXTDIR)\$(*B) && ..\$(MINIPERL) -I..\..\lib XSLoader_pm.PL
1221         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
1222         $(XCOPY) $(EXTDIR)\$(*B)\XSLoader.pm $(LIBDIR)\$(NULL)
1223         cd $(EXTDIR)\$(*B) && $(XSUBPP) dl_win32.xs > $(*B).c
1224         $(XCOPY) $(EXTDIR)\$(*B)\dlutils.c .
1225
1226 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
1227         copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
1228
1229 MakePPPort: $(MINIPERL) $(CONFIGPM)
1230         $(MINIPERL) -I..\lib ..\mkppport
1231
1232 MakePPPort_clean:
1233         -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\mkppport --clean
1234
1235 #-------------------------------------------------------------------------------
1236 Extensions : buildext.pl $(PERLDEP) $(CONFIGPM)
1237         $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --dynamic
1238         $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --dynamic
1239
1240 Extensions_static : buildext.pl
1241         $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) --static
1242         $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext --static
1243         $(MINIPERL) -I..\lib buildext.pl --list-static-libs > Extensions_static
1244
1245 Extensions_clean :
1246         -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) clean
1247         -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext clean
1248
1249 Extensions_realclean :
1250         -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) $(EXTDIR) realclean
1251         -if exist $(MINIPERL) $(MINIPERL) -I..\lib buildext.pl $(MAKE) $(PERLDEP) ext realclean
1252
1253 #-------------------------------------------------------------------------------
1254
1255
1256 doc: $(PERLEXE)
1257         $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
1258             --podpath=pod:lib:ext:utils --htmlroot="file://$(INST_HTML:s,:,|,)"\
1259             --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse
1260
1261 # Note that this next section is parsed (and regenerated) by pod/buildtoc
1262 # so please check that script before making structural changes here
1263 utils: $(PERLEXE) $(X2P)
1264         cd ..\utils && $(MAKE) PERL=$(MINIPERL)
1265         copy ..\vms\perlvms.pod ..\pod\perlvms.pod
1266         copy ..\README.aix      ..\pod\perlaix.pod
1267         copy ..\README.amiga    ..\pod\perlamiga.pod
1268         copy ..\README.apollo   ..\pod\perlapollo.pod
1269         copy ..\README.beos     ..\pod\perlbeos.pod
1270         copy ..\README.bs2000   ..\pod\perlbs2000.pod
1271         copy ..\README.ce       ..\pod\perlce.pod
1272         copy ..\README.cn       ..\pod\perlcn.pod
1273         copy ..\README.cygwin   ..\pod\perlcygwin.pod
1274         copy ..\README.dgux     ..\pod\perldgux.pod
1275         copy ..\README.dos      ..\pod\perldos.pod
1276         copy ..\README.epoc     ..\pod\perlepoc.pod
1277         copy ..\README.freebsd  ..\pod\perlfreebsd.pod
1278         copy ..\README.hpux     ..\pod\perlhpux.pod
1279         copy ..\README.hurd     ..\pod\perlhurd.pod
1280         copy ..\README.irix     ..\pod\perlirix.pod
1281         copy ..\README.jp       ..\pod\perljp.pod
1282         copy ..\README.ko       ..\pod\perlko.pod
1283         copy ..\README.linux    ..\pod\perllinux.pod
1284         copy ..\README.machten  ..\pod\perlmachten.pod
1285         copy ..\README.macos    ..\pod\perlmacos.pod
1286         copy ..\README.macosx   ..\pod\perlmacosx.pod
1287         copy ..\README.mint     ..\pod\perlmint.pod
1288         copy ..\README.mpeix    ..\pod\perlmpeix.pod
1289         copy ..\README.netware  ..\pod\perlnetware.pod
1290         copy ..\README.openbsd  ..\pod\perlopenbsd.pod
1291         copy ..\README.os2      ..\pod\perlos2.pod
1292         copy ..\README.os390    ..\pod\perlos390.pod
1293         copy ..\README.os400    ..\pod\perlos400.pod
1294         copy ..\README.plan9    ..\pod\perlplan9.pod
1295         copy ..\README.qnx      ..\pod\perlqnx.pod
1296         copy ..\README.riscos   ..\pod\perlriscos.pod
1297         copy ..\README.solaris  ..\pod\perlsolaris.pod
1298         copy ..\README.symbian  ..\pod\perlsymbian.pod
1299         copy ..\README.tru64    ..\pod\perltru64.pod
1300         copy ..\README.tw       ..\pod\perltw.pod
1301         copy ..\README.uts      ..\pod\perluts.pod
1302         copy ..\README.vmesa    ..\pod\perlvmesa.pod
1303         copy ..\README.vms      ..\pod\perlvms.pod
1304         copy ..\README.vos      ..\pod\perlvos.pod
1305         copy ..\README.win32    ..\pod\perlwin32.pod
1306         copy ..\pod\perl595delta.pod ..\pod\perldelta.pod
1307         cd ..\pod && $(MAKE) -f ..\win32\pod.mak converters
1308         cd ..\lib && $(PERLEXE) lib_pm.PL
1309         $(PERLEXE) $(PL2BAT) $(UTILS)
1310
1311 # Note that the pod cleanup in this next section is parsed (and regenerated
1312 # by pod/buildtoc so please check that script before making changes here
1313
1314 distclean: realclean
1315         -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
1316                 $(PERLIMPLIB) ..\miniperl$(a) $(MINIMOD)
1317         -del /f *.def *.map
1318         -del /f $(DYNALOADER).c
1319         -del /f $(EXTDIR)\DynaLoader\dl_win32.xs
1320         -del /f $(EXTDIR)\DynaLoader\DynaLoader.pm
1321         -del /f $(EXTDIR)\DynaLoader\XSLoader.pm
1322         -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm
1323         -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm
1324         -del /f $(LIBDIR)\.exists $(LIBDIR)\attrs.pm $(LIBDIR)\DynaLoader.pm
1325         -del /f $(LIBDIR)\XSLoader.pm $(LIBDIR)\lib.pm
1326         -del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
1327         -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm
1328         -del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
1329         -del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
1330         -del /f $(LIBDIR)\ByteLoader.pm
1331         -del /f $(LIBDIR)\Devel\Peek.pm $(LIBDIR)\Devel\DProf.pm
1332         -del /f $(LIBDIR)\Devel\PPPort.pm
1333         -del /f $(LIBDIR)\File\Glob.pm
1334         -del /f $(LIBDIR)\Storable.pm
1335         -del /f $(LIBDIR)\Digest\MD5.pm
1336         -del /f $(LIBDIR)\Digest\SHA.pm
1337         -del /f $(LIBDIR)\PerlIO\encoding.pm
1338         -del /f $(LIBDIR)\PerlIO\scalar.pm
1339         -del /f $(LIBDIR)\PerlIO\via.pm
1340         -del /f $(LIBDIR)\Sys\Hostname.pm
1341         -del /f $(LIBDIR)\Thread\Signal.pm $(LIBDIR)\Thread\Specific.pm
1342         -del /f $(LIBDIR)\threads\shared.pm
1343         -del /f $(LIBDIR)\Time\HiRes.pm
1344         -del /f $(LIBDIR)\Unicode\Normalize.pm
1345         -del /f $(LIBDIR)\Math\BigInt\FastCalc.pm
1346         -del /f $(LIBDIR)\Win32.pm
1347         -del /f $(LIBDIR)\Win32API\File.pm
1348         -del /f $(LIBDIR)\Win32API\File\cFile.pc
1349         -if exist $(LIBDIR)\B rmdir /s /q $(LIBDIR)\B
1350         -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress
1351         -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
1352         -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode
1353         -if exist $(LIBDIR)\Filter\Util rmdir /s /q $(LIBDIR)\Filter\Util
1354         -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
1355         -if exist $(LIBDIR)\IO\Compress rmdir /s /q $(LIBDIR)\IO\Compress
1356         -if exist $(LIBDIR)\IO\Socket rmdir /s /q $(LIBDIR)\IO\Socket
1357         -if exist $(LIBDIR)\IO\Uncompress rmdir /s /q $(LIBDIR)\IO\Uncompress
1358         -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List
1359         -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME
1360         -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar
1361         -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys
1362         -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
1363         -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
1364         -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
1365         -cd $(PODDIR) && del /f *.html *.bat checkpods \
1366             perlaix.pod perlamiga.pod perlapollo.pod perlbeos.pod \
1367             perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
1368             perldelta.pod perldgux.pod perldos.pod perlepoc.pod \
1369             perlfreebsd.pod perlhpux.pod perlhurd.pod perlirix.pod \
1370             perljp.pod perlko.pod perllinux.pod perlmachten.pod \
1371             perlmacos.pod perlmacosx.pod perlmint.pod perlmpeix.pod \
1372             perlnetware.pod perlopenbsd.pod perlos2.pod perlos390.pod \
1373             perlos400.pod perlplan9.pod perlqnx.pod perlriscos.pod \
1374             perlsolaris.pod perlsymbian.pod perltru64.pod perltw.pod \
1375             perluts.pod perlvmesa.pod perlvms.pod perlvms.pod perlvos.pod \
1376             perlwin32.pod \
1377             pod2html pod2latex pod2man pod2text pod2usage \
1378             podchecker podselect
1379         -cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
1380             perldoc perlivp dprofpp libnetcfg enc2xs piconv cpan *.bat \
1381             xsubpp instmodsh prove ptar ptardiff shasum corelist config_data
1382         -cd ..\x2p && del /f find2perl s2p psed *.bat
1383         -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
1384         -del /f $(CONFIGPM)
1385         -del /f bin\*.bat
1386         -del /f perllibst.h
1387         -del /f $(PERLEXE_ICO) perl.base
1388         -cd .. && del /s *$(a) *.map *.pdb *.ilk *.tds *.bs *$(o) .exists pm_to_blib
1389         -cd $(EXTDIR) && del /s *.def Makefile Makefile.old
1390         -if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
1391         -if exist $(COREDIR) rmdir /s /q $(COREDIR)
1392         -if exist pod2htmd.tmp del pod2htmd.tmp
1393         -if exist pod2htmi.tmp del pod2htmi.tmp
1394         -if exist $(HTMLDIR) rmdir /s /q $(HTMLDIR)
1395
1396 install : all installbare installhtml
1397
1398 installbare : $(RIGHTMAKE) utils
1399         $(PERLEXE) ..\installperl
1400         if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\*.*
1401         $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
1402         if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\*.*
1403         if exist ..\x2p\a2p.pdb $(XCOPY) ..\x2p\a2p.pdb $(INST_BIN)\*.*
1404         $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
1405
1406 installhtml : doc
1407         $(RCOPY) $(HTMLDIR)\*.* $(INST_HTML)\*.*
1408
1409 inst_lib : $(CONFIGPM)
1410         copy splittree.pl ..
1411         $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
1412         $(RCOPY) ..\lib $(INST_LIB)\*.*
1413
1414 $(UNIDATAFILES) .UPDATEALL : $(MINIPERL) $(CONFIGPM) ..\lib\unicore\mktables
1415         cd ..\lib\unicore && \
1416         ..\$(MINIPERL) -I.. mktables
1417
1418 minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
1419         $(XCOPY) $(MINIPERL) ..\t\$(NULL)
1420         if exist ..\t\perl.exe del /f ..\t\perl.exe
1421         rename ..\t\miniperl.exe perl.exe
1422 .IF "$(CCTYPE)" == "BORLAND"
1423         $(XCOPY) $(GLOBBAT) ..\t\$(NULL)
1424 .ELSE
1425         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1426 .ENDIF
1427         attrib -r ..\t\*.*
1428         cd ..\t && \
1429         $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
1430
1431 test-prep : all utils
1432         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1433         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1434 .IF "$(CCTYPE)" == "BORLAND"
1435         $(XCOPY) $(GLOBBAT) ..\t\$(NULL)
1436 .ELSE
1437         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1438 .ENDIF
1439
1440 test : $(RIGHTMAKE) test-prep
1441         cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1442
1443 test-notty : test-prep
1444         set PERL_SKIP_TTY_TEST=1 && \
1445             cd ..\t && $(PERLEXE) -I.\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1446
1447 _test : $(RIGHTMAKE)
1448         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1449         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1450 .IF "$(CCTYPE)" == "BORLAND"
1451         $(XCOPY) $(GLOBBAT) ..\t\$(NULL)
1452 .ELSE
1453         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1454 .ENDIF
1455         cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1456
1457 _clean :
1458         -@erase miniperlmain$(o)
1459         -@erase $(MINIPERL)
1460         -@erase perlglob$(o)
1461         -@erase perlmain$(o)
1462         -@erase config.w32
1463         -@erase /f config.h
1464         -@erase $(GLOBEXE)
1465         -@erase $(PERLEXE)
1466         -@erase $(WPERLEXE)
1467         -@erase $(PERLDLL)
1468         -@erase $(CORE_OBJ)
1469         -if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
1470         -if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
1471         -if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
1472         -@erase $(UNIDATAFILES)
1473         -@erase $(WIN32_OBJ)
1474         -@erase $(DLL_OBJ)
1475         -@erase $(X2P_OBJ)
1476         -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
1477         -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
1478         -@erase ..\x2p\*.exe ..\x2p\*.bat
1479         -@erase *.ilk
1480         -@erase *.pdb
1481         -@erase *.tds
1482         -@erase Extensions_static
1483
1484 clean : Extensions_clean _clean
1485
1486 realclean : Extensions_realclean MakePPPort_clean _clean
1487
1488 # Handy way to run perlbug -ok without having to install and run the
1489 # installed perlbug. We don't re-run the tests here - we trust the user.
1490 # Please *don't* use this unless all tests pass.
1491 # If you want to report test failures, use "dmake nok" instead.
1492 ok: utils
1493         $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)"
1494
1495 okfile: utils
1496         $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
1497
1498 nok: utils
1499         $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)"
1500
1501 nokfile: utils
1502         $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok