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