1#
2# Makefile to build perl on Windows using Microsoft NMAKE.
3# Supported compilers:
4#	Microsoft Visual C++ 12.0 or later
5#
6# This is set up to build a perl.exe that runs off a shared library
7# (perl538.dll).  Also makes individual DLLs for the XS extensions.
8#
9
10##
11## Make sure you read README.win32 *before* you mess with anything here!
12##
13
14##
15## Build configuration.  Edit the values below to suit your needs.
16##
17
18#
19# Set these to wherever you want "nmake install" to put your
20# newly built perl.
21#
22INST_DRV	= c:
23INST_TOP	= $(INST_DRV)\perl
24
25#
26# Uncomment if you want to build a 32-bit Perl using a 32-bit compiler
27# on a 64-bit version of Windows.
28#
29#WIN64		= undef
30
31#
32# Comment this out if you DON'T want your perl installation to be versioned.
33# This means that the new installation will overwrite any files from the
34# old installation at the same INST_TOP location.  Leaving it enabled is
35# the safest route, as perl adds the extra version directory to all the
36# locations it installs files to.  If you disable it, an alternative
37# versioned installation can be obtained by setting INST_TOP above to a
38# path that includes an arbitrary version string.
39#
40#INST_VER	= \5.38.2
41
42#
43# Comment this out if you DON'T want your perl installation to have
44# architecture specific components.  This means that architecture-
45# specific files will be installed along with the architecture-neutral
46# files.  Leaving it enabled is safer and more flexible, in case you
47# want to build multiple flavors of perl and install them together in
48# the same location.  Commenting it out gives you a simpler
49# installation that is easier to understand for beginners.
50#
51#INST_ARCH	= \$(ARCHNAME)
52
53#
54# Uncomment this if you want perl to run
55# 	$Config{sitelibexp}\sitecustomize.pl
56# before anything else.  This script can then be set up, for example,
57# to add additional entries to @INC.
58#
59#USE_SITECUST	= define
60
61#
62# uncomment to enable multiple interpreters.  This is needed for fork()
63# emulation and for thread support, and is auto-enabled by USE_IMP_SYS
64# and USE_ITHREADS below.
65#
66USE_MULTI	= define
67
68#
69# Interpreter cloning/threads; now reasonably complete.
70# This should be enabled to get the fork() emulation.  This needs (and
71# will auto-enable) USE_MULTI above.
72#
73USE_ITHREADS	= define
74
75#
76# uncomment to enable the implicit "host" layer for all system calls
77# made by perl.  This is also needed to get fork().  This needs (and
78# will auto-enable) USE_MULTI above.
79#
80USE_IMP_SYS	= define
81
82#
83# Uncomment this if you're building a 32-bit perl and want 64-bit integers.
84# (If you're building a 64-bit perl then you will have 64-bit integers whether
85# or not this is uncommented.)
86#
87#USE_64_BIT_INT	= define
88
89#
90# Comment this out if you want the legacy default behavior of including '.' at
91# the end of @INC.
92#
93DEFAULT_INC_EXCLUDES_DOT = define
94
95#
96# Uncomment this if you want to disable looking up values from
97# HKEY_CURRENT_USER\Software\Perl and HKEY_LOCAL_MACHINE\Software\Perl in
98# the Registry.
99#
100#USE_NO_REGISTRY = define
101
102#
103# uncomment exactly one of the following
104#
105# Visual C++ 2013 (aka Visual C++ 12.0) (full version or Express Edition)
106#CCTYPE		= MSVC120
107# Visual C++ 2015 (aka Visual C++ 14.0) (full version or Express Edition)
108#CCTYPE		= MSVC140
109# Visual C++ 2017 (aka Visual C++ 14.1) (full version or Community Edition)
110#CCTYPE		= MSVC141
111# Visual C++ 2019 (aka Visual C++ 14.2) (full version or Community Edition)
112#CCTYPE		= MSVC142
113# Visual C++ 2022 (aka Visual C++ 14.3) (full version or Community Edition)
114#CCTYPE		= MSVC143
115
116#
117# If you are using Intel C++ Compiler uncomment this
118#
119#__ICC		= define
120
121#
122# Uncomment this if you want to build everything in C++ mode
123# This requires at least MSVC 2019.
124#
125#USE_CPLUSPLUS	= define
126
127#
128# uncomment next line if you want debug version of perl (big/slow)
129# If not enabled, we automatically try to use maximum optimization
130# with all compilers that are known to have a working optimizer.
131#
132# You can also set CFG = DebugSymbols for a slightly smaller/faster
133# debug build without the special debugging code in perl which is
134# enabled via -DDEBUGGING;
135#
136# or you can set CFG = DebugFull for an even fuller (bigger/slower)
137# debug build using the debug version of the CRT, and enabling VC++
138# debug features such as extra assertions and invalid parameter warnings
139# in perl and CRT code via -D_DEBUG.  (Note that the invalid parameter
140# handler does get triggered from time to time in this configuration,
141# which causes warnings to be printed on STDERR, which in turn causes a
142# few tests to fail.)
143#
144#CFG		= Debug
145
146#
147# uncomment to enable linking with setargv.obj under the Visual C
148# compiler. Setting this options enables perl to expand wildcards in
149# arguments, but it may be harder to use alternate methods like
150# File::DosGlob that are more powerful.  This option is supported only with
151# Visual C.
152#
153#USE_SETARGV	= define
154
155#
156# set this if you wish to use perl's malloc
157# WARNING: Turning this on/off WILL break binary compatibility with extensions
158# you may have compiled with/without it.  Be prepared to recompile all
159# extensions if you change the default.  Currently, this cannot be enabled
160# if you ask for USE_IMP_SYS above.
161#
162#PERL_MALLOC	= define
163
164#
165# set this to enable debugging mstats
166# This must be enabled to use the Devel::Peek::mstat() function.  This cannot
167# be enabled without PERL_MALLOC as well.
168#
169#DEBUG_MSTATS	= define
170
171#
172# set this to additionally provide a statically linked perl-static.exe.
173# Note that dynamic loading will not work with this perl, so you must
174# include required modules statically using the STATIC_EXT or ALL_STATIC
175# variables below. A static library perl538s.lib will also be created.
176# Ordinary perl.exe is not affected by this option.
177#
178#BUILD_STATIC	= define
179
180#
181# in addition to BUILD_STATIC the option ALL_STATIC makes *every*
182# extension get statically built.
183# This will result in a very large perl executable, but the main purpose
184# is to have proper linking set so as to be able to create miscellaneous
185# executables with different built-in extensions.
186#
187#ALL_STATIC	= define
188
189#
190# set the install location of the compiler
191# Running VCVARS32.BAT, VCVARSALL.BAT or similar is *required* when using
192# Visual C++.
193# Versions of Visual C++ up to VC++ 14.0 define $(VCINSTALLDIR), but from
194# VC++ 14.1 we need the subfolder given by $(VCToolsInstallDir).
195#
196!IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
197CCHOME		= $(VCINSTALLDIR)
198!ELSE
199CCHOME		= $(VCTOOLSINSTALLDIR)
200!ENDIF
201
202#
203# Additional compiler flags can be specified here.
204#
205BUILDOPT	= $(BUILDOPTEXTRA)
206
207#
208# This should normally be disabled.  Enabling it will disable the File::Glob
209# implementation of CORE::glob.
210#
211#BUILDOPT	= $(BUILDOPT) -DPERL_EXTERNAL_GLOB
212
213#
214# Perl needs to read scripts in text mode so that the DATA filehandle
215# works correctly with seek() and tell(), or around auto-flushes of
216# all filehandles (e.g. by system(), backticks, fork(), etc).
217#
218# The current version on the ByteLoader module on CPAN however only
219# works if scripts are read in binary mode.  But before you disable text
220# mode script reading (and break some DATA filehandle functionality)
221# please check first if an updated ByteLoader isn't available on CPAN.
222#
223BUILDOPT	= $(BUILDOPT) -DPERL_TEXTMODE_SCRIPTS
224
225#
226# specify semicolon-separated list of extra directories that modules will
227# look for libraries (spaces in path names need not be quoted)
228#
229EXTRALIBDIRS	=
230
231#
232# set this to your email address (perl will guess a value from
233# your loginname and your hostname, which may not be right)
234#
235#EMAIL		=
236
237##
238## Build configuration ends.
239##
240
241##################### CHANGE THESE ONLY IF YOU MUST #####################
242
243!IF "$(USE_IMP_SYS)" == "define"
244PERL_MALLOC	= undef
245DEBUG_MSTATS	= undef
246!ENDIF
247
248!IF "$(PERL_MALLOC)" == ""
249PERL_MALLOC	= undef
250DEBUG_MSTATS	= undef
251!ENDIF
252
253!IF "$(DEBUG_MSTATS)" == ""
254DEBUG_MSTATS	= undef
255!ENDIF
256
257!IF "$(DEBUG_MSTATS)" == "define"
258BUILDOPT	= $(BUILDOPT) -DPERL_DEBUGGING_MSTATS
259!ENDIF
260
261!IF "$(USE_SITECUST)" == ""
262USE_SITECUST	= undef
263!ENDIF
264
265!IF "$(USE_MULTI)" == ""
266USE_MULTI	= undef
267!ENDIF
268
269!IF "$(USE_ITHREADS)" == ""
270USE_ITHREADS	= undef
271!ENDIF
272
273!IF "$(USE_IMP_SYS)" == ""
274USE_IMP_SYS	= undef
275!ENDIF
276
277!IF "$(USE_64_BIT_INT)" == ""
278USE_64_BIT_INT	= undef
279!ENDIF
280
281!IF "$(DEFAULT_INC_EXCLUDES_DOT)" == ""
282DEFAULT_INC_EXCLUDES_DOT = undef
283!ENDIF
284
285!IF "$(USE_NO_REGISTRY)" == ""
286USE_NO_REGISTRY	= undef
287!ENDIF
288
289!IF "$(USE_IMP_SYS)$(USE_MULTI)" == "defineundef"
290USE_MULTI	= define
291!ENDIF
292
293!IF "$(USE_ITHREADS)$(USE_MULTI)" == "defineundef"
294USE_MULTI	= define
295!ENDIF
296
297!IF "$(USE_SITECUST)" == "define"
298BUILDOPT	= $(BUILDOPT) -DUSE_SITECUSTOMIZE
299!ENDIF
300
301!IF "$(USE_MULTI)" != "undef"
302BUILDOPT	= $(BUILDOPT) -DMULTIPLICITY
303!ENDIF
304
305!IF "$(USE_IMP_SYS)" != "undef"
306BUILDOPT	= $(BUILDOPT) -DPERL_IMPLICIT_SYS
307!ENDIF
308
309!IF "$(USE_NO_REGISTRY)" != "undef"
310BUILDOPT	= $(BUILDOPT) -DWIN32_NO_REGISTRY
311!ENDIF
312
313!IF "$(PROCESSOR_ARCHITECTURE)" == ""
314PROCESSOR_ARCHITECTURE	= x86
315!ENDIF
316
317!IF "$(WIN64)" == ""
318# When we are running from a 32bit cmd.exe on AMD64 then
319# PROCESSOR_ARCHITECTURE is set to x86 and PROCESSOR_ARCHITEW6432
320# is set to AMD64
321!  IF "$(PROCESSOR_ARCHITEW6432)" != ""
322PROCESSOR_ARCHITECTURE	= $(PROCESSOR_ARCHITEW6432)
323WIN64			= define
324!  ELSEIF "$(PROCESSOR_ARCHITECTURE)" == "AMD64" || "$(PROCESSOR_ARCHITECTURE)" == "IA64" || "$(PROCESSOR_ARCHITECTURE)" == "ARM64"
325WIN64			= define
326!  ELSE
327WIN64			= undef
328!  ENDIF
329!ENDIF
330
331!IF "$(WIN64)" == "define"
332USE_64_BIT_INT	= define
333!ENDIF
334
335ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
336
337!IF "$(ARCHITECTURE)" == "AMD64"
338ARCHITECTURE	= x64
339!ELSEIF "$(ARCHITECTURE)" == "IA64"
340ARCHITECTURE	= ia64
341!ELSEIF "$(ARCHITECTURE)" == "ARM64"
342ARCHITECTURE	= arm64
343!ENDIF
344
345!IF "$(USE_MULTI)" == "define"
346ARCHNAME	= MSWin32-$(ARCHITECTURE)-multi
347!ELSE
348ARCHNAME	= MSWin32-$(ARCHITECTURE)-perlio
349!ENDIF
350
351!IF "$(USE_ITHREADS)" == "define"
352ARCHNAME	= $(ARCHNAME)-thread
353!ENDIF
354
355!IF "$(WIN64)" != "define" && "$(USE_64_BIT_INT)" == "define"
356ARCHNAME	= $(ARCHNAME)-64int
357!ENDIF
358
359# Loading DLLs on demand makes the test suite run in about 10% less time.
360# If no registry, advapi32 is only used for Perl_pp_getlogin/getlogin/GetUserNameA
361# which is rare to execute
362!IF "$(USE_NO_REGISTRY)" != "undef"
363DELAYLOAD	= -DELAYLOAD:ws2_32.dll -DELAYLOAD:advapi32.dll delayimp.lib
364MINIDELAYLOAD	=
365!ELSE
366DELAYLOAD	= -DELAYLOAD:ws2_32.dll delayimp.lib
367#miniperl never does any registry lookups
368MINIDELAYLOAD	= -DELAYLOAD:advapi32.dll
369!ENDIF
370
371# Set the install location of the compiler headers/libraries.
372# These are saved into $Config{incpath} and $Config{libpth}.
373CCINCDIR	= $(CCHOME)\include
374!IF "$(CCTYPE)" == "MSVC120" || "$(CCTYPE)" == "MSVC140"
375!  IF "$(WIN64)" == "define"
376CCLIBDIR	= $(CCHOME)\lib\amd64
377!  ELSE
378CCLIBDIR	= $(CCHOME)\lib
379!  ENDIF
380!ELSE
381!  IF "$(ARCHITECTURE)" == "arm64"
382CCLIBDIR	= $(CCHOME)\lib\arm64
383!  ELSEIF "$(WIN64)" == "define"
384CCLIBDIR	= $(CCHOME)\lib\x64
385!  ELSE
386CCLIBDIR	= $(CCHOME)\lib\x86
387!  ENDIF
388!ENDIF
389
390ARCHDIR		= ..\lib\$(ARCHNAME)
391COREDIR		= ..\lib\CORE
392AUTODIR		= ..\lib\auto
393LIBDIR		= ..\lib
394EXTDIR		= ..\ext
395DISTDIR		= ..\dist
396CPANDIR		= ..\cpan
397PODDIR		= ..\pod
398HTMLDIR		= .\html
399
400INST_SCRIPT	= $(INST_TOP)$(INST_VER)\bin
401INST_BIN	= $(INST_SCRIPT)$(INST_ARCH)
402INST_LIB	= $(INST_TOP)$(INST_VER)\lib
403INST_ARCHLIB	= $(INST_LIB)$(INST_ARCH)
404INST_COREDIR	= $(INST_ARCHLIB)\CORE
405INST_HTML	= $(INST_TOP)$(INST_VER)\html
406
407#
408# Programs to compile, build .lib files and link
409#
410
411# Poison the recipe if no CCTYPE is set, and delete mini\.exists so everything
412# is rebuilt next time to avoid reusing a mini config.h written with no sane CC
413# version set
414!IF "$(CCTYPE)" == ""
415CC		= @echo CCTYPE makefile variable not set && del mini\.exists && exit 1 &&
416LINK32		= @echo CCTYPE makefile variable not set && del mini\.exists && exit 1 &&
417!ELSEIF "$(__ICC)" != "define"
418CC		= cl
419LINK32		= link
420!ELSE
421CC		= icl
422LINK32		= xilink
423!ENDIF
424LIB32		= $(LINK32) -lib
425RSC		= rc
426
427#
428# Options
429#
430
431INCLUDES	= -I$(COREDIR) -I.\include -I. -I..
432#PCHFLAGS	= -Fpc:\temp\vcmoduls.pch -YX
433DEFINES		= -DWIN32 -D_CONSOLE -DNO_STRICT
434LOCDEFS		= -DPERLDLL -DPERL_CORE
435CXX_FLAG	= -TP -EHsc
436!IF "$(USE_CPLUSPLUS)" == "define"
437CXX_FLAG	= $(CXX_FLAG) -std:c++20
438!ENDIF
439EXTRACFLAGS	= -nologo -GF -W3
440
441!IF "$(CCTYPE)" == "MSVC120"
442LIBC		= msvcrt.lib
443!ELSE
444LIBC		= ucrt.lib
445!ENDIF
446
447!IF  "$(CFG)" == "Debug"
448OPTIMIZE	= -Od -Zi
449LINK_DBG	= -debug
450DEFINES		= $(DEFINES) -DDEBUGGING
451EXTRACFLAGS	= $(EXTRACFLAGS) -MD
452!ELSEIF  "$(CFG)" == "DebugSymbols"
453OPTIMIZE	= -Od -Zi
454LINK_DBG	= -debug
455EXTRACFLAGS	= $(EXTRACFLAGS) -MD
456!ELSEIF  "$(CFG)" == "DebugFull"
457!  IF "$(CCTYPE)" == "MSVC120"
458LIBC		= msvcrtd.lib
459!  ELSE
460LIBC		= ucrtd.lib
461!  ENDIF
462OPTIMIZE	= -Od -Zi
463LINK_DBG	= -debug
464DEFINES		= $(DEFINES) -D_DEBUG -DDEBUGGING
465EXTRACFLAGS	= $(EXTRACFLAGS) -MDd
466!ELSE
467# Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
468# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
469OPTIMIZE	= -O1 -Zi -GL
470# we enable debug symbols in release builds also
471LINK_DBG	= -debug -opt:ref,icf -ltcg
472# you may want to enable this if you want COFF symbols in the executables
473# in addition to the PDB symbols.  The default Dr. Watson that ships with
474# Windows can use the former but not latter.  The free WinDbg can be
475# installed to get better stack traces from just the PDB symbols, so we
476# avoid the bloat of COFF symbols by default.
477#LINK_DBG	= $(LINK_DBG) -debugtype:both
478LIB_FLAGS	= -ltcg
479EXTRACFLAGS	= $(EXTRACFLAGS) -MD
480!ENDIF
481
482!IF "$(WIN64)" == "define"
483DEFINES		= $(DEFINES) -DWIN64
484OPTIMIZE	= $(OPTIMIZE) -fp:precise
485!ENDIF
486
487# For now, silence warnings about "unsafe" CRT functions
488# and POSIX CRT function names being deprecated.
489DEFINES		= $(DEFINES) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
490
491# Likewise for deprecated Winsock APIs in VC++ 14.0 onwards for now.
492!IF "$(CCTYPE)" != "MSVC120"
493DEFINES		= $(DEFINES) -D_WINSOCK_DEPRECATED_NO_WARNINGS
494!ENDIF
495
496LIBBASEFILES	= \
497		oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib \
498		comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
499		netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib \
500		version.lib odbc32.lib odbccp32.lib comctl32.lib
501
502!IF "$(CCTYPE)" != "MSVC120"
503!  IF  "$(CFG)" == "DebugFull"
504LIBBASEFILES	= $(LIBBASEFILES) msvcrtd.lib vcruntimed.lib
505!  ELSE
506LIBBASEFILES	= $(LIBBASEFILES) msvcrt.lib vcruntime.lib
507!  ENDIF
508!ENDIF
509
510# Avoid __intel_new_proc_init link error for libircmt.
511# libmmd is /MD equivalent, other variants exist.
512# libmmd is Intel C's math addon funcs to MS CRT, contains long doubles, C99,
513# and optimized C89 funcs
514!IF "$(__ICC)" == "define"
515LIBBASEFILES	= $(LIBBASEFILES) libircmt.lib libmmd.lib
516!ENDIF
517
518LIBFILES	= $(LIBBASEFILES) $(LIBC)
519
520!IF "$(__ICC)" == "define"
521EXTRACFLAGS	= $(EXTRACFLAGS) -Qstd=c99
522!ENDIF
523!IF "$(USE_CPLUSPLUS)" == "define"
524EXTRACFLAGS	= $(EXTRACFLAGS) $(CXX_FLAG)
525!ENDIF
526CFLAGS		= $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) \
527		$(PCHFLAGS) $(OPTIMIZE)
528LINK_FLAGS	= -nologo -nodefaultlib $(LINK_DBG) \
529		-libpath:"$(INST_COREDIR)" \
530		-machine:$(PROCESSOR_ARCHITECTURE)
531LIB_FLAGS	= $(LIB_FLAGS) -nologo
532OBJOUT_FLAG	= -Fo
533EXEOUT_FLAG	= -Fe
534
535CFLAGS_O	= $(CFLAGS) $(BUILDOPT)
536
537RSC_FLAGS	=
538
539# VS 2017 (VC++ 14.1) requires at minimum Windows 7 SP1 (with latest Windows Updates)
540
541# For XP support in >= VS 2013 (VC++ 12.0), subsystem is always in Config.pm
542# LINK_FLAGS.
543!IF "$(WIN64)" == "define"
544LINK_FLAGS	= $(LINK_FLAGS) -subsystem:console,"5.02"
545!ELSE
546LINK_FLAGS	= $(LINK_FLAGS) -subsystem:console,"5.01"
547!ENDIF
548
549BLINK_FLAGS	= $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
550
551#################### do not edit below this line #######################
552############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
553
554o = .obj
555
556#
557# Rules
558#
559
560#clear the list, we dont support .cxx .bas .cbl .for .pas .f .f90
561# .asm .cpp are not currently used but they are included for completeness
562.SUFFIXES :
563.SUFFIXES : .c $(o) .cpp .asm .dll .lib .exe .rc .res
564
565.c$(o):
566	$(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
567
568.c.i:
569	$(CC) -c -I$(<D) $(CFLAGS_O) -P $(OBJOUT_FLAG)$@ $<
570
571.y.c:
572	$(NOOP)
573
574$(o).dll:
575	$(LINK32) -dll -implib:$(*B).lib -def:$(*B).def \
576	    -out:$@ $(BLINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
577
578.rc.res:
579	$(RSC) -i.. $(RSC_FLAGS) $<
580
581#
582# various targets
583
584# makedef.pl must be updated if this changes, and this should normally
585# only change when there is an incompatible revision of the public API.
586PERLIMPLIB	= ..\perl538.lib
587PERLSTATICLIB	= ..\perl538s.lib
588PERLDLL		= ..\perl538.dll
589
590MINIPERL	= ..\miniperl.exe
591MINIDIR		= .\mini
592PERLEXE		= ..\perl.exe
593WPERLEXE	= ..\wperl.exe
594PERLEXESTATIC	= ..\perl-static.exe
595GLOBEXE		= ..\perlglob.exe
596CONFIGPM	= ..\lib\Config.pm ..\lib\Config_heavy.pl
597GENUUDMAP	= ..\generate_uudmap.exe
598!IF "$(BUILD_STATIC)" == "define" || "$(ALL_STATIC)" == "define"
599PERLSTATIC	= static
600!ELSE
601PERLSTATIC	= 
602!ENDIF
603
604# Unicode data files generated by mktables
605FIRSTUNIFILE     = ..\lib\unicore\Decomposition.pl
606UNIDATAFILES	 = ..\lib\unicore\Decomposition.pl \
607		   ..\lib\unicore\CombiningClass.pl ..\lib\unicore\Name.pl \
608		   ..\lib\unicore\Heavy.pl ..\lib\unicore\mktables.lst     \
609		   ..\lib\unicore\UCD.pl ..\lib\unicore\Name.pm            \
610		   ..\lib\unicore\TestProp.pl
611
612# Directories of Unicode data files generated by mktables
613UNIDATADIR1	= ..\lib\unicore\To
614UNIDATADIR2	= ..\lib\unicore\lib
615
616PERLEXE_MANIFEST= .\perlexe.manifest
617PERLEXE_ICO	= .\perlexe.ico
618PERLEXE_RES	= .\perlexe.res
619PERLDLL_RES	=
620
621# Nominate a target which causes extensions to be re-built
622# This used to be $(PERLEXE), but at worst it is the .dll that they depend
623# on and really only the interface - i.e. the .def file used to export symbols
624# from the .dll
625PERLDEP		= perldll.def
626
627PL2BAT		= bin\pl2bat.pl
628GLOBBAT		= bin\perlglob.bat
629
630UTILS		=			\
631		..\utils\h2ph		\
632		..\utils\splain		\
633		..\utils\perlbug	\
634		..\utils\pl2pm 		\
635		..\utils\h2xs		\
636		..\utils\perldoc	\
637		..\utils\perlivp	\
638		..\utils\libnetcfg	\
639		..\utils\enc2xs		\
640		..\utils\encguess		\
641		..\utils\piconv		\
642		..\utils\corelist	\
643		..\utils\cpan		\
644		..\utils\xsubpp		\
645		..\utils\prove		\
646		..\utils\ptar		\
647		..\utils\ptardiff	\
648		..\utils\ptargrep	\
649		..\utils\zipdetails	\
650		..\utils\shasum		\
651		..\utils\instmodsh	\
652		..\utils\json_pp	\
653		..\utils\pod2html	\
654		..\utils\streamzip	\
655		bin\exetype.pl		\
656		bin\runperl.pl		\
657		bin\pl2bat.pl		\
658		bin\perlglob.pl		\
659		bin\search.pl
660
661MAKE		= nmake -nologo
662MAKE_BARE	= nmake
663
664CFGSH_TMPL	= config.vc
665CFGH_TMPL	= config_H.vc
666INT64		= __int64
667
668XCOPY		= xcopy /f /r /i /d /y
669RCOPY		= xcopy /f /r /i /e /d /y
670NOOP		= @rem
671NULL		=
672
673DEL		= del
674
675MICROCORE_SRC	=		\
676		..\av.c		\
677		..\caretx.c	\
678		..\class.c	\
679		..\builtin.c	\
680		..\deb.c	\
681		..\doio.c	\
682		..\doop.c	\
683		..\dquote.c	\
684		..\dump.c	\
685		..\globals.c	\
686		..\gv.c		\
687		..\mro_core.c	\
688		..\hv.c		\
689		..\locale.c	\
690		..\keywords.c	\
691		..\mathoms.c    \
692		..\mg.c		\
693		..\numeric.c	\
694		..\op.c		\
695		..\pad.c	\
696		..\peep.c	\
697		..\perl.c	\
698		..\perly.c	\
699		..\pp.c		\
700		..\pp_ctl.c	\
701		..\pp_hot.c	\
702		..\pp_pack.c	\
703		..\pp_sort.c	\
704		..\pp_sys.c	\
705		..\reentr.c	\
706		..\regcomp.c	\
707		..\regcomp_trie.c	\
708		..\regcomp_debug.c	\
709		..\regcomp_invlist.c	\
710		..\regcomp_study.c	\
711		..\regexec.c	\
712		..\run.c	\
713		..\scope.c	\
714		..\sv.c		\
715		..\taint.c	\
716		..\time64.c	\
717		..\toke.c	\
718		..\universal.c	\
719		..\utf8.c	\
720		..\util.c
721
722EXTRACORE_SRC	= $(EXTRACORE_SRC) perllib.c
723
724!IF "$(PERL_MALLOC)" == "define"
725EXTRACORE_SRC	= $(EXTRACORE_SRC) ..\malloc.c
726!ENDIF
727
728EXTRACORE_SRC	= $(EXTRACORE_SRC) ..\perlio.c
729
730WIN32_SRC	=		\
731		.\win32.c	\
732		.\win32sck.c	\
733		.\win32thread.c	\
734		.\fcrypt.c
735
736CORE_NOCFG_H	=		\
737		..\av.h		\
738		..\cop.h	\
739		..\cv.h		\
740		..\dosish.h	\
741		..\embed.h	\
742		..\form.h	\
743		..\gv.h		\
744		..\handy.h	\
745		..\hv.h		\
746		..\hv_func.h	\
747		..\iperlsys.h	\
748		..\mg.h		\
749		..\nostdio.h	\
750		..\op.h		\
751		..\opcode.h	\
752		..\perl.h	\
753		..\perlapi.h	\
754		..\perlsdio.h	\
755		..\perly.h	\
756		..\pp.h		\
757		..\proto.h	\
758		..\regcomp.h	\
759		..\regcomp_internal.h	\
760		..\regexp.h	\
761		..\scope.h	\
762		..\sv.h		\
763		..\thread.h	\
764		..\unixish.h	\
765		..\utf8.h	\
766		..\util.h	\
767		..\warnings.h	\
768		..\XSUB.h	\
769		..\EXTERN.h	\
770		..\perlvars.h	\
771		..\intrpvar.h	\
772		.\include\dirent.h	\
773		.\include\netdb.h	\
774		.\include\sys\errno2.h	\
775		.\include\sys\socket.h	\
776		.\win32.h
777
778CORE_H		= $(CORE_NOCFG_H) .\config.h ..\git_version.h
779
780UUDMAP_H	= ..\uudmap.h
781BITCOUNT_H	= ..\bitcount.h
782MG_DATA_H	= ..\mg_data.h
783GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
784
785MICROCORE_OBJ	= $(MICROCORE_SRC:.c=.obj)
786CORE_OBJ	= $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=.obj)
787WIN32_OBJ	= $(WIN32_SRC:.c=.obj)
788MINICORE_OBJ	= $(MICROCORE_OBJ:..\=.\mini\)	\
789		  $(MINIDIR)\miniperlmain$(o)	\
790		  $(MINIDIR)\perlio$(o)
791MINIWIN32_OBJ	= $(WIN32_OBJ:.\=.\mini\)
792MINI_OBJ	= $(MINICORE_OBJ) $(MINIWIN32_OBJ)
793DLL_OBJ		= $(DYNALOADER)
794GENUUDMAP_OBJ	= $(GENUUDMAP:.exe=.obj)
795
796PERLDLL_OBJ	= $(CORE_OBJ)
797PERLEXE_OBJ	= perlmain$(o)
798PERLEXEST_OBJ	= perlmainst$(o)
799
800PERLDLL_OBJ	= $(PERLDLL_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
801
802!IF "$(USE_SETARGV)" != ""
803SETARGV_OBJ	= setargv$(o)
804!ENDIF
805
806!IF "$(ALL_STATIC)" == "define"
807# some exclusions, unfortunately, until fixed:
808#  - MakeMaker isn't capable enough for SDBM_File (small bug)
809STATIC_EXT	= * !SDBM_File
810!ELSE
811# specify static extensions here, for example:
812# (be sure to include Win32CORE to load Win32 on demand)
813#STATIC_EXT	= Win32CORE Cwd Compress/Raw/Zlib
814STATIC_EXT	= Win32CORE
815!ENDIF
816
817DYNALOADER	= ..\DynaLoader$(o)
818
819CFG_VARS	=					\
820		"INST_TOP=$(INST_TOP)"			\
821		"INST_VER=$(INST_VER)"			\
822		"INST_ARCH=$(INST_ARCH)"		\
823		"archname=$(ARCHNAME)"			\
824		"cc=$(CC)"				\
825		"ld=$(LINK32)"				\
826		"ccflags=$(EXTRACFLAGS) $(DEFINES) $(BUILDOPT)"	\
827		"usecplusplus=$(USE_CPLUSPLUS)"		\
828		"cf_email=$(EMAIL)"	 		\
829		"d_mymalloc=$(PERL_MALLOC)"		\
830		"libs=$(LIBFILES)"			\
831		"incpath=$(CCINCDIR:"=\")"		\
832		"libperl=$(PERLIMPLIB:..\=)"		\
833		"libpth=$(CCLIBDIR:"=\");$(EXTRALIBDIRS:"=\")"	\
834		"libc=$(LIBC)"				\
835		"make=$(MAKE_BARE)"				\
836		"static_ext=$(STATIC_EXT)"		\
837		"usethreads=$(USE_ITHREADS)"		\
838		"useithreads=$(USE_ITHREADS)"		\
839		"usemultiplicity=$(USE_MULTI)"		\
840		"use64bitint=$(USE_64_BIT_INT)"		\
841		"uselongdouble=undef"			\
842		"usequadmath=undef"			    \
843		"usesitecustomize=$(USE_SITECUST)"	\
844		"default_inc_excludes_dot=$(DEFAULT_INC_EXCLUDES_DOT)"	\
845		"LINK_FLAGS=$(LINK_FLAGS:"=\")"		\
846		"optimize=$(OPTIMIZE:"=\")"		\
847		"WIN64=$(WIN64)"                        \
848		"SKIP_CCHOME_CHECK=$(SKIP_CCHOME_CHECK)"
849
850#
851# Top targets
852#
853
854all : ..\git_version.h $(GLOBEXE) $(CONFIGPM) \
855	$(UNIDATAFILES) MakePPPort $(PERLEXE) Extensions_nonxs Extensions \
856	$(PERLSTATIC)
857	@echo	Everything is up to date. '$(MAKE_BARE) test' to run test suite.
858
859regnodes : ..\regnodes.h
860
861..\regcomp$(o) : ..\regcomp.h ..\regcomp_internal.h ..\regnodes.h ..\regcharclass.h
862
863..\regcomp_debug$(o) : ..\regcomp.h ..\regcomp_internal.h ..\regnodes.h ..\regcharclass.h
864
865..\regcomp_invlist$(o) : ..\regcomp.h ..\regcomp_internal.h ..\regnodes.h ..\regcharclass.h
866
867..\regcomp_study$(o) : ..\regcomp.h ..\regcomp_internal.h ..\regnodes.h ..\regcharclass.h
868
869..\regcomp_trie$(o) : ..\regcomp.h ..\regcomp_internal.h ..\regnodes.h ..\regcharclass.h
870
871..\regexec$(o) : ..\regnodes.h ..\regcharclass.h
872
873reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(CONFIGPM) \
874	$(UNIDATAFILES) $(PERLEXE) Extensions_reonly
875	@echo	Perl and 're' are up to date.
876
877static: $(PERLEXESTATIC)
878
879#------------------------------------------------------------
880
881$(GLOBEXE) : perlglob$(o)
882	$(LINK32) $(BLINK_FLAGS) $(LIBFILES) -out:$@ \
883	    perlglob$(o) setargv$(o)
884
885perlglob$(o)  : perlglob.c
886
887..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
888	cd .. && miniperl -Ilib make_patchnum.pl && cd win32
889
890# make sure that we recompile perl.c if the git version changes
891..\perl$(o) : ..\git_version.h
892
893..\config.sh : $(CFGSH_TMPL) config_sh.PL FindExt.pm $(MINIPERL)
894	$(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh.tmp
895	if exist ..\config.sh del /f ..\config.sh
896	rename ..\config.sh.tmp config.sh
897
898# This target is for when changes to the main config.sh happen.
899# Edit config.vc, then make perl in a minimal configuration (i.e. with MULTI,
900# ITHREADS, IMP_SYS and LARGE_FILES off), then make this target
901# to regenerate config_H.vc.
902regen_config_h:
903	$(MINIPERL) -I..\lib config_sh.PL --prebuilt $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
904	$(MINIPERL) -I..\lib ..\configpm --chdir=..
905	-del /f $(CFGH_TMPL)
906	-$(MINIPERL) -I..\lib config_h.PL
907	rename config.h $(CFGH_TMPL)
908
909$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\git_version.h
910	$(MINIPERL) -I..\lib ..\configpm --chdir=..
911	$(XCOPY) ..\*.h $(COREDIR)\*.*
912	$(XCOPY) *.h $(COREDIR)\*.*
913	$(RCOPY) include $(COREDIR)\*.*
914	-$(MINIPERL) -I..\lib config_h.PL
915	if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)
916
917.\config.h : $(CONFIGPM)
918
919# See the comment in Makefile.SH explaining this seemingly cranky ordering
920$(MINIPERL) : ..\lib\buildcustomize.pl
921
922..\lib\buildcustomize.pl : $(MINI_OBJ) ..\write_buildcustomize.pl
923	$(LINK32) -out:$(MINIPERL) @<<
924	$(BLINK_FLAGS) $(DELAYLOAD) $(MINIDELAYLOAD) $(LIBFILES) $(MINI_OBJ)
925<<
926	$(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
927
928$(MINIDIR)\.exists : $(CFGH_TMPL)
929	if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
930#
931# Copy the template config.h and set configurables at the end of it
932# as per the options chosen and compiler used.
933# Note: This config.h is only used to build miniperl.exe anyway, but
934# it's as well to have its options correct to be sure that it builds
935# and so that it's "-V" options are correct for use by makedef.pl. The
936# real config.h used to build perl.exe is generated from the top-level
937# config_h.SH by config_h.PL (run by miniperl.exe).
938#
939	copy $(CFGH_TMPL) config.h
940	@(echo.&& \
941	echo #ifndef _config_h_footer_&& \
942	echo #define _config_h_footer_&& \
943	echo #undef PTRSIZE&& \
944	echo #undef SSize_t&& \
945	echo #undef HAS_ATOLL&& \
946	echo #undef HAS_STRTOLL&& \
947	echo #undef HAS_STRTOULL&& \
948	echo #undef Size_t_size&& \
949	echo #undef IVTYPE&& \
950	echo #undef UVTYPE&& \
951	echo #undef IVSIZE&& \
952	echo #undef UVSIZE&& \
953	echo #undef NV_PRESERVES_UV&& \
954	echo #undef NV_PRESERVES_UV_BITS&& \
955	echo #undef IVdf&& \
956	echo #undef UVuf&& \
957	echo #undef UVof&& \
958	echo #undef UVxf&& \
959	echo #undef UVXf&& \
960	echo #undef USE_64_BIT_INT&& \
961	echo #undef USE_LONG_DOUBLE&& \
962	echo #undef USE_CPLUSPLUS)>> config.h
963!IF "$(CCTYPE)" != "MSVC120"
964	@(echo #undef FILE_ptr&& \
965	echo #undef FILE_cnt&& \
966	echo #undef FILE_base&& \
967	echo #undef FILE_bufsiz&& \
968	echo #define FILE_ptr^(fp^) PERLIO_FILE_ptr^(fp^)&& \
969	echo #define FILE_cnt^(fp^) PERLIO_FILE_cnt^(fp^)&& \
970	echo #define FILE_base^(fp^) PERLIO_FILE_base^(fp^)&& \
971	echo #define FILE_bufsiz^(fp^) ^(PERLIO_FILE_cnt^(fp^) + PERLIO_FILE_ptr^(fp^) - PERLIO_FILE_base^(fp^)^)&& \
972	echo #define I_STDBOOL)>> config.h
973!ENDIF
974!IF "$(WIN64)"=="define"
975	@(echo #define PTRSIZE ^8&& \
976	echo #define SSize_t $(INT64)&& \
977	echo #define HAS_ATOLL&& \
978	echo #define HAS_STRTOLL&& \
979	echo #define HAS_STRTOULL&& \
980	echo #define Size_t_size ^8)>> config.h
981!ELSE
982	@(echo #define PTRSIZE ^4&& \
983	echo #define SSize_t int&& \
984	echo #undef HAS_ATOLL&& \
985	echo #undef HAS_STRTOLL&& \
986	echo #undef HAS_STRTOULL&& \
987	echo #define Size_t_size ^4)>> config.h
988!ENDIF
989!IF "$(USE_64_BIT_INT)"=="define"
990	@(echo #define IVTYPE $(INT64)&& \
991	echo #define UVTYPE unsigned $(INT64)&& \
992	echo #define IVSIZE ^8&& \
993	echo #define UVSIZE ^8&& \
994	echo #undef NV_PRESERVES_UV&& \
995	echo #define NV_PRESERVES_UV_BITS 53&& \
996	echo #define IVdf "I64d"&& \
997	echo #define UVuf "I64u"&& \
998	echo #define UVof "I64o"&& \
999	echo #define UVxf "I64x"&& \
1000	echo #define UVXf "I64X"&& \
1001	echo #define USE_64_BIT_INT)>> config.h
1002!ELSE
1003	@(echo #define IVTYPE long&& \
1004	echo #define UVTYPE unsigned long&& \
1005	echo #define IVSIZE ^4&& \
1006	echo #define UVSIZE ^4&& \
1007	echo #define NV_PRESERVES_UV&& \
1008	echo #define NV_PRESERVES_UV_BITS 32&& \
1009	echo #define IVdf "ld"&& \
1010	echo #define UVuf "lu"&& \
1011	echo #define UVof "lo"&& \
1012	echo #define UVxf "lx"&& \
1013	echo #define UVXf "lX"&& \
1014	echo #undef USE_64_BIT_INT)>> config.h
1015!ENDIF
1016!IF "$(USE_CPLUSPLUS)"=="define"
1017	@(echo #define USE_CPLUSPLUS&& \
1018	echo #endif)>> config.h
1019!ELSE
1020	@(echo #undef USE_CPLUSPLUS&& \
1021	echo #endif)>> config.h
1022!ENDIF
1023#separate line since this is sentinal that this target is done
1024	@rem. > $(MINIDIR)\.exists
1025
1026$(MINICORE_OBJ) : $(CORE_NOCFG_H)
1027	$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*F).c
1028
1029$(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
1030	$(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*F).c
1031
1032# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
1033# This is the only file that depends on perlhost.h, vmem.h, and vdir.h
1034!IF "$(USE_IMP_SYS)" == "define"
1035perllib$(o)	: perllib.c .\perlhost.h .\vdir.h .\vmem.h
1036	$(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
1037!ENDIF
1038
1039# 1. we don't want to rebuild miniperl.exe when config.h changes
1040# 2. we don't want to rebuild miniperl.exe with non-default config.h
1041# 3. we can't have miniperl.exe depend on git_version.h, as miniperl creates it
1042$(MINI_OBJ)	: $(MINIDIR)\.exists $(CORE_NOCFG_H)
1043
1044$(WIN32_OBJ)	: $(CORE_H)
1045$(CORE_OBJ)	: $(CORE_H)
1046$(DLL_OBJ)	: $(CORE_H)
1047
1048perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl ..\git_version.h
1049	$(MINIPERL) -I..\lib create_perllibst_h.pl
1050	$(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
1051	    CCTYPE=$(CCTYPE) TARG_DIR=..\ > perldll.def
1052
1053$(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
1054	$(LINK32) -dll -def:perldll.def -out:$@ @Extensions_static @<<
1055		$(BLINK_FLAGS) $(DELAYLOAD) $(LIBFILES) $(PERLDLL_OBJ) $(PERLDLL_RES)
1056<<
1057	$(XCOPY) $(PERLIMPLIB) $(COREDIR)
1058
1059$(PERLSTATICLIB): Extensions_static
1060	$(LIB32) $(LIB_FLAGS) -out:$@ @Extensions_static @<<
1061		$(PERLDLL_OBJ)
1062<<
1063	$(XCOPY) $(PERLSTATICLIB) $(COREDIR)
1064
1065$(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
1066
1067$(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
1068
1069$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
1070
1071$(BITCOUNT_H) : $(GENUUDMAP)
1072	$(GENUUDMAP) $(GENERATED_HEADERS)
1073
1074$(GENUUDMAP_OBJ) : ..\mg_raw.h
1075
1076$(GENUUDMAP) : $(GENUUDMAP_OBJ)
1077	$(LINK32) -out:$@ @<<
1078		$(BLINK_FLAGS) $(LIBFILES) $(GENUUDMAP_OBJ)
1079<<
1080
1081perlmain.c : runperl.c
1082	copy runperl.c perlmain.c
1083
1084perlmain$(o) : perlmain.c
1085	$(CC) $(CFLAGS_O:-DPERLDLL=-UPERLDLL) $(OBJOUT_FLAG)$@ -c perlmain.c
1086
1087perlmainst.c : runperl.c
1088	copy runperl.c perlmainst.c
1089
1090perlmainst$(o) : perlmainst.c
1091	$(CC) $(CFLAGS_O) $(OBJOUT_FLAG)$@ -c perlmainst.c
1092
1093$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
1094	$(LINK32) -out:$@ $(BLINK_FLAGS) \
1095	    $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB) $(LIBFILES) $(SETARGV_OBJ)
1096	copy $(PERLEXE) $(WPERLEXE)
1097	$(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
1098
1099$(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
1100	$(LINK32) -out:$@ $(BLINK_FLAGS) \
1101	    $(PERLEXEST_OBJ) $(PERLEXE_RES) $(PERLSTATICLIB) $(LIBFILES) $(SETARGV_OBJ)
1102
1103MakePPPort: $(MINIPERL) $(CONFIGPM) Extensions_nonxs
1104	$(MINIPERL) -I..\lib ..\mkppport
1105
1106#-------------------------------------------------------------------------------
1107# There's no direct way to mark a dependency on
1108# DynaLoader.pm, so this will have to do
1109Extensions: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
1110	$(XCOPY) ..\*.h $(COREDIR)\*.*
1111	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
1112
1113Extensions_reonly: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
1114	$(XCOPY) ..\*.h $(COREDIR)\*.*
1115	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
1116
1117Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
1118	$(XCOPY) ..\*.h $(COREDIR)\*.*
1119	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
1120	$(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
1121
1122Extensions_nonxs: ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) ..\pod\perlfunc.pod
1123	$(XCOPY) ..\*.h $(COREDIR)\*.*
1124	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs
1125
1126$(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
1127	$(XCOPY) ..\*.h $(COREDIR)\*.*
1128	$(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader
1129
1130Extensions_clean: 
1131	-if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean
1132
1133Extensions_realclean: 
1134	-if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=realclean
1135
1136#-------------------------------------------------------------------------------
1137
1138doc: $(PERLEXE) ..\pod\perltoc.pod
1139	$(PERLEXE) ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
1140	    --podpath=pod:lib:utils --htmlroot="file://$(INST_HTML::=|)" \
1141	    --recurse
1142
1143..\utils\Makefile: $(CONFIGPM) ..\utils\Makefile.PL
1144	$(MINIPERL) -I..\lib ..\utils\Makefile.PL ..
1145
1146# Note that this next section is parsed (and regenerated) by pod/buildtoc
1147# so please check that script before making structural changes here
1148
1149utils: $(PERLEXE) ..\utils\Makefile
1150	cd ..\utils
1151	$(MAKE) PERL=$(MINIPERL)
1152	cd ..\pod
1153	copy ..\README.aix      ..\pod\perlaix.pod
1154	copy ..\README.amiga    ..\pod\perlamiga.pod
1155	copy ..\README.android  ..\pod\perlandroid.pod
1156	copy ..\README.bs2000   ..\pod\perlbs2000.pod
1157	copy ..\README.cn       ..\pod\perlcn.pod
1158	copy ..\README.cygwin   ..\pod\perlcygwin.pod
1159	copy ..\README.freebsd  ..\pod\perlfreebsd.pod
1160	copy ..\README.haiku    ..\pod\perlhaiku.pod
1161	copy ..\README.hpux     ..\pod\perlhpux.pod
1162	copy ..\README.hurd     ..\pod\perlhurd.pod
1163	copy ..\README.irix     ..\pod\perlirix.pod
1164	copy ..\README.jp       ..\pod\perljp.pod
1165	copy ..\README.ko       ..\pod\perlko.pod
1166	copy ..\README.linux    ..\pod\perllinux.pod
1167	copy ..\README.macosx   ..\pod\perlmacosx.pod
1168	copy ..\README.openbsd  ..\pod\perlopenbsd.pod
1169	copy ..\README.os2      ..\pod\perlos2.pod
1170	copy ..\README.os390    ..\pod\perlos390.pod
1171	copy ..\README.os400    ..\pod\perlos400.pod
1172	copy ..\README.plan9    ..\pod\perlplan9.pod
1173	copy ..\README.qnx      ..\pod\perlqnx.pod
1174	copy ..\README.riscos   ..\pod\perlriscos.pod
1175	copy ..\README.solaris  ..\pod\perlsolaris.pod
1176	copy ..\README.synology ..\pod\perlsynology.pod
1177	copy ..\README.tru64    ..\pod\perltru64.pod
1178	copy ..\README.tw       ..\pod\perltw.pod
1179	copy ..\README.vos      ..\pod\perlvos.pod
1180	copy ..\README.win32    ..\pod\perlwin32.pod
1181	copy ..\pod\perldelta.pod ..\pod\perl5382delta.pod
1182	cd ..\win32
1183	$(PERLEXE) $(PL2BAT) $(UTILS)
1184	$(MINIPERL) -I..\lib ..\autodoc.pl ..
1185	$(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
1186
1187..\pod\perltoc.pod: $(PERLEXE) Extensions Extensions_nonxs
1188	$(PERLEXE) -f ..\pod\buildtoc -q
1189
1190# Note that the pod cleanup in this next section is parsed (and regenerated
1191# by pod/buildtoc so please check that script before making changes here
1192
1193distclean: realclean
1194	-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
1195		$(PERLIMPLIB) ..\miniperl.lib $(PERLEXESTATIC) $(PERLSTATICLIB)
1196	-del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm
1197	-del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm
1198	-del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm
1199	-del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
1200	-del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm
1201	-del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
1202	-del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
1203	-del /f $(LIBDIR)\File\Glob.pm
1204	-del /f $(LIBDIR)\Storable.pm
1205	-del /f $(LIBDIR)\Sys\Hostname.pm
1206	-del /f $(LIBDIR)\Time\HiRes.pm
1207	-del /f $(LIBDIR)\Unicode\Normalize.pm
1208	-del /f $(LIBDIR)\Math\BigInt\FastCalc.pm
1209	-del /f $(LIBDIR)\Win32.pm
1210	-del /f $(LIBDIR)\Win32CORE.pm
1211	-del /f $(LIBDIR)\Win32API\File.pm
1212	-del /f $(LIBDIR)\Win32API\File\cFile.pc
1213	-del /f $(LIBDIR)\buildcustomize.pl
1214	-del /f $(DISTDIR)\XSLoader\XSLoader.pm
1215	-del /f *.def *.map
1216	-if exist $(LIBDIR)\Amiga rmdir /s /q $(LIBDIR)\Amiga
1217	-if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
1218	-if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
1219	-if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute
1220	-if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie
1221	-if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp
1222	-if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress
1223	-if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl
1224	-if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN
1225	-if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
1226	-if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel
1227	-if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest
1228	-if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode
1229	-if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding
1230	-if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter
1231	-if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder
1232	-if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command
1233	-if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant
1234	-if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist
1235	-if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker
1236	-if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS
1237	-if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps
1238	-if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec
1239	-if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter
1240	-if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
1241	-if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP
1242	-if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N
1243	-if exist $(LIBDIR)\inc rmdir /s /q $(LIBDIR)\inc
1244	-if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
1245	-if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC
1246	-if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON
1247	-if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List
1248	-if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale
1249	-if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math
1250	-if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize
1251	-if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME
1252	-if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module
1253	-if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP
1254	-if exist $(LIBDIR)\OpenBSD rmdir /s /q $(LIBDIR)\OpenBSD
1255	-if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params
1256	-if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse
1257	-if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl
1258	-if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO
1259	-if exist $(LIBDIR)\Pod\Html rmdir /s /q $(LIBDIR)\Pod\Html
1260	-if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc
1261	-if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple
1262	-if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text
1263	-if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar
1264	-if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search
1265	-if exist $(LIBDIR)\Sub rmdir /s /q $(LIBDIR)\Sub
1266	-if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys
1267	-if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP
1268	-if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term
1269	-if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
1270	-if exist $(LIBDIR)\Test2 rmdir /s /q $(LIBDIR)\Test2
1271	-if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text
1272	-if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
1273	-if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
1274	-if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
1275	-if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
1276	-if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale
1277	-if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version
1278	-if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS
1279	-if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
1280	-if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
1281	-cd $(PODDIR) && del /f *.html *.bat roffitall \
1282	    perl5382delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
1283	    perlapi.pod perlbs2000.pod perlcn.pod perlcygwin.pod \
1284	    perlfreebsd.pod perlhaiku.pod perlhpux.pod perlhurd.pod \
1285	    perlintern.pod perlirix.pod perljp.pod perlko.pod perllinux.pod \
1286	    perlmacosx.pod perlmodlib.pod perlopenbsd.pod perlos2.pod \
1287	    perlos390.pod perlos400.pod perlplan9.pod perlqnx.pod \
1288	    perlriscos.pod perlsolaris.pod perlsynology.pod perltoc.pod \
1289	    perltru64.pod perltw.pod perlvos.pod perlwin32.pod
1290	-cd ..\utils && del /f h2ph splain perlbug pl2pm h2xs \
1291	    perldoc perlivp libnetcfg enc2xs encguess piconv cpan streamzip *.bat \
1292	    xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
1293	-del /f ..\config.sh perlmain.c dlutils.c config.h.new \
1294	        perlmainst.c
1295	-del /f $(CONFIGPM)
1296	-del /f ..\lib\Config_git.pl
1297	-del /f bin\*.bat
1298	-del /f perllibst.h
1299	-del /f $(PERLEXE_RES) perl.base
1300	-cd .. && del /s *.lib *.map *.pdb *.ilk *.bs *$(o) .exists pm_to_blib ppport.h
1301	-cd $(EXTDIR) && del /s *.def Makefile Makefile.old
1302	-cd $(DISTDIR) && del /s *.def Makefile Makefile.old
1303	-cd $(CPANDIR) && del /s *.def Makefile Makefile.old
1304	-del /s ..\utils\Makefile
1305	-if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
1306	-if exist $(COREDIR) rmdir /s /q $(COREDIR)
1307	-if exist pod2htmd.tmp del pod2htmd.tmp
1308	-if exist $(HTMLDIR) rmdir /s /q $(HTMLDIR)
1309	-del /f ..\t\test_state
1310
1311install : all installbare installhtml
1312
1313installbare : utils ..\pod\perltoc.pod
1314	$(PERLEXE) ..\installperl
1315	if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\*.*
1316	if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\*.*
1317	$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
1318	if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\*.*
1319	$(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
1320
1321installhtml : doc
1322	$(RCOPY) $(HTMLDIR)\*.* $(INST_HTML)\*.*
1323
1324inst_lib : $(CONFIGPM)
1325	$(RCOPY) ..\lib $(INST_LIB)\*.*
1326
1327$(UNIDATAFILES) ..\pod\perluniprops.pod : $(MINIPERL) $(CONFIGPM) ..\lib\unicore\mktables Extensions_nonxs
1328	cd ..\lib\unicore && \
1329	..\$(MINIPERL) -I.. mktables -P ..\..\pod -maketest -makelist -p -check $@ $(FIRSTUNIFILE)
1330
1331minitest : .\config.h $(MINIPERL) ..\git_version.h $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES)
1332	$(XCOPY) $(MINIPERL) ..\t\$(NULL)
1333	if exist ..\t\perl.exe del /f ..\t\perl.exe
1334	rename ..\t\miniperl.exe perl.exe
1335	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1336# Note this perl.exe is miniperl
1337	cd ..\t && perl.exe TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t pragma/*.t
1338
1339test-prep : all utils ../pod/perltoc.pod
1340	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
1341	$(XCOPY) $(PERLDLL) ..\t\$(NULL)
1342	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1343	set PERL_STATIC_EXT=$(STATIC_EXT)
1344
1345test : test-prep
1346	cd ..\t
1347	perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) $(TEST_FILES)
1348	cd ..\win32
1349
1350test_porting : test-prep
1351	cd ..\t
1352	perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
1353	cd ..\win32
1354
1355test-reonly : reonly utils
1356	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
1357	$(XCOPY) $(PERLDLL) ..\t\$(NULL)
1358	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1359	cd ..\t
1360	perl.exe harness $(OPT) -re \bre\\/ $(EXTRA)
1361	cd ..\win32
1362
1363regen :
1364	cd ..
1365	regen.pl
1366	cd win32
1367
1368test-notty : test-prep
1369	set PERL_SKIP_TTY_TEST=1
1370	cd ..\t
1371	perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) $(TEST_FILES)
1372	cd ..\win32
1373
1374_test : 
1375       $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1376       $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1377       $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1378       cd ..\t
1379       perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) $(TEST_FILES)
1380       cd ..\win32
1381
1382_clean :
1383	-@$(DEL) miniperlmain$(o)
1384	-@$(DEL) $(MINIPERL)
1385	-@$(DEL) perlglob$(o)
1386	-@$(DEL) perlmain$(o)
1387	-@$(DEL) perlmainst$(o)
1388	-@$(DEL) config.h
1389	-@$(DEL) ..\git_version.h
1390	-@$(DEL) $(GLOBEXE)
1391	-@$(DEL) $(PERLEXE)
1392	-@$(DEL) $(WPERLEXE)
1393	-@$(DEL) $(PERLEXESTATIC)
1394	-@$(DEL) $(PERLSTATICLIB)
1395	-@$(DEL) $(PERLDLL)
1396	-@$(DEL) $(CORE_OBJ)
1397	-@$(DEL) $(GENUUDMAP) $(GENUUDMAP_OBJ) $(GENERATED_HEADERS)
1398	-if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
1399	-if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
1400	-if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
1401	-@$(DEL) $(UNIDATAFILES)
1402	-@$(DEL) $(WIN32_OBJ)
1403	-@$(DEL) $(DLL_OBJ)
1404	-@$(DEL) ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp *.res
1405	-@$(DEL) ..\t\*.exe ..\t\*.dll ..\t\*.bat
1406	-@$(DEL) *.ilk
1407	-@$(DEL) *.pdb
1408	-@$(DEL) Extensions_static
1409
1410clean : Extensions_clean _clean
1411
1412realclean : Extensions_realclean _clean
1413
1414# Handy way to run perlbug -ok without having to install and run the
1415# installed perlbug. We don't re-run the tests here - we trust the user.
1416# Please *don't* use this unless all tests pass.
1417# If you want to report test failures, use "nmake nok" instead.
1418ok: utils
1419	$(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)"
1420
1421okfile: utils
1422	$(PERLEXE) ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
1423
1424nok: utils
1425	$(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)"
1426
1427nokfile: utils
1428	$(PERLEXE) ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok
1429