This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
4f496c90ef0766a8afe0f228072b4c2ddaba5607
[perl5.git] / win32 / GNUmakefile
1 #
2 # Makefile to build perl on Windows using GNU make + gcc + MinGW.
3 #
4 # This is set up to build a perl.exe that runs off a shared library
5 # (perl523.dll).  Also makes individual DLLs for the XS extensions.
6 #
7 # The easiest way to customize the build process is to use parameters like this:
8 #
9 # c:\dev\perlsrc\win32> gmake INST_TOP=c:\sw\perl CCHOME=c:\sw\mingw USE_64_BIT_INT=define
10
11
12 ##
13 ## Make sure you read README.win32 *before* you mess with anything here!
14 ##
15
16 #
17 # We set this to point to cmd.exe in case GNU Make finds sh.exe in the path.
18 # Comment this line out if necessary
19 #
20 SHELL := cmd.exe
21
22 # define whether you want to use native gcc compiler or cross-compiler
23 # possible values: gcc
24 #                  i686-w64-mingw32-gcc
25 #                  x86_64-w64-mingw32-gcc
26 GCCBIN := gcc
27
28 ifeq ($(GCCBIN),x86_64-w64-mingw32-gcc)
29 GCCCROSS := x86_64-w64-mingw32
30 endif
31 ifeq ($(GCCBIN),i686-w64-mingw32-gcc)
32 GCCCROSS := i686-w64-mingw32
33 endif
34
35 GCCTARGET := $(shell $(GCCBIN) -dumpmachine)
36 GCCVER1   := $(shell for /f "delims=. tokens=1,2,3" %%i in ('gcc -dumpversion') do echo %%i)
37 GCCVER2   := $(shell for /f "delims=. tokens=1,2,3" %%i in ('gcc -dumpversion') do echo %%j)
38 GCCVER3   := $(shell for /f "delims=. tokens=1,2,3" %%i in ('gcc -dumpversion') do echo %%k)
39
40 ifeq ($(GCCTARGET),x86_64-w64-mingw32)
41 WIN64 := define
42 ARCHITECTURE := x64
43 endif
44 ifeq ($(GCCTARGET),i686-w64-mingw32)
45 WIN64 := undef
46 ARCHITECTURE := x86
47 endif
48
49 ##
50 ## Build configuration.  Edit the values below to suit your needs.
51 ##
52
53 #
54 # Set these to wherever you want "gmake install" to put your
55 # newly built perl.
56 #
57 INST_DRV := c:
58 INST_TOP := $(INST_DRV)\perl
59
60 #
61 # Comment this out if you DON'T want your perl installation to be versioned.
62 # This means that the new installation will overwrite any files from the
63 # old installation at the same INST_TOP location.  Leaving it enabled is
64 # the safest route, as perl adds the extra version directory to all the
65 # locations it installs files to.  If you disable it, an alternative
66 # versioned installation can be obtained by setting INST_TOP above to a
67 # path that includes an arbitrary version string.
68 #
69 #INST_VER       := \5.23.2
70
71 #
72 # Comment this out if you DON'T want your perl installation to have
73 # architecture specific components.  This means that architecture-
74 # specific files will be installed along with the architecture-neutral
75 # files.  Leaving it enabled is safer and more flexible, in case you
76 # want to build multiple flavors of perl and install them together in
77 # the same location.  Commenting it out gives you a simpler
78 # installation that is easier to understand for beginners.
79 #
80 #INST_ARCH      := \$(ARCHNAME)
81
82 #
83 # Uncomment this if you want perl to run
84 #       $Config{sitelibexp}\sitecustomize.pl
85 # before anything else.  This script can then be set up, for example,
86 # to add additional entries to @INC.
87 #
88 #USE_SITECUST   := define
89
90 #
91 # uncomment to enable multiple interpreters.  This is needed for fork()
92 # emulation and for thread support, and is auto-enabled by USE_IMP_SYS
93 # and USE_ITHREADS below.
94 #
95 USE_MULTI       := define
96
97 #
98 # Interpreter cloning/threads; now reasonably complete.
99 # This should be enabled to get the fork() emulation.  This needs (and
100 # will auto-enable) USE_MULTI above.
101 #
102 USE_ITHREADS    := define
103
104 #
105 # uncomment to enable the implicit "host" layer for all system calls
106 # made by perl.  This is also needed to get fork().  This needs (and
107 # will auto-enable) USE_MULTI above.
108 #
109 USE_IMP_SYS     := define
110
111 #
112 # Comment out next assign to disable perl's I/O subsystem and use compiler's
113 # stdio for IO - depending on your compiler vendor and run time library you may
114 # then get a number of fails from make test i.e. bugs - complain to them not us ;-).
115 # You will also be unable to take full advantage of perl5.8's support for multiple
116 # encodings and may see lower IO performance. You have been warned.
117 #
118 USE_PERLIO      := define
119
120 #
121 # Comment this out if you don't want to enable large file support for
122 # some reason.  Should normally only be changed to maintain compatibility
123 # with an older release of perl.
124 #
125 USE_LARGE_FILES := define
126
127 #
128 # Uncomment this if you're building a 32-bit perl and want 64-bit integers.
129 # (If you're building a 64-bit perl then you will have 64-bit integers whether
130 # or not this is uncommented.)
131 # Note: This option is not supported in 32-bit MSVC60 builds.
132 #
133 #USE_64_BIT_INT := define
134
135 #
136 # Uncomment this if you want to support the use of long doubles.
137 #
138 #USE_LONG_DOUBLE :=define
139
140 #
141 # uncomment next line if you want debug version of perl (big,slow)
142 # If not enabled, we automatically try to use maximum optimization
143 # with all compilers that are known to have a working optimizer.
144 #
145 #CFG            := Debug
146
147 #
148 # uncomment to enable linking with setargv.obj under the Visual C
149 # compiler. Setting this options enables perl to expand wildcards in
150 # arguments, but it may be harder to use alternate methods like
151 # File::DosGlob that are more powerful.  This option is supported only with
152 # Visual C.
153 #
154 #USE_SETARGV    := define
155
156 #
157 # set this if you wish to use perl's malloc
158 # WARNING: Turning this on/off WILL break binary compatibility with extensions
159 # you may have compiled with/without it.  Be prepared to recompile all
160 # extensions if you change the default.  Currently, this cannot be enabled
161 # if you ask for USE_IMP_SYS above.
162 #
163 #PERL_MALLOC    := define
164
165 #
166 # set this to enable debugging mstats
167 # This must be enabled to use the Devel::Peek::mstat() function.  This cannot
168 # be enabled without PERL_MALLOC as well.
169 #
170 #DEBUG_MSTATS   := define
171
172 #
173 # set this to additionally provide a statically linked perl-static.exe.
174 # Note that dynamic loading will not work with this perl, so you must
175 # include required modules statically using the STATIC_EXT or ALL_STATIC
176 # variables below. A static library perl523s.lib will also be created.
177 # Ordinary perl.exe is not affected by this option.
178 #
179 #BUILD_STATIC   := define
180
181 #
182 # in addition to BUILD_STATIC the option ALL_STATIC makes *every*
183 # extension get statically built
184 # This will result in a very large perl executable, but the main purpose
185 # is to have proper linking set so as to be able to create miscellaneous
186 # executables with different built-in extensions
187 #
188 #ALL_STATIC     := define
189
190 #
191 # set the install locations of the compiler include/libraries
192 # Running VCVARS32.BAT is *required* when using Visual C.
193 # Some versions of Visual C don't define MSVCDIR in the environment,
194 # so you may have to set CCHOME explicitly (spaces in the path name should
195 # not be quoted)
196 #
197 CCHOME          := C:\MinGW
198
199 #
200 # Following sets $Config{incpath} and $Config{libpth}
201 #
202
203 ifneq ($(GCCCROSS),)
204 CCINCDIR := $(CCHOME)\$(GCCCROSS)\include
205 CCLIBDIR := $(CCHOME)\$(GCCCROSS)\lib
206 CCDLLDIR := $(CCLIBDIR)
207 ARCHPREFIX := $(GCCCROSS)-
208 else
209 CCINCDIR := $(CCHOME)\include
210 CCLIBDIR := $(CCHOME)\lib
211 CCDLLDIR := $(CCHOME)\bin
212 ARCHPREFIX :=
213 endif
214
215 #
216 # Additional compiler flags can be specified here.
217 #
218 BUILDOPT        := $(BUILDOPTEXTRA)
219
220 #
221 # This should normally be disabled.  Enabling it will disable the File::Glob
222 # implementation of CORE::glob.
223 #
224 #BUILDOPT       += -DPERL_EXTERNAL_GLOB
225
226 #
227 # Perl needs to read scripts in text mode so that the DATA filehandle
228 # works correctly with seek() and tell(), or around auto-flushes of
229 # all filehandles (e.g. by system(), backticks, fork(), etc).
230 #
231 # The current version on the ByteLoader module on CPAN however only
232 # works if scripts are read in binary mode.  But before you disable text
233 # mode script reading (and break some DATA filehandle functionality)
234 # please check first if an updated ByteLoader isn't available on CPAN.
235 #
236 BUILDOPT        += -DPERL_TEXTMODE_SCRIPTS
237
238 #
239 # specify semicolon-separated list of extra directories that modules will
240 # look for libraries (spaces in path names need not be quoted)
241 #
242 EXTRALIBDIRS    :=
243
244 #
245 # set this to your email address (perl will guess a value from
246 # from your loginname and your hostname, which may not be right)
247 #
248 #EMAIL          :=
249
250 ##
251 ## Build configuration ends.
252 ##
253
254 ##################### CHANGE THESE ONLY IF YOU MUST #####################
255
256 PERL_MALLOC     ?= undef
257 DEBUG_MSTATS    ?= undef
258
259 USE_SITECUST    ?= undef
260 USE_MULTI       ?= undef
261 USE_ITHREADS    ?= undef
262 USE_IMP_SYS     ?= undef
263 USE_PERLIO      ?= undef
264 USE_LARGE_FILES ?= undef
265 USE_64_BIT_INT  ?= undef
266 USE_LONG_DOUBLE ?= undef
267
268 ifeq ($(USE_IMP_SYS),define)
269 PERL_MALLOC     = undef
270 endif
271
272 ifeq ($(PERL_MALLOC),undef)
273 DEBUG_MSTATS    = undef
274 endif
275
276 ifeq ($(DEBUG_MSTATS),define)
277 BUILDOPT        += -DPERL_DEBUGGING_MSTATS
278 endif
279
280 ifeq ("$(USE_IMP_SYS) $(USE_MULTI)","define undef")
281 USE_MULTI       = define
282 endif
283
284 ifeq ("$(USE_ITHREADS) $(USE_MULTI)","define undef")
285 USE_MULTI       = define
286 endif
287
288 ifeq ($(USE_SITECUST),define)
289 BUILDOPT        += -DUSE_SITECUSTOMIZE
290 endif
291
292 ifneq ($(USE_MULTI),undef)
293 BUILDOPT        += -DPERL_IMPLICIT_CONTEXT
294 endif
295
296 ifneq ($(USE_IMP_SYS),undef)
297 BUILDOPT        += -DPERL_IMPLICIT_SYS
298 endif
299
300 ifeq ($(WIN64),define)
301 USE_64_BIT_INT  = define
302 endif
303
304 ifeq ($(USE_MULTI),define)
305 ARCHNAME        = MSWin32-$(ARCHITECTURE)-multi
306 else
307 ifeq ($(USE_PERLIO),define)
308 ARCHNAME        = MSWin32-$(ARCHITECTURE)-perlio
309 else
310 ARCHNAME        = MSWin32-$(ARCHITECTURE)
311 endif
312 endif
313
314 ifeq ($(USE_PERLIO),define)
315 BUILDOPT        += -DUSE_PERLIO
316 endif
317
318 ifeq ($(USE_ITHREADS),define)
319 ARCHNAME        := $(ARCHNAME)-thread
320 endif
321
322 ifneq ($(WIN64),define)
323 ifeq ($(USE_64_BIT_INT),define)
324 ARCHNAME        := $(ARCHNAME)-64int
325 endif
326 endif
327
328 ifeq ($(USE_LONG_DOUBLE),define)
329 ARCHNAME        := $(ARCHNAME)-ld
330 endif
331
332 ARCHDIR         = ..\lib\$(ARCHNAME)
333 COREDIR         = ..\lib\CORE
334 AUTODIR         = ..\lib\auto
335 LIBDIR          = ..\lib
336 EXTDIR          = ..\ext
337 DISTDIR         = ..\dist
338 CPANDIR         = ..\cpan
339 PODDIR          = ..\pod
340 HTMLDIR         = .\html
341
342 #
343 INST_SCRIPT     = $(INST_TOP)$(INST_VER)\bin
344 INST_BIN        = $(INST_SCRIPT)$(INST_ARCH)
345 INST_LIB        = $(INST_TOP)$(INST_VER)\lib
346 INST_ARCHLIB    = $(INST_LIB)$(INST_ARCH)
347 INST_COREDIR    = $(INST_ARCHLIB)\CORE
348 INST_HTML       = $(INST_TOP)$(INST_VER)\html
349
350 #
351 # Programs to compile, build .lib files and link
352 #
353
354 MINIBUILDOPT    :=
355
356 CC              = $(ARCHPREFIX)gcc
357 LINK32          = $(ARCHPREFIX)g++
358 LIB32           = $(ARCHPREFIX)ar rc
359 IMPLIB          = $(ARCHPREFIX)dlltool
360 RSC             = $(ARCHPREFIX)windres
361
362 ifeq ($(USE_LONG_DOUBLE),define)
363 BUILDOPT        += -D__USE_MINGW_ANSI_STDIO
364 MINIBUILDOPT    += -D__USE_MINGW_ANSI_STDIO
365 endif
366
367 # If you are using GCC, 4.3 or later by default we add the -fwrapv option.
368 # See https://rt.perl.org/Ticket/Display.html?id=121505
369 #
370 GCCWRAPV := $(shell if "$(GCCVER1)"=="4" (if "$(GCCVER2)" geq "3" echo define) else if "$(GCCVER1)" geq "5" (echo define))
371
372 ifeq ($(GCCWRAPV),define)
373 BUILDOPT        += -fwrapv
374 MINIBUILDOPT    += -fwrapv
375 endif
376
377 i = .i
378 o = .o
379 a = .a
380
381 #
382 # Options
383 #
384
385 INCLUDES        = -I.\include -I. -I.. -I$(COREDIR)
386 DEFINES         = -DWIN32
387 ifeq ($(WIN64),define)
388 DEFINES         += -DWIN64 -DCONSERVATIVE
389 endif
390 LOCDEFS         = -DPERLDLL -DPERL_CORE
391 SUBSYS          = console
392 CXX_FLAG        = -xc++
393 LIBC            =
394 LIBFILES        = $(LIBC) \
395                   -lmoldname -lkernel32 -luser32 -lgdi32 \
396                   -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 \
397                   -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr \
398                   -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
399
400 ifeq ($(CFG),Debug)
401 OPTIMIZE        = -g -O2 -DDEBUGGING
402 LINK_DBG        = -g
403 else
404 OPTIMIZE        = -s -O2
405 LINK_DBG        = -s
406 endif
407
408 EXTRACFLAGS     =
409 CFLAGS          = $(EXTRACFLAGS) $(INCLUDES) $(DEFINES) $(LOCDEFS) $(OPTIMIZE)
410 LINK_FLAGS      = $(LINK_DBG) -L"$(INST_COREDIR)" -L"$(CCLIBDIR)"
411 OBJOUT_FLAG     = -o
412 EXEOUT_FLAG     = -o
413 LIBOUT_FLAG     =
414
415 BUILDOPT        += -fno-strict-aliasing -mms-bitfields
416 MINIBUILDOPT    += -fno-strict-aliasing
417 CFLAGS_O        = $(CFLAGS) $(BUILDOPT)
418
419 # used to allow local linking flags that are not propogated into Config.pm,
420 # currently unused
421 #   -- BKS, 12-12-1999
422 PRIV_LINK_FLAGS =
423 BLINK_FLAGS     = $(PRIV_LINK_FLAGS) $(LINK_FLAGS)
424
425 #################### do not edit below this line #######################
426 ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
427
428 %$(o): %.c
429         $(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
430
431 %.i: %.c
432         $(CC) -c -I$(<D) $(CFLAGS_O) -E $< >$@
433
434 %.c: %.y
435         $(NOOP)
436
437 %.dll: %$(o)
438         $(LINK32) -o $@ $(BLINK_FLAGS) $< $(LIBFILES)
439         $(IMPLIB) --input-def $(*F).def --output-lib $(*F).a $@
440
441 %.res: %.rc
442         $(RSC) --use-temp-file --include-dir=. --include-dir=.. -O COFF -D INCLUDE_MANIFEST -i $< -o $@
443
444 #
445 # various targets
446 MINIPERL        = ..\miniperl.exe
447 MINIDIR         = mini
448 PERLEXE         = ..\perl.exe
449 WPERLEXE        = ..\wperl.exe
450 PERLEXESTATIC   = ..\perl-static.exe
451 STATICDIR       = .\static.tmp
452 GLOBEXE         = ..\perlglob.exe
453 CONFIGPM        = ..\lib\Config.pm ..\lib\Config_heavy.pl
454 GENUUDMAP       = ..\generate_uudmap.exe
455 ifeq ($(BUILD_STATIC),define)
456 PERLSTATIC      = static
457 else
458 ifeq ($(ALL_STATIC),define)
459 PERLSTATIC      = static
460 else
461 PERLSTATIC      =
462 endif
463 endif
464
465 # Unicode data files generated by mktables
466 UNIDATAFILES     = ..\lib\unicore\Decomposition.pl ..\lib\unicore\TestProp.pl \
467                    ..\lib\unicore\CombiningClass.pl ..\lib\unicore\Name.pl \
468                    ..\lib\unicore\UCD.pl ..\lib\unicore\Name.pm            \
469                    ..\lib\unicore\Heavy.pl ..\lib\unicore\mktables.lst
470
471 # Directories of Unicode data files generated by mktables
472 UNIDATADIR1     = ..\lib\unicore\To
473 UNIDATADIR2     = ..\lib\unicore\lib
474
475 PERLEXE_MANIFEST= .\perlexe.manifest
476 PERLEXE_ICO     = .\perlexe.ico
477 PERLEXE_RES     = .\perlexe.res
478 PERLDLL_RES     =
479
480 # Nominate a target which causes extensions to be re-built
481 # This used to be $(PERLEXE), but at worst it is the .dll that they depend
482 # on and really only the interface - i.e. the .def file used to export symbols
483 # from the .dll
484 PERLDEP = perldll.def
485
486
487 PL2BAT          = bin\pl2bat.pl
488
489 UTILS           =                       \
490                 ..\utils\h2ph           \
491                 ..\utils\splain         \
492                 ..\utils\perlbug        \
493                 ..\utils\pl2pm          \
494                 ..\utils\c2ph           \
495                 ..\utils\pstruct        \
496                 ..\utils\h2xs           \
497                 ..\utils\perldoc        \
498                 ..\utils\perlivp        \
499                 ..\utils\libnetcfg      \
500                 ..\utils\enc2xs         \
501                 ..\utils\piconv         \
502                 ..\utils\corelist       \
503                 ..\utils\cpan           \
504                 ..\utils\xsubpp         \
505                 ..\utils\pod2html       \
506                 ..\utils\prove          \
507                 ..\utils\ptar           \
508                 ..\utils\ptardiff       \
509                 ..\utils\ptargrep       \
510                 ..\utils\zipdetails     \
511                 ..\utils\shasum         \
512                 ..\utils\instmodsh      \
513                 ..\utils\json_pp        \
514                 bin\exetype.pl          \
515                 bin\runperl.pl          \
516                 bin\pl2bat.pl           \
517                 bin\perlglob.pl         \
518                 bin\search.pl
519
520 CFGSH_TMPL      = config.gc
521 CFGH_TMPL       = config_H.gc
522 PERLIMPLIB      = ..\libperl523$(a)
523 PERLSTATICLIB   = ..\libperl523s$(a)
524 INT64           = long long
525
526 # makedef.pl must be updated if this changes, and this should normally
527 # only change when there is an incompatible revision of the public API.
528 PERLDLL         = ..\perl523.dll
529
530 XCOPY           = xcopy /f /r /i /d /y
531 RCOPY           = xcopy /f /r /i /e /d /y
532 NOOP            = @rem
533
534 MICROCORE_SRC   =               \
535                 ..\av.c         \
536                 ..\caretx.c     \
537                 ..\deb.c        \
538                 ..\doio.c       \
539                 ..\doop.c       \
540                 ..\dump.c       \
541                 ..\globals.c    \
542                 ..\gv.c         \
543                 ..\mro_core.c   \
544                 ..\hv.c         \
545                 ..\locale.c     \
546                 ..\keywords.c   \
547                 ..\mathoms.c    \
548                 ..\mg.c         \
549                 ..\numeric.c    \
550                 ..\op.c         \
551                 ..\pad.c        \
552                 ..\perl.c       \
553                 ..\perlapi.c    \
554                 ..\perly.c      \
555                 ..\pp.c         \
556                 ..\pp_ctl.c     \
557                 ..\pp_hot.c     \
558                 ..\pp_pack.c    \
559                 ..\pp_sort.c    \
560                 ..\pp_sys.c     \
561                 ..\reentr.c     \
562                 ..\regcomp.c    \
563                 ..\regexec.c    \
564                 ..\run.c        \
565                 ..\scope.c      \
566                 ..\sv.c         \
567                 ..\taint.c      \
568                 ..\toke.c       \
569                 ..\universal.c  \
570                 ..\utf8.c       \
571                 ..\util.c
572
573 EXTRACORE_SRC   += perllib.c
574
575 ifeq ($(PERL_MALLOC),define)
576 EXTRACORE_SRC   += ..\malloc.c
577 endif
578
579 EXTRACORE_SRC   += ..\perlio.c
580
581 WIN32_SRC       =               \
582                 .\win32.c       \
583                 .\win32sck.c    \
584                 .\win32thread.c \
585                 .\fcrypt.c
586
587 # We need this for miniperl build unless we override canned
588 # config.h #define building mini\*
589 #ifeq ($(USE_PERLIO)" == "define"
590 WIN32_SRC       += .\win32io.c
591 #endif
592
593 CORE_NOCFG_H    =               \
594                 ..\av.h         \
595                 ..\cop.h        \
596                 ..\cv.h         \
597                 ..\dosish.h     \
598                 ..\embed.h      \
599                 ..\form.h       \
600                 ..\gv.h         \
601                 ..\handy.h      \
602                 ..\hv.h         \
603                 ..\hv_func.h    \
604                 ..\iperlsys.h   \
605                 ..\mg.h         \
606                 ..\nostdio.h    \
607                 ..\op.h         \
608                 ..\opcode.h     \
609                 ..\perl.h       \
610                 ..\perlapi.h    \
611                 ..\perlsdio.h   \
612                 ..\perly.h      \
613                 ..\pp.h         \
614                 ..\proto.h      \
615                 ..\regcomp.h    \
616                 ..\regexp.h     \
617                 ..\scope.h      \
618                 ..\sv.h         \
619                 ..\thread.h     \
620                 ..\unixish.h    \
621                 ..\utf8.h       \
622                 ..\util.h       \
623                 ..\warnings.h   \
624                 ..\XSUB.h       \
625                 ..\EXTERN.h     \
626                 ..\perlvars.h   \
627                 ..\intrpvar.h   \
628                 .\include\dirent.h      \
629                 .\include\netdb.h       \
630                 .\include\sys\errno2.h  \
631                 .\include\sys\socket.h  \
632                 .\win32.h
633
634 CORE_H          = $(CORE_NOCFG_H) .\config.h ..\git_version.h
635
636 UUDMAP_H        = ..\uudmap.h
637 BITCOUNT_H      = ..\bitcount.h
638 MG_DATA_H       = ..\mg_data.h
639 GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)
640
641 MICROCORE_OBJ   = $(MICROCORE_SRC:.c=.o)
642 CORE_OBJ        = $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=.o)
643 WIN32_OBJ       = $(WIN32_SRC:.c=.o)
644
645 MINICORE_OBJ    = $(subst ..\,mini\,$(MICROCORE_OBJ))   \
646                   $(MINIDIR)\miniperlmain$(o)   \
647                   $(MINIDIR)\perlio$(o)
648 MINIWIN32_OBJ   = $(subst .\,mini\,$(WIN32_OBJ))
649 MINI_OBJ        = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
650 DLL_OBJ         = $(DYNALOADER)
651 GENUUDMAP_OBJ   = $(GENUUDMAP:.exe=.o)
652
653 PERLDLL_OBJ     = $(CORE_OBJ)
654 PERLEXE_OBJ     = perlmain$(o)
655 PERLEXEST_OBJ   = perlmainst$(o)
656
657 PERLDLL_OBJ     += $(WIN32_OBJ) $(DLL_OBJ)
658
659 ifneq ($(USE_SETARGV),)
660 SETARGV_OBJ     = setargv$(o)
661 endif
662
663 ifeq ($(ALL_STATIC),define)
664 # some exclusions, unfortunately, until fixed:
665 #  - MakeMaker isn't capable enough for SDBM_File (small bug)
666 STATIC_EXT      = * !SDBM_File
667 else
668 # specify static extensions here, for example:
669 # (be sure to include Win32CORE to load Win32 on demand)
670 #STATIC_EXT     = Win32CORE Cwd Compress/Raw/Zlib
671 STATIC_EXT      = Win32CORE
672 endif
673
674 DYNALOADER      = ..\DynaLoader$(o)
675
676 # vars must be separated by "\t+~\t+", since we're using the tempfile
677 # version of config_sh.pl (we were overflowing someone's buffer by
678 # trying to fit them all on the command line)
679 #       -- BKS 10-17-1999
680 CFG_VARS        =                                       \
681                 "INST_TOP=$(INST_TOP)"                  \
682                 "INST_VER=$(INST_VER)"                  \
683                 "INST_ARCH=$(INST_ARCH)"                \
684                 "archname=$(ARCHNAME)"                  \
685                 "cc=$(CC)"                              \
686                 "ld=$(LINK32)"                          \
687                 "ccflags=$(EXTRACFLAGS) $(OPTIMIZE) $(DEFINES) $(BUILDOPT)" \
688                 "cf_email=$(EMAIL)"                     \
689                 "d_mymalloc=$(PERL_MALLOC)"             \
690                 "libs=$(LIBFILES)"                      \
691                 "incpath=$(CCINCDIR)"                   \
692                 "libperl=$(subst ..\,,$(PERLIMPLIB))"   \
693                 "libpth=$(CCLIBDIR);$(EXTRALIBDIRS)"    \
694                 "libc=$(LIBC)"                          \
695                 "make=$(MAKE)"                          \
696                 "_o=$(o)"                               \
697                 "obj_ext=$(o)"                          \
698                 "_a=$(a)"                               \
699                 "lib_ext=$(a)"                          \
700                 "static_ext=$(STATIC_EXT)"              \
701                 "usethreads=$(USE_ITHREADS)"            \
702                 "useithreads=$(USE_ITHREADS)"           \
703                 "usemultiplicity=$(USE_MULTI)"          \
704                 "useperlio=$(USE_PERLIO)"               \
705                 "use64bitint=$(USE_64_BIT_INT)"         \
706                 "uselongdouble=$(USE_LONG_DOUBLE)"      \
707                 "uselargefiles=$(USE_LARGE_FILES)"      \
708                 "usesitecustomize=$(USE_SITECUST)"      \
709                 "LINK_FLAGS=$(LINK_FLAGS)"              \
710                 "optimize=$(OPTIMIZE)"                  \
711                 "ARCHPREFIX=$(ARCHPREFIX)"              \
712                 "WIN64=$(WIN64)"
713
714 #
715 # Top targets
716 #
717
718 .PHONY: all info
719
720 all : info .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL)   \
721         $(CONFIGPM) $(UNIDATAFILES) MakePPPort                  \
722         $(PERLEXE) Extensions Extensions_nonxs $(PERLSTATIC)
723
724 info :
725         @echo # GCCBIN=$(GCCBIN)
726         @echo # GCCVER=$(GCCVER1).$(GCCVER2).$(GCCVER3)
727         @echo # GCCTARGET=$(GCCTARGET)
728         @echo # GCCCROSS=$(GCCCROSS)
729         @echo # WIN64=$(WIN64)
730         @echo # ARCHITECTURE=$(ARCHITECTURE)
731         @echo # ARCHNAME=$(ARCHNAME)
732         @echo # MAKE=$(MAKE)
733 ifeq ($(GCCTARGET),)
734         @echo Unable to detect gcc and/or architecture!
735         @exit 1
736 endif
737
738
739 regnodes : ..\regnodes.h
740
741 ..\regcomp$(o) : ..\regnodes.h ..\regcharclass.h
742
743 ..\regexec$(o) : ..\regnodes.h ..\regcharclass.h
744
745 reonly : regnodes .\config.h ..\git_version.h $(GLOBEXE) $(MINIPERL)    \
746         $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE)                          \
747         Extensions_reonly
748
749 static: $(PERLEXESTATIC)
750
751 #----------------------------------------------------------------
752
753 $(GLOBEXE) : perlglob$(o)
754         $(LINK32) $(BLINK_FLAGS) -mconsole -o $@ perlglob$(o) $(LIBFILES)
755
756 perlglob$(o)  : perlglob.c
757
758 config.w32 : $(CFGSH_TMPL)
759         copy $(CFGSH_TMPL) config.w32
760
761 #
762 # Copy the template config.h and set configurables at the end of it
763 # as per the options chosen and compiler used.
764 # Note: This config.h is only used to build miniperl.exe anyway, but
765 # it's as well to have its options correct to be sure that it builds
766 # and so that it's "-V" options are correct for use by makedef.pl. The
767 # real config.h used to build perl.exe is generated from the top-level
768 # config_h.SH by config_h.PL (run by miniperl.exe).
769 #
770 .\config.h : $(CFGH_TMPL) $(CORE_NOCFG_H)
771         -del /f config.h
772         copy $(CFGH_TMPL) config.h
773         @echo.>>$@
774         @echo #ifndef _config_h_footer_>>$@
775         @echo #define _config_h_footer_>>$@
776         @echo #undef Off_t>>$@
777         @echo #undef LSEEKSIZE>>$@
778         @echo #undef Off_t_size>>$@
779         @echo #undef PTRSIZE>>$@
780         @echo #undef SSize_t>>$@
781         @echo #undef HAS_ATOLL>>$@
782         @echo #undef HAS_STRTOLL>>$@
783         @echo #undef HAS_STRTOULL>>$@
784         @echo #undef Size_t_size>>$@
785         @echo #undef IVTYPE>>$@
786         @echo #undef UVTYPE>>$@
787         @echo #undef IVSIZE>>$@
788         @echo #undef UVSIZE>>$@
789         @echo #undef NV_PRESERVES_UV>>$@
790         @echo #undef NV_PRESERVES_UV_BITS>>$@
791         @echo #undef IVdf>>$@
792         @echo #undef UVuf>>$@
793         @echo #undef UVof>>$@
794         @echo #undef UVxf>>$@
795         @echo #undef UVXf>>$@
796         @echo #undef USE_64_BIT_INT>>$@
797         @echo #undef Gconvert>>$@
798         @echo #undef HAS_FREXPL>>$@
799         @echo #undef HAS_ISNANL>>$@
800         @echo #undef HAS_MODFL>>$@
801         @echo #undef HAS_MODFL_PROTO>>$@
802         @echo #undef HAS_SQRTL>>$@
803         @echo #undef HAS_STRTOLD>>$@
804         @echo #undef PERL_PRIfldbl>>$@
805         @echo #undef PERL_PRIgldbl>>$@
806         @echo #undef PERL_PRIeldbl>>$@
807         @echo #undef PERL_SCNfldbl>>$@
808         @echo #undef NVTYPE>>$@
809         @echo #undef NVSIZE>>$@
810         @echo #undef LONG_DOUBLESIZE>>$@
811         @echo #undef NV_OVERFLOWS_INTEGERS_AT>>$@
812         @echo #undef NVef>>$@
813         @echo #undef NVff>>$@
814         @echo #undef NVgf>>$@
815         @echo #undef USE_LONG_DOUBLE>>$@
816 ifeq ($(USE_LARGE_FILES),define)
817         @echo #define Off_t $(INT64)>>$@
818         @echo #define LSEEKSIZE ^8>>$@
819         @echo #define Off_t_size ^8>>$@
820 else
821         @echo #define Off_t long>>$@
822         @echo #define LSEEKSIZE ^4>>$@
823         @echo #define Off_t_size ^4>>$@
824 endif
825 ifeq ($(WIN64),define)
826         @echo #define PTRSIZE ^8>>$@
827         @echo #define SSize_t $(INT64)>>$@
828         @echo #define HAS_ATOLL>>$@
829         @echo #define HAS_STRTOLL>>$@
830         @echo #define HAS_STRTOULL>>$@
831         @echo #define Size_t_size ^8>>$@
832 else
833         @echo #define PTRSIZE ^4>>$@
834         @echo #define SSize_t int>>$@
835         @echo #undef HAS_ATOLL>>$@
836         @echo #undef HAS_STRTOLL>>$@
837         @echo #undef HAS_STRTOULL>>$@
838         @echo #define Size_t_size ^4>>$@
839 endif
840 ifeq ($(USE_64_BIT_INT),define)
841         @echo #define IVTYPE $(INT64)>>$@
842         @echo #define UVTYPE unsigned $(INT64)>>$@
843         @echo #define IVSIZE ^8>>$@
844         @echo #define UVSIZE ^8>>$@
845 ifeq ($(USE_LONG_DOUBLE),define)
846         @echo #define NV_PRESERVES_UV>>$@
847         @echo #define NV_PRESERVES_UV_BITS 64>>$@
848 else
849         @echo #undef NV_PRESERVES_UV>>$@
850         @echo #define NV_PRESERVES_UV_BITS 53>>$@
851 endif
852         @echo #define IVdf "I64d">>$@
853         @echo #define UVuf "I64u">>$@
854         @echo #define UVof "I64o">>$@
855         @echo #define UVxf "I64x">>$@
856         @echo #define UVXf "I64X">>$@
857         @echo #define USE_64_BIT_INT>>$@
858 else
859         @echo #define IVTYPE long>>$@
860         @echo #define UVTYPE unsigned long>>$@
861         @echo #define IVSIZE ^4>>$@
862         @echo #define UVSIZE ^4>>$@
863         @echo #define NV_PRESERVES_UV>>$@
864         @echo #define NV_PRESERVES_UV_BITS 32>>$@
865         @echo #define IVdf "ld">>$@
866         @echo #define UVuf "lu">>$@
867         @echo #define UVof "lo">>$@
868         @echo #define UVxf "lx">>$@
869         @echo #define UVXf "lX">>$@
870         @echo #undef USE_64_BIT_INT>>$@
871 endif
872 ifeq ($(USE_LONG_DOUBLE),define)
873         @echo #define Gconvert(x,n,t,b) sprintf((b),"%%.*""Lg",(n),(x))>>$@
874         @echo #define HAS_FREXPL>>$@
875         @echo #define HAS_ISNANL>>$@
876         @echo #define HAS_MODFL>>$@
877         @echo #define HAS_MODFL_PROTO>>$@
878         @echo #define HAS_SQRTL>>$@
879         @echo #define HAS_STRTOLD>>$@
880         @echo #define PERL_PRIfldbl "Lf">>$@
881         @echo #define PERL_PRIgldbl "Lg">>$@
882         @echo #define PERL_PRIeldbl "Le">>$@
883         @echo #define PERL_SCNfldbl "Lf">>$@
884         @echo #define NVTYPE long double>>$@
885 ifeq ($(WIN64),define)
886         @echo #define NVSIZE ^16>>$@
887         @echo #define LONG_DOUBLESIZE ^16>>$@
888 else
889         @echo #define NVSIZE ^12>>$@
890         @echo #define LONG_DOUBLESIZE ^12>>$@
891 endif
892         @echo #define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0*2.0*2.0*2.0>>$@
893         @echo #define NVef "Le">>$@
894         @echo #define NVff "Lf">>$@
895         @echo #define NVgf "Lg">>$@
896         @echo #define USE_LONG_DOUBLE>>$@
897 else
898         @echo #define Gconvert(x,n,t,b) sprintf((b),"%%.*g",(n),(x))>>$@
899         @echo #undef HAS_FREXPL>>$@
900         @echo #undef HAS_ISNANL>>$@
901         @echo #undef HAS_MODFL>>$@
902         @echo #undef HAS_MODFL_PROTO>>$@
903         @echo #undef HAS_SQRTL>>$@
904         @echo #undef HAS_STRTOLD>>$@
905         @echo #undef PERL_PRIfldbl>>$@
906         @echo #undef PERL_PRIgldbl>>$@
907         @echo #undef PERL_PRIeldbl>>$@
908         @echo #undef PERL_SCNfldbl>>$@
909         @echo #define NVTYPE double>>$@
910         @echo #define NVSIZE ^8>>$@
911         @echo #define LONG_DOUBLESIZE ^8>>$@
912         @echo #define NV_OVERFLOWS_INTEGERS_AT 256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0>>$@
913         @echo #define NVef "e">>$@
914         @echo #define NVff "f">>$@
915         @echo #define NVgf "g">>$@
916         @echo #undef USE_LONG_DOUBLE>>$@
917 endif
918         @echo #endif>>$@
919
920 ..\git_version.h : $(MINIPERL) ..\make_patchnum.pl
921         cd .. && miniperl -Ilib make_patchnum.pl
922
923 # make sure that we recompile perl.c if the git version changes
924 ..\perl$(o) : ..\git_version.h
925
926 ..\config.sh : config.w32 $(MINIPERL) config_sh.PL FindExt.pm
927         $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh
928
929 # This target is for when changes to the main config.sh happen.
930 # Edit config.gc, then make perl using GCC in a minimal configuration (i.e.
931 # with MULTI, ITHREADS, IMP_SYS, LARGE_FILES and PERLIO off), then make
932 # this target to regenerate config_H.gc.
933 regen_config_h:
934         $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS)) $(CFGSH_TMPL) > ..\config.sh
935         $(MINIPERL) -I..\lib ..\configpm --chdir=..
936         -del /f $(CFGH_TMPL)
937         -$(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)"
938         rename config.h $(CFGH_TMPL)
939
940 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL
941         $(MINIPERL) -I..\lib ..\configpm --chdir=..
942         if exist lib\* $(RCOPY) "lib\*.*" ..\lib\$(NULL)
943         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
944         $(XCOPY) "*.h" $(COREDIR)\$(NULL)
945         $(RCOPY) include $(COREDIR)\$(NULL)
946         $(MINIPERL) -I..\lib config_h.PL "ARCHPREFIX=$(ARCHPREFIX)" \
947             || $(MAKE) $(MAKEMACROS) $(CONFIGPM) $(MAKEFILE)
948
949 # See the comment in Makefile.SH explaining this seemingly cranky ordering
950 $(MINIPERL) : ..\lib\buildcustomize.pl
951
952 ..\lib\buildcustomize.pl : $(MINIDIR) $(MINI_OBJ) $(CRTIPMLIBS) ..\write_buildcustomize.pl
953         $(LINK32) -mconsole -o $(MINIPERL) $(BLINK_FLAGS) $(MINI_OBJ) $(LIBFILES)
954         $(MINIPERL) -I..\lib -f ..\write_buildcustomize.pl ..
955
956 $(MINIDIR) :
957         if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
958
959 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
960         $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*F).c
961
962 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
963         $(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*F).c
964
965 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
966 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
967 # unless the .IF is true), so instead we use a else with the default.
968 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
969
970 perllib$(o)     : perllib.c .\perlhost.h .\vdir.h .\vmem.h
971 ifeq ($(USE_IMP_SYS),define)
972         $(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
973 else
974         $(CC) -c -I. $(CFLAGS_O) $(OBJOUT_FLAG)$@ perllib.c
975 endif
976
977 # 1. we don't want to rebuild miniperl.exe when config.h changes
978 # 2. we don't want to rebuild miniperl.exe with non-default config.h
979 # 3. we can't have miniperl.exe depend on git_version.h, as miniperl creates it
980 $(MINI_OBJ)     : $(CORE_NOCFG_H)
981
982 $(WIN32_OBJ)    : $(CORE_H)
983
984 $(CORE_OBJ)     : $(CORE_H)
985
986 $(DLL_OBJ)      : $(CORE_H)
987
988 perldll.def : $(MINIPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl
989         $(MINIPERL) -I..\lib create_perllibst_h.pl
990         $(MINIPERL) -I..\lib -w ..\makedef.pl PLATFORM=win32 $(OPTIMIZE) $(DEFINES) \
991         $(BUILDOPT) CCTYPE=GCC TARG_DIR=..\ > perldll.def
992
993 $(PERLDLL): perldll.def $(PERLDLL_OBJ) $(PERLDLL_RES) Extensions_static
994         $(LINK32) -mdll -o $@ -Wl,--base-file -Wl,perl.base $(BLINK_FLAGS) \
995            $(PERLDLL_OBJ) $(shell type Extensions_static) $(LIBFILES)
996         $(IMPLIB) --output-lib $(PERLIMPLIB) \
997                 --dllname $(PERLDLL) \
998                 --def perldll.def \
999                 --base-file perl.base \
1000                 --output-exp perl.exp
1001         $(LINK32) -mdll -o $@ $(BLINK_FLAGS) \
1002             $(PERLDLL_OBJ) $(shell type Extensions_static) $(LIBFILES) perl.exp
1003         $(XCOPY) $(PERLIMPLIB) $(COREDIR)
1004
1005 $(PERLSTATICLIB): $(PERLDLL_OBJ) Extensions_static
1006         $(LIB32) $(LIB_FLAGS) $@ $(PERLDLL_OBJ)
1007         if exist $(STATICDIR) rmdir /s /q $(STATICDIR)
1008         for %%i in ($(shell type Extensions_static)) do \
1009                 @mkdir $(STATICDIR) && cd $(STATICDIR) && \
1010                 $(ARCHPREFIX)ar x ..\%%i && \
1011                 $(ARCHPREFIX)ar q ..\$@ *$(o) && \
1012                 cd .. && rmdir /s /q $(STATICDIR)
1013         $(XCOPY) $(PERLSTATICLIB) $(COREDIR)
1014
1015 $(PERLEXE_RES): perlexe.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
1016
1017 $(MINIDIR)\globals$(o) : $(GENERATED_HEADERS)
1018
1019 $(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)
1020
1021 $(BITCOUNT_H) : $(GENUUDMAP)
1022         $(GENUUDMAP) $(GENERATED_HEADERS)
1023
1024 $(GENUUDMAP_OBJ) : ..\mg_raw.h
1025
1026 $(GENUUDMAP) : $(GENUUDMAP_OBJ)
1027         $(LINK32) -o $@ $(BLINK_FLAGS) $(GENUUDMAP_OBJ) $(LIBFILES)
1028
1029 perlmain.c : runperl.c
1030         copy runperl.c perlmain.c
1031
1032 perlmain$(o) : perlmain.c
1033         $(CC) $(subst -DPERLDLL,-UPERLDLL,$(CFLAGS_O)) $(OBJOUT_FLAG)$@ -c perlmain.c
1034
1035 perlmainst.c : runperl.c
1036         copy runperl.c perlmainst.c
1037
1038 perlmainst$(o) : perlmainst.c
1039         $(CC) $(CFLAGS_O) $(OBJOUT_FLAG)$@ -c perlmainst.c
1040
1041 $(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ) $(PERLEXE_RES)
1042         $(LINK32) -mconsole -o $@ $(BLINK_FLAGS)  \
1043             $(PERLEXE_OBJ) $(PERLEXE_RES) $(PERLIMPLIB) $(LIBFILES)
1044         copy $(PERLEXE) $(WPERLEXE)
1045         $(MINIPERL) -I..\lib bin\exetype.pl $(WPERLEXE) WINDOWS
1046
1047 $(PERLEXESTATIC): $(PERLSTATICLIB) $(CONFIGPM) $(PERLEXEST_OBJ) $(PERLEXE_RES)
1048         $(LINK32) -mconsole -o $@ $(BLINK_FLAGS) \
1049             $(PERLEXEST_OBJ) $(PERLEXE_RES) $(PERLSTATICLIB) $(LIBFILES)
1050
1051 MakePPPort: $(MINIPERL) $(CONFIGPM) Extensions_nonxs
1052         $(MINIPERL) -I..\lib ..\mkppport
1053
1054 #-------------------------------------------------------------------------------
1055 # There's no direct way to mark a dependency on
1056 # DynaLoader.pm, so this will have to do
1057 Extensions : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
1058         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
1059         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic
1060
1061 Extensions_reonly : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) $(DYNALOADER)
1062         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
1063         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --dynamic +re
1064
1065 Extensions_static : ..\make_ext.pl ..\lib\buildcustomize.pl list_static_libs.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
1066         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
1067         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --static
1068         $(MINIPERL) -I..\lib list_static_libs.pl > Extensions_static
1069
1070 Extensions_nonxs : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) ..\pod\perlfunc.pod
1071         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
1072         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs
1073
1074 $(DYNALOADER) : ..\make_ext.pl ..\lib\buildcustomize.pl $(PERLDEP) $(CONFIGPM) Extensions_nonxs
1075         $(XCOPY) "..\*.h" $(COREDIR)\$(NULL)
1076         $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader
1077
1078 Extensions_clean :
1079         -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=clean
1080
1081 Extensions_realclean :
1082         -if exist $(MINIPERL) $(MINIPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --all --target=realclean
1083
1084 #-------------------------------------------------------------------------------
1085
1086 doc: $(PERLEXE) ..\pod\perltoc.pod
1087         $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=$(HTMLDIR) \
1088             --podpath=pod:lib:utils --htmlroot="file://$(subst :,|,$(INST_HTML))"\
1089             --recurse
1090
1091 ..\utils\Makefile: $(CONFIGPM) ..\utils\Makefile.PL
1092         $(MINIPERL) -I..\lib ..\utils\Makefile.PL ..
1093
1094 # Note that this next section is parsed (and regenerated) by pod/buildtoc
1095 # so please check that script before making structural changes here
1096 utils: $(PERLEXE) ..\utils\Makefile
1097         cd ..\utils && $(MAKE) PERL=$(MINIPERL)
1098         copy ..\README.aix      ..\pod\perlaix.pod
1099         copy ..\README.amiga    ..\pod\perlamiga.pod
1100         copy ..\README.android  ..\pod\perlandroid.pod
1101         copy ..\README.bs2000   ..\pod\perlbs2000.pod
1102         copy ..\README.ce       ..\pod\perlce.pod
1103         copy ..\README.cn       ..\pod\perlcn.pod
1104         copy ..\README.cygwin   ..\pod\perlcygwin.pod
1105         copy ..\README.dos      ..\pod\perldos.pod
1106         copy ..\README.freebsd  ..\pod\perlfreebsd.pod
1107         copy ..\README.haiku    ..\pod\perlhaiku.pod
1108         copy ..\README.hpux     ..\pod\perlhpux.pod
1109         copy ..\README.hurd     ..\pod\perlhurd.pod
1110         copy ..\README.irix     ..\pod\perlirix.pod
1111         copy ..\README.jp       ..\pod\perljp.pod
1112         copy ..\README.ko       ..\pod\perlko.pod
1113         copy ..\README.linux    ..\pod\perllinux.pod
1114         copy ..\README.macos    ..\pod\perlmacos.pod
1115         copy ..\README.macosx   ..\pod\perlmacosx.pod
1116         copy ..\README.netware  ..\pod\perlnetware.pod
1117         copy ..\README.openbsd  ..\pod\perlopenbsd.pod
1118         copy ..\README.os2      ..\pod\perlos2.pod
1119         copy ..\README.os390    ..\pod\perlos390.pod
1120         copy ..\README.os400    ..\pod\perlos400.pod
1121         copy ..\README.plan9    ..\pod\perlplan9.pod
1122         copy ..\README.qnx      ..\pod\perlqnx.pod
1123         copy ..\README.riscos   ..\pod\perlriscos.pod
1124         copy ..\README.solaris  ..\pod\perlsolaris.pod
1125         copy ..\README.symbian  ..\pod\perlsymbian.pod
1126         copy ..\README.synology ..\pod\perlsynology.pod
1127         copy ..\README.tru64    ..\pod\perltru64.pod
1128         copy ..\README.tw       ..\pod\perltw.pod
1129         copy ..\README.vos      ..\pod\perlvos.pod
1130         copy ..\README.win32    ..\pod\perlwin32.pod
1131         copy ..\pod\perldelta.pod ..\pod\perl5230delta.pod
1132         $(PERLEXE) $(PL2BAT) $(UTILS)
1133         $(MINIPERL) -I..\lib ..\autodoc.pl ..
1134         $(MINIPERL) -I..\lib ..\pod\perlmodlib.PL -q ..
1135
1136 ..\pod\perltoc.pod: $(PERLEXE) Extensions Extensions_nonxs
1137         $(PERLEXE) -f ..\pod\buildtoc -q
1138
1139 # Note that the pod cleanup in this next section is parsed (and regenerated
1140 # by pod/buildtoc so please check that script before making changes here
1141
1142 distclean: realclean
1143         -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
1144                 $(PERLIMPLIB) ..\miniperl$(a) $(PERLEXESTATIC) $(PERLSTATICLIB)
1145         -del /f $(LIBDIR)\Encode.pm $(LIBDIR)\encoding.pm $(LIBDIR)\Errno.pm
1146         -del /f $(LIBDIR)\Config.pod $(LIBDIR)\POSIX.pod $(LIBDIR)\threads.pm
1147         -del /f $(LIBDIR)\.exists $(LIBDIR)\attributes.pm $(LIBDIR)\DynaLoader.pm
1148         -del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
1149         -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm
1150         -del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
1151         -del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
1152         -del /f $(LIBDIR)\File\Glob.pm
1153         -del /f $(LIBDIR)\Storable.pm
1154         -del /f $(LIBDIR)\Sys\Hostname.pm
1155         -del /f $(LIBDIR)\Time\HiRes.pm
1156         -del /f $(LIBDIR)\Unicode\Normalize.pm
1157         -del /f $(LIBDIR)\Math\BigInt\FastCalc.pm
1158         -del /f $(LIBDIR)\Win32.pm
1159         -del /f $(LIBDIR)\Win32CORE.pm
1160         -del /f $(LIBDIR)\Win32API\File.pm
1161         -del /f $(LIBDIR)\Win32API\File\cFile.pc
1162         -del /f $(LIBDIR)\buildcustomize.pl
1163         -del /f $(DISTDIR)\XSLoader\XSLoader.pm
1164         -del /f *.def *.map
1165         -if exist $(LIBDIR)\App rmdir /s /q $(LIBDIR)\App
1166         -if exist $(LIBDIR)\Archive rmdir /s /q $(LIBDIR)\Archive
1167         -if exist $(LIBDIR)\Attribute rmdir /s /q $(LIBDIR)\Attribute
1168         -if exist $(LIBDIR)\autodie rmdir /s /q $(LIBDIR)\autodie
1169         -if exist $(LIBDIR)\Carp rmdir /s /q $(LIBDIR)\Carp
1170         -if exist $(LIBDIR)\Compress rmdir /s /q $(LIBDIR)\Compress
1171         -if exist $(LIBDIR)\Config\Perl rmdir /s /q $(LIBDIR)\Config\Perl
1172         -if exist $(LIBDIR)\CPAN rmdir /s /q $(LIBDIR)\CPAN
1173         -if exist $(LIBDIR)\Data rmdir /s /q $(LIBDIR)\Data
1174         -if exist $(LIBDIR)\Devel rmdir /s /q $(LIBDIR)\Devel
1175         -if exist $(LIBDIR)\Digest rmdir /s /q $(LIBDIR)\Digest
1176         -if exist $(LIBDIR)\Encode rmdir /s /q $(LIBDIR)\Encode
1177         -if exist $(LIBDIR)\encoding rmdir /s /q $(LIBDIR)\encoding
1178         -if exist $(LIBDIR)\Exporter rmdir /s /q $(LIBDIR)\Exporter
1179         -if exist $(LIBDIR)\ExtUtils\CBuilder rmdir /s /q $(LIBDIR)\ExtUtils\CBuilder
1180         -if exist $(LIBDIR)\ExtUtils\Command rmdir /s /q $(LIBDIR)\ExtUtils\Command
1181         -if exist $(LIBDIR)\ExtUtils\Constant rmdir /s /q $(LIBDIR)\ExtUtils\Constant
1182         -if exist $(LIBDIR)\ExtUtils\Liblist rmdir /s /q $(LIBDIR)\ExtUtils\Liblist
1183         -if exist $(LIBDIR)\ExtUtils\MakeMaker rmdir /s /q $(LIBDIR)\ExtUtils\MakeMaker
1184         -if exist $(LIBDIR)\ExtUtils\ParseXS rmdir /s /q $(LIBDIR)\ExtUtils\ParseXS
1185         -if exist $(LIBDIR)\ExtUtils\Typemaps rmdir /s /q $(LIBDIR)\ExtUtils\Typemaps
1186         -if exist $(LIBDIR)\File\Spec rmdir /s /q $(LIBDIR)\File\Spec
1187         -if exist $(LIBDIR)\Filter rmdir /s /q $(LIBDIR)\Filter
1188         -if exist $(LIBDIR)\Hash rmdir /s /q $(LIBDIR)\Hash
1189         -if exist $(LIBDIR)\HTTP rmdir /s /q $(LIBDIR)\HTTP
1190         -if exist $(LIBDIR)\I18N rmdir /s /q $(LIBDIR)\I18N
1191         -if exist $(LIBDIR)\IO rmdir /s /q $(LIBDIR)\IO
1192         -if exist $(LIBDIR)\IPC rmdir /s /q $(LIBDIR)\IPC
1193         -if exist $(LIBDIR)\JSON rmdir /s /q $(LIBDIR)\JSON
1194         -if exist $(LIBDIR)\List rmdir /s /q $(LIBDIR)\List
1195         -if exist $(LIBDIR)\Locale rmdir /s /q $(LIBDIR)\Locale
1196         -if exist $(LIBDIR)\Math rmdir /s /q $(LIBDIR)\Math
1197         -if exist $(LIBDIR)\Memoize rmdir /s /q $(LIBDIR)\Memoize
1198         -if exist $(LIBDIR)\MIME rmdir /s /q $(LIBDIR)\MIME
1199         -if exist $(LIBDIR)\Module rmdir /s /q $(LIBDIR)\Module
1200         -if exist $(LIBDIR)\Net\FTP rmdir /s /q $(LIBDIR)\Net\FTP
1201         -if exist $(LIBDIR)\Params rmdir /s /q $(LIBDIR)\Params
1202         -if exist $(LIBDIR)\Parse rmdir /s /q $(LIBDIR)\Parse
1203         -if exist $(LIBDIR)\Perl rmdir /s /q $(LIBDIR)\Perl
1204         -if exist $(LIBDIR)\PerlIO rmdir /s /q $(LIBDIR)\PerlIO
1205         -if exist $(LIBDIR)\Pod\Perldoc rmdir /s /q $(LIBDIR)\Pod\Perldoc
1206         -if exist $(LIBDIR)\Pod\Simple rmdir /s /q $(LIBDIR)\Pod\Simple
1207         -if exist $(LIBDIR)\Pod\Text rmdir /s /q $(LIBDIR)\Pod\Text
1208         -if exist $(LIBDIR)\Scalar rmdir /s /q $(LIBDIR)\Scalar
1209         -if exist $(LIBDIR)\Search rmdir /s /q $(LIBDIR)\Search
1210         -if exist $(LIBDIR)\Sub rmdir /s /q $(LIBDIR)\Sub
1211         -if exist $(LIBDIR)\Sys rmdir /s /q $(LIBDIR)\Sys
1212         -if exist $(LIBDIR)\TAP rmdir /s /q $(LIBDIR)\TAP
1213         -if exist $(LIBDIR)\Term rmdir /s /q $(LIBDIR)\Term
1214         -if exist $(LIBDIR)\Test rmdir /s /q $(LIBDIR)\Test
1215         -if exist $(LIBDIR)\Text rmdir /s /q $(LIBDIR)\Text
1216         -if exist $(LIBDIR)\Thread rmdir /s /q $(LIBDIR)\Thread
1217         -if exist $(LIBDIR)\threads rmdir /s /q $(LIBDIR)\threads
1218         -if exist $(LIBDIR)\Tie\Hash rmdir /s /q $(LIBDIR)\Tie\Hash
1219         -if exist $(LIBDIR)\Unicode\Collate rmdir /s /q $(LIBDIR)\Unicode\Collate
1220         -if exist $(LIBDIR)\Unicode\Collate\Locale rmdir /s /q $(LIBDIR)\Unicode\Collate\Locale
1221         -if exist $(LIBDIR)\version rmdir /s /q $(LIBDIR)\version
1222         -if exist $(LIBDIR)\VMS rmdir /s /q $(LIBDIR)\VMS
1223         -if exist $(LIBDIR)\Win32API rmdir /s /q $(LIBDIR)\Win32API
1224         -if exist $(LIBDIR)\XS rmdir /s /q $(LIBDIR)\XS
1225         -cd $(PODDIR) && del /f *.html *.bat roffitall \
1226             perl5230delta.pod perlaix.pod perlamiga.pod perlandroid.pod \
1227             perlapi.pod perlbs2000.pod perlce.pod perlcn.pod perlcygwin.pod \
1228             perldos.pod perlfreebsd.pod perlhaiku.pod perlhpux.pod \
1229             perlhurd.pod perlintern.pod perlirix.pod perljp.pod perlko.pod \
1230             perllinux.pod perlmacos.pod perlmacosx.pod perlmodlib.pod \
1231             perlnetware.pod perlopenbsd.pod perlos2.pod perlos390.pod \
1232             perlos400.pod perlplan9.pod perlqnx.pod perlriscos.pod \
1233             perlsolaris.pod perlsymbian.pod perlsynology.pod perltoc.pod \
1234             perltru64.pod perltw.pod perluniprops.pod perlvos.pod \
1235             perlwin32.pod
1236         -cd ..\utils && del /f h2ph splain perlbug pl2pm c2ph pstruct h2xs \
1237             perldoc perlivp libnetcfg enc2xs piconv cpan *.bat \
1238             xsubpp pod2html instmodsh json_pp prove ptar ptardiff ptargrep shasum corelist zipdetails
1239         -del /f ..\config.sh perlmain.c dlutils.c config.h.new \
1240             perlmainst.c
1241         -del /f $(CONFIGPM)
1242         -del /f ..\lib\Config_git.pl
1243         -del /f "bin\*.bat"
1244         -del /f perllibst.h
1245         -del /f $(PERLEXE_RES) perl.base
1246         -cd .. && del /s *$(a) *.map *.pdb *.ilk *.bs *$(o) .exists pm_to_blib ppport.h
1247         -cd $(EXTDIR) && del /s *.def Makefile Makefile.old
1248         -cd $(DISTDIR) && del /s *.def Makefile Makefile.old
1249         -cd $(CPANDIR) && del /s *.def Makefile Makefile.old
1250         -del /s ..\utils\Makefile
1251         -if exist $(AUTODIR) rmdir /s /q $(AUTODIR)
1252         -if exist $(COREDIR) rmdir /s /q $(COREDIR)
1253         -if exist pod2htmd.tmp del pod2htmd.tmp
1254         -if exist $(HTMLDIR) rmdir /s /q $(HTMLDIR)
1255         -del /f ..\t\test_state
1256
1257 install : all installbare installhtml
1258
1259 installbare : utils ..\pod\perltoc.pod
1260         $(PERLEXE) ..\installperl
1261         if exist $(WPERLEXE) $(XCOPY) $(WPERLEXE) $(INST_BIN)\$(NULL)
1262         if exist $(PERLEXESTATIC) $(XCOPY) $(PERLEXESTATIC) $(INST_BIN)\$(NULL)
1263         $(XCOPY) $(GLOBEXE) $(INST_BIN)\$(NULL)
1264         if exist ..\perl*.pdb $(XCOPY) ..\perl*.pdb $(INST_BIN)\$(NULL)
1265         $(XCOPY) "bin\*.bat" $(INST_SCRIPT)\$(NULL)
1266
1267 installhtml : doc
1268         $(RCOPY) $(HTMLDIR)\*.* $(INST_HTML)\$(NULL)
1269
1270 inst_lib : $(CONFIGPM)
1271         $(RCOPY) ..\lib $(INST_LIB)\$(NULL)
1272
1273 $(UNIDATAFILES) ..\pod\perluniprops.pod .UPDATEALL : $(MINIPERL) $(CONFIGPM) ..\lib\unicore\mktables Extensions_nonxs
1274         cd ..\lib\unicore && \
1275         ..\$(MINIPERL) -I.. -I..\..\dist\Cwd\lib -I..\..\dist\Cwd mktables -P ..\..\pod -maketest -makelist -p
1276
1277 minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
1278         $(XCOPY) $(MINIPERL) ..\t\$(NULL)
1279         if exist ..\t\perl.exe del /f ..\t\perl.exe
1280         rename ..\t\miniperl.exe perl.exe
1281         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1282         attrib -r "..\t\*.*"
1283         cd ..\t && \
1284         $(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
1285
1286 test-prep : all utils ..\pod\perltoc.pod
1287         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1288         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1289         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1290 # If building with gcc versions 4.x.x or greater, then
1291 # the GCC helper DLL will also need copied to the test directory.
1292 # The name of the dll can change, depending upon which vendor has supplied
1293 # your compiler, and upon the values of "x".
1294 # libstdc++-6.dll is copied if it exists as it, too, may then be needed.
1295 # Without this copying, the op/taint.t test script will fail.
1296         if exist $(CCDLLDIR)\libgcc_s_seh-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_seh-1.dll ..\t\$(NULL)
1297         if exist $(CCDLLDIR)\libgcc_s_sjlj-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_sjlj-1.dll ..\t\$(NULL)
1298         if exist $(CCDLLDIR)\libgcc_s_dw2-1.dll $(XCOPY) $(CCDLLDIR)\libgcc_s_dw2-1.dll ..\t\$(NULL)
1299         if exist $(CCDLLDIR)\libstdc++-6.dll $(XCOPY) $(CCDLLDIR)\libstdc++-6.dll ..\t\$(NULL)
1300         if exist $(CCDLLDIR)\libwinpthread-1.dll $(XCOPY) $(CCDLLDIR)\libwinpthread-1.dll ..\t\$(NULL)
1301
1302 test : test-prep
1303         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1304             cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1305
1306 test_porting : test-prep
1307         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1308             cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
1309
1310 test-reonly : reonly utils
1311         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1312         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1313         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1314         cd ..\t && \
1315         $(PERLEXE) -I..\lib harness $(OPT) -re \bpat\\/ $(EXTRA) && \
1316         cd ..\win32
1317
1318 regen :
1319         cd .. && regen.pl && cd win32
1320
1321 test-notty : test-prep
1322         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1323             set PERL_SKIP_TTY_TEST=1 && \
1324             cd ..\t && $(PERLEXE) -I.\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1325
1326 _test :
1327         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
1328         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
1329         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
1330         set PERL_STATIC_EXT=$(STATIC_EXT) && \
1331             cd ..\t && $(PERLEXE) -I..\lib harness $(TEST_SWITCHES) $(TEST_FILES)
1332
1333 _clean :
1334         -@erase miniperlmain$(o)
1335         -@erase $(MINIPERL)
1336         -@erase perlglob$(o)
1337         -@erase perlmain$(o)
1338         -@erase perlmainst$(o)
1339         -@erase config.w32
1340         -@erase /f config.h
1341         -@erase /f ..\git_version.h
1342         -@erase $(GLOBEXE)
1343         -@erase $(PERLEXE)
1344         -@erase $(WPERLEXE)
1345         -@erase $(PERLEXESTATIC)
1346         -@erase $(PERLSTATICLIB)
1347         -@erase $(PERLDLL)
1348         -@erase $(CORE_OBJ)
1349         -@erase $(GENUUDMAP) $(GENUUDMAP_OBJ) $(GENERATED_HEADERS)
1350         -if exist $(MINIDIR) rmdir /s /q $(MINIDIR)
1351         -if exist $(UNIDATADIR1) rmdir /s /q $(UNIDATADIR1)
1352         -if exist $(UNIDATADIR2) rmdir /s /q $(UNIDATADIR2)
1353         -@erase $(UNIDATAFILES)
1354         -@erase $(WIN32_OBJ)
1355         -@erase $(DLL_OBJ)
1356         -@erase ..\*$(o) ..\*$(a) ..\*.exp *$(o) *$(a) *.exp *.res
1357         -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
1358         -@erase *.ilk
1359         -@erase *.pdb
1360         -@erase Extensions_static
1361
1362 clean : Extensions_clean _clean
1363
1364 realclean : Extensions_realclean _clean
1365
1366 # Handy way to run perlbug -ok without having to install and run the
1367 # installed perlbug. We don't re-run the tests here - we trust the user.
1368 # Please *don't* use this unless all tests pass.
1369 # If you want to report test failures, use "gmake nok" instead.
1370 ok: utils
1371         $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)"
1372
1373 okfile: utils
1374         $(PERLEXE) -I..\lib ..\utils\perlbug -ok -s "(UNINSTALLED)" -F perl.ok
1375
1376 nok: utils
1377         $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)"
1378
1379 nokfile: utils
1380         $(PERLEXE) -I..\lib ..\utils\perlbug -nok -s "(UNINSTALLED)" -F perl.nok