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