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