This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
applied patch from Ilya, tweaked some to get clean static build of
[perl5.git] / win32 / Makefile
CommitLineData
e7083a8c
DL
1#
2# Makefile to build perl on Windows NT using Microsoft NMAKE.
68dc0745
PP
3#
4# This is set up to build a perl.exe that runs off a shared library
5# (perl.dll). Also makes individual DLLs for the XS extensions.
e7083a8c
DL
6#
7
8##
9## Build configuration. Edit the values below to suit your needs.
10##
11
137443ea
PP
12#
13# Set these to wherever you want "nmake install" to put your
14# newly built perl.
e7083a8c 15#
eb480a0b 16INST_DRV = c:
e5a95ffb
GS
17INST_TOP = $(INST_DRV)\perl
18
e7083a8c 19#
e5a95ffb
GS
20# Comment this out if you DON'T want your perl installation to be versioned.
21# This means that the new installation will overwrite any files from the
22# old installation at the same INST_TOP location. Leaving it enabled is
23# the safest route, as perl adds the extra version directory to all the
24# locations it installs files to. If you disable it, an alternative
25# versioned installation can be obtained by setting INST_TOP above to a
26# path that includes an arbitrary version string.
e7083a8c 27#
0b2be3f5 28INST_VER = \5.00470
d07c2202
GS
29
30#
31# uncomment to enable threads-capabilities
e7083a8c 32#
eb480a0b 33#USE_THREADS = define
137443ea 34
c90c0ff4 35#
c90c0ff4 36# uncomment next line if you are using Visual C++ 2.x
e7083a8c 37#
eb480a0b 38#CCTYPE = MSVC20
c90c0ff4
PP
39
40#
76e3520e 41# uncomment next line if you want to use the perl object
26ca90b6 42# Currently, this cannot be enabled if you ask for threads above
e7083a8c 43#
26ca90b6 44#OBJECT = -DPERL_OBJECT
76e3520e
GS
45
46#
c90c0ff4 47# uncomment next line if you want debug version of perl (big,slow)
e7083a8c 48#
eb480a0b 49#CFG = Debug
137443ea 50
d484a829 51#
e7083a8c
DL
52# uncomment to enable use of PerlCRT.DLL. Highly recommended. It has
53# patches that fix known bugs in MSCVRT.DLL. You will need to download it
54# from: <TBD> and follow the directions in the package to install.
55#
56#USE_PERLCRT = define
57
58#
26618a56 59# if you have the source for des_fcrypt(), uncomment this and make sure the
a1dd9325
GS
60# file exists (see README.win32). File should be located at the perl
61# top level directory.
e7083a8c 62#
eb480a0b 63#CRYPT_SRC = des_fcrypt.c
26618a56
GS
64
65#
66# if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
67# library, uncomment this, and make sure the library exists (see README.win32)
a1dd9325 68# Specify the full pathname of the library.
e7083a8c 69#
eb480a0b 70#CRYPT_LIB = des_fcrypt.lib
26618a56
GS
71
72#
1c1c7f20
GS
73# set this if you wish to use perl's malloc
74# WARNING: Turning this on/off WILL break binary compatibility with extensions
5fd76c3e
GS
75# you may have compiled with/without it. Be prepared to recompile all
76# extensions if you change the default. Currently, this cannot be enabled
77# if you ask for PERL_OBJECT above.
e7083a8c 78#
01f988be 79#PERL_MALLOC = define
1c1c7f20
GS
80
81#
3e3baf6d 82# set the install locations of the compiler include/libraries
eb480a0b
GS
83#
84#CCHOME = f:\msvc20
85CCHOME = $(MSVCDIR)
86CCINCDIR = $(CCHOME)\include
87CCLIBDIR = $(CCHOME)\lib
3e3baf6d
TB
88
89#
fa4efe8e
GS
90# specify space-separated list of extra directories to look for libraries
91#
92EXTRALIBDIRS =
93
94#
d484a829
GS
95# set this to your email address (perl will guess a value from
96# from your loginname and your hostname, which may not be right)
e7083a8c 97#
eb480a0b 98#EMAIL =
d484a829 99
e7083a8c
DL
100##
101## Build configuration ends.
102##
103
137443ea
PP
104##################### CHANGE THESE ONLY IF YOU MUST #####################
105
26618a56 106!IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
eb480a0b 107D_CRYPT = undef
26618a56 108!ELSE
eb480a0b
GS
109D_CRYPT = define
110CRYPT_FLAG = -DHAVE_DES_FCRYPT
111!ENDIF
112
113!IF "$(OBJECT)" != ""
114PERL_MALLOC = undef
26618a56
GS
115!ENDIF
116
1c1c7f20
GS
117!IF "$(PERL_MALLOC)" == ""
118PERL_MALLOC = undef
119!ENDIF
120
eb480a0b
GS
121!IF "$(USE_THREADS)" == ""
122USE_THREADS = undef
123!ENDIF
124
924b3ec4
GS
125#BUILDOPT = -DMULTIPLICITY
126#BUILDOPT = -DPERL_GLOBAL_STRUCT -DMULTIPLICITY
d07c2202
GS
127# -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include
128
129!IF "$(PROCESSOR_ARCHITECTURE)" == ""
130PROCESSOR_ARCHITECTURE = x86
131!ENDIF
132
924b3ec4 133!IF "$(USE_THREADS)" == "define"
d07c2202 134ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-thread
924b3ec4
GS
135!ELSE
136ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)
d07c2202
GS
137!ENDIF
138
139ARCHDIR = ..\lib\$(ARCHNAME)
140COREDIR = ..\lib\CORE
eb480a0b 141AUTODIR = ..\lib\auto
d07c2202 142
137443ea
PP
143#
144# Programs to compile, build .lib files and link
145#
68dc0745 146
eb480a0b
GS
147CC = cl.exe
148LINK32 = link.exe
149LIB32 = $(LINK32) -lib
150
68dc0745 151#
137443ea
PP
152# Options
153#
eb480a0b 154
af883608 155RUNTIME = -MD
eb480a0b
GS
156INCLUDES = -I.\include -I. -I..
157#PCHFLAGS = -Fpc:\temp\vcmoduls.pch -YX
158DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG)
159LOCDEFS = -DPERLDLL -DPERL_CORE
160SUBSYS = console
161CXX_FLAG = -TP -GX
137443ea 162
e7083a8c
DL
163!IF "$(USE_PERLCRT)" == ""
164! IF "$(CFG)" == "Debug"
165PERLCRTLIBC = msvcrtd.lib
166! ELSE
167PERLCRTLIBC = msvcrt.lib
168! ENDIF
169!ELSE
170! IF "$(CFG)" == "Debug"
171PERLCRTLIBC = PerlCRTD.lib
172! ELSE
173PERLCRTLIBC = PerlCRT.lib
174! ENDIF
175!ENDIF
176
137443ea 177!IF "$(RUNTIME)" == "-MD"
e7083a8c 178LIBC = $(PERLCRTLIBC)
137443ea 179!ELSE
eb480a0b 180LIBC = libcmt.lib
137443ea
PP
181!ENDIF
182
183!IF "$(CFG)" == "Debug"
184! IF "$(CCTYPE)" == "MSVC20"
eb480a0b 185OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING
137443ea 186! ELSE
3dfd1da1 187OPTIMIZE = -Od $(RUNTIME)d -Zi -D_DEBUG -DDEBUGGING
137443ea 188! ENDIF
eb480a0b 189LINK_DBG = -debug -pdb:none
137443ea
PP
190!ELSE
191! IF "$(CCTYPE)" == "MSVC20"
af883608 192OPTIMIZE = -Od $(RUNTIME) -DNDEBUG
137443ea 193! ELSE
af883608 194OPTIMIZE = -Od $(RUNTIME) -DNDEBUG
137443ea 195! ENDIF
eb480a0b
GS
196LINK_DBG = -release
197!ENDIF
198
199!IF "$(OBJECT)" != ""
200OPTIMIZE = $(OPTIMIZE) $(CXX_FLAG)
137443ea 201!ENDIF
68dc0745 202
e7083a8c 203LIBBASEFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
eb480a0b
GS
204 winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
205 oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
206 version.lib odbc32.lib odbccp32.lib
3e3baf6d 207
e7083a8c
DL
208# we add LIBC here, since we may be using PerlCRT.dll
209LIBFILES = $(LIBBASEFILES) $(LIBC)
210
eb480a0b
GS
211CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
212 $(PCHFLAGS) $(OPTIMIZE)
e7083a8c 213LINK_FLAGS = -nologo -nodefaultlib $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
eb480a0b
GS
214OBJOUT_FLAG = -Fo
215EXEOUT_FLAG = -Fe
216
217CFLAGS_O = $(CFLAGS) $(OBJECT)
137443ea
PP
218
219#################### do not edit below this line #######################
220############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
221
d56e6723
GS
222o = .obj
223
137443ea
PP
224#
225# Rules
226#
137443ea 227
d56e6723
GS
228.SUFFIXES : .c $(o) .dll .lib .exe
229
230.c$(o):
eb480a0b
GS
231 $(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<
232
233.y.c:
234 $(NOOP)
137443ea 235
d56e6723 236$(o).dll:
3e3baf6d 237 $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
dc050285 238 -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
68dc0745 239
68dc0745 240#
e5a95ffb
GS
241INST_BIN = $(INST_TOP)$(INST_VER)\bin\$(ARCHNAME)
242INST_SCRIPT = $(INST_TOP)$(INST_VER)\bin
243INST_LIB = $(INST_TOP)$(INST_VER)\lib
eb480a0b
GS
244INST_POD = $(INST_LIB)\pod
245INST_HTML = $(INST_POD)\html
246LIBDIR = ..\lib
247EXTDIR = ..\ext
248PODDIR = ..\pod
249EXTUTILSDIR = $(LIBDIR)\extutils
68dc0745
PP
250
251#
252# various targets
eb480a0b
GS
253!IF "$(OBJECT)" == "-DPERL_OBJECT"
254PERLIMPLIB = ..\perlcore.lib
255PERLDLL = ..\perlcore.dll
e3b8966e 256CAPILIB = $(COREDIR)\PerlCAPI.lib
eb480a0b
GS
257!ELSE
258PERLIMPLIB = ..\perl.lib
259PERLDLL = ..\perl.dll
e3b8966e 260CAPILIB =
26618a56
GS
261!ENDIF
262
eb480a0b
GS
263MINIPERL = ..\miniperl.exe
264MINIDIR = .\mini
265PERLEXE = ..\perl.exe
266GLOBEXE = ..\perlglob.exe
267CONFIGPM = ..\lib\Config.pm
268MINIMOD = ..\lib\ExtUtils\Miniperl.pm
269X2P = ..\x2p\a2p.exe
270
271PL2BAT = bin\pl2bat.pl
272GLOBBAT = bin\perlglob.bat
273
4a71ed0c
GS
274UTILS = \
275 ..\utils\h2ph \
276 ..\utils\splain \
277 ..\utils\perlbug \
278 ..\utils\pl2pm \
279 ..\utils\c2ph \
280 ..\utils\h2xs \
281 ..\utils\perldoc \
282 ..\utils\pstruct \
283 ..\utils\perlcc \
284 ..\pod\checkpods \
285 ..\pod\pod2html \
286 ..\pod\pod2latex \
287 ..\pod\pod2man \
288 ..\pod\pod2text \
289 ..\x2p\find2perl \
290 ..\x2p\s2p \
291 bin\www.pl \
292 bin\runperl.pl \
293 bin\pl2bat.pl \
294 bin\perlglob.pl \
295 bin\search.pl
296
eb480a0b
GS
297MAKE = nmake -nologo
298
299CFGSH_TMPL = config.vc
300CFGH_TMPL = config_H.vc
e7083a8c
DL
301
302!IF "$(USE_PERLCRT)" == ""
eb480a0b 303PERL95EXE = ..\perl95.exe
e7083a8c 304!ENDIF
eb480a0b
GS
305
306XCOPY = xcopy /f /r /i /d
307RCOPY = xcopy /f /r /i /e /d
308NOOP = @echo
309NULL =
1c1c7f20 310
68dc0745
PP
311#
312# filenames given to xsubpp must have forward slashes (since it puts
313# full pathnames in #line strings)
eb480a0b
GS
314XSUBPP = ..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp \
315 -C++ -prototypes
316
852c2e52 317MICROCORE_SRC = \
eb480a0b
GS
318 ..\av.c \
319 ..\byterun.c \
320 ..\deb.c \
321 ..\doio.c \
322 ..\doop.c \
323 ..\dump.c \
324 ..\globals.c \
325 ..\gv.c \
326 ..\hv.c \
327 ..\mg.c \
328 ..\op.c \
329 ..\perl.c \
330 ..\perly.c \
331 ..\pp.c \
332 ..\pp_ctl.c \
333 ..\pp_hot.c \
334 ..\pp_sys.c \
335 ..\regcomp.c \
336 ..\regexec.c \
337 ..\run.c \
338 ..\scope.c \
339 ..\sv.c \
340 ..\taint.c \
341 ..\toke.c \
342 ..\universal.c \
343 ..\util.c
344
a1dd9325 345!IF "$(CRYPT_SRC)" != ""
852c2e52 346MICROCORE_SRC = $(MICROCORE_SRC) ..\$(CRYPT_SRC)
a1dd9325 347!ENDIF
eb480a0b
GS
348
349!IF "$(PERL_MALLOC)" == "define"
852c2e52 350EXTRACORE_SRC = $(EXTRACORE_SRC) ..\malloc.c
eb480a0b
GS
351!ENDIF
352
353!IF "$(OBJECT)" == ""
852c2e52 354EXTRACORE_SRC = $(EXTRACORE_SRC) ..\perlio.c
eb480a0b
GS
355!ENDIF
356
357WIN32_SRC = \
358 .\win32.c \
359 .\win32sck.c
360
361!IF "$(USE_THREADS)" == "define"
362WIN32_SRC = $(WIN32_SRC) .\win32thread.c
363!ENDIF
364
365PERL95_SRC = \
366 perl95.c \
367 win32mt.c \
368 win32sckmt.c
369
a1dd9325
GS
370!IF "$(CRYPT_SRC)" != ""
371PERL95_SRC = $(PERL95_SRC) ..\$(CRYPT_SRC)
372!ENDIF
373
eb480a0b
GS
374DLL_SRC = $(DYNALOADER).c
375
376
377!IF "$(OBJECT)" == ""
378DLL_SRC = $(DLL_SRC) perllib.c
379!ENDIF
380
381X2P_SRC = \
382 ..\x2p\a2p.c \
383 ..\x2p\hash.c \
384 ..\x2p\str.c \
385 ..\x2p\util.c \
386 ..\x2p\walk.c
387
852c2e52 388CORE_NOCFG_H = \
eb480a0b
GS
389 ..\av.h \
390 ..\byterun.h \
391 ..\bytecode.h \
392 ..\cop.h \
393 ..\cv.h \
394 ..\dosish.h \
395 ..\embed.h \
396 ..\form.h \
397 ..\gv.h \
398 ..\handy.h \
399 ..\hv.h \
0f4eea8f 400 ..\iperlsys.h \
eb480a0b
GS
401 ..\mg.h \
402 ..\nostdio.h \
403 ..\op.h \
404 ..\opcode.h \
405 ..\perl.h \
eb480a0b
GS
406 ..\perlsdio.h \
407 ..\perlsfio.h \
408 ..\perly.h \
409 ..\pp.h \
410 ..\proto.h \
411 ..\regexp.h \
412 ..\scope.h \
413 ..\sv.h \
414 ..\thread.h \
415 ..\unixish.h \
416 ..\util.h \
417 ..\XSUB.h \
eb480a0b
GS
418 ..\EXTERN.h \
419 ..\perlvars.h \
420 ..\intrpvar.h \
421 ..\thrdvar.h \
422 .\include\dirent.h \
423 .\include\netdb.h \
424 .\include\sys\socket.h \
425 .\win32.h
426
852c2e52
GS
427CORE_H = $(CORE_NOCFG_H) .\config.h
428
429MICROCORE_OBJ = $(MICROCORE_SRC:.c=.obj)
430CORE_OBJ = $(MICROCORE_OBJ) $(EXTRACORE_SRC:.c=.obj)
eb480a0b 431WIN32_OBJ = $(WIN32_SRC:.c=.obj)
852c2e52
GS
432MINICORE_OBJ = $(MICROCORE_OBJ:..\=.\mini\) \
433 $(MINIDIR)\miniperlmain$(o) \
434 $(MINIDIR)\perlio$(o)
eb480a0b
GS
435MINIWIN32_OBJ = $(WIN32_OBJ:.\=.\mini\)
436MINI_OBJ = $(MINICORE_OBJ) $(MINIWIN32_OBJ)
af883608 437PERL95_OBJ = $(PERL95_SRC:.c=.obj)
eb480a0b
GS
438DLL_OBJ = $(DLL_SRC:.c=.obj)
439X2P_OBJ = $(X2P_SRC:.c=.obj)
440
eb480a0b
GS
441PERLDLL_OBJ = $(CORE_OBJ)
442PERLEXE_OBJ = perlmain$(o)
443
444!IF "$(OBJECT)" == ""
445PERLDLL_OBJ = $(PERLDLL_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
446!ELSE
447PERLEXE_OBJ = $(PERLEXE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
af883608 448PERL95_OBJ = $(PERL95_OBJ) DynaLoadmt$(o)
eb480a0b
GS
449!ENDIF
450
451DYNAMIC_EXT = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B
452STATIC_EXT = DynaLoader
eab60bb1 453NONXS_EXT = Errno
eb480a0b
GS
454
455DYNALOADER = $(EXTDIR)\DynaLoader\DynaLoader
456SOCKET = $(EXTDIR)\Socket\Socket
457FCNTL = $(EXTDIR)\Fcntl\Fcntl
458OPCODE = $(EXTDIR)\Opcode\Opcode
459SDBM_FILE = $(EXTDIR)\SDBM_File\SDBM_File
460IO = $(EXTDIR)\IO\IO
461POSIX = $(EXTDIR)\POSIX\POSIX
462ATTRS = $(EXTDIR)\attrs\attrs
463THREAD = $(EXTDIR)\Thread\Thread
464B = $(EXTDIR)\B\B
eab60bb1 465ERRNO = $(EXTDIR)\Errno\Errno
eb480a0b
GS
466
467SOCKET_DLL = $(AUTODIR)\Socket\Socket.dll
468FCNTL_DLL = $(AUTODIR)\Fcntl\Fcntl.dll
469OPCODE_DLL = $(AUTODIR)\Opcode\Opcode.dll
470SDBM_FILE_DLL = $(AUTODIR)\SDBM_File\SDBM_File.dll
471IO_DLL = $(AUTODIR)\IO\IO.dll
472POSIX_DLL = $(AUTODIR)\POSIX\POSIX.dll
473ATTRS_DLL = $(AUTODIR)\attrs\attrs.dll
474THREAD_DLL = $(AUTODIR)\Thread\Thread.dll
475B_DLL = $(AUTODIR)\B\B.dll
476
eab60bb1
GS
477ERRNO_PM = $(LIBDIR)\Errno.pm
478
eb480a0b
GS
479EXTENSION_C = \
480 $(SOCKET).c \
481 $(FCNTL).c \
482 $(OPCODE).c \
483 $(SDBM_FILE).c \
484 $(IO).c \
485 $(POSIX).c \
486 $(ATTRS).c \
487 $(THREAD).c \
488 $(B).c
489
490EXTENSION_DLL = \
491 $(SOCKET_DLL) \
492 $(FCNTL_DLL) \
493 $(OPCODE_DLL) \
494 $(SDBM_FILE_DLL)\
495 $(IO_DLL) \
496 $(POSIX_DLL) \
51aa15f3
GS
497 $(ATTRS_DLL) \
498 $(B_DLL)
26ca90b6 499
eab60bb1
GS
500EXTENSION_PM = \
501 $(ERRNO_PM)
502
26ca90b6
GS
503!IF "$(OBJECT)" == ""
504EXTENSION_DLL = \
505 $(EXTENSION_DLL)\
51aa15f3 506 $(THREAD_DLL)
26ca90b6 507!ENDIF
eb480a0b
GS
508
509POD2HTML = $(PODDIR)\pod2html
510POD2MAN = $(PODDIR)\pod2man
511POD2LATEX = $(PODDIR)\pod2latex
512POD2TEXT = $(PODDIR)\pod2text
513
514CFG_VARS = \
515 "INST_DRV=$(INST_DRV)" \
516 "INST_TOP=$(INST_TOP)" \
e5a95ffb 517 "INST_VER=$(INST_VER)" \
eb480a0b
GS
518 "archname=$(ARCHNAME)" \
519 "cc=$(CC)" \
ac4c12e7 520 "ccflags=$(OPTIMIZE) $(DEFINES) $(OBJECT)" \
eb480a0b
GS
521 "cf_email=$(EMAIL)" \
522 "d_crypt=$(D_CRYPT)" \
523 "d_mymalloc=$(PERL_MALLOC)" \
524 "libs=$(LIBFILES)" \
525 "incpath=$(CCINCDIR)" \
5fd76c3e 526 "libperl=$(PERLIMPLIB:..\=)" \
fa4efe8e 527 "libpth=$(CCLIBDIR) $(EXTRALIBDIRS)" \
eb480a0b
GS
528 "libc=$(LIBC)" \
529 "make=nmake" \
530 "static_ext=$(STATIC_EXT)" \
531 "dynamic_ext=$(DYNAMIC_EXT)" \
eab60bb1 532 "nonxs_ext=$(NONXS_EXT)" \
eb480a0b
GS
533 "usethreads=$(USE_THREADS)" \
534 "LINK_FLAGS=$(LINK_FLAGS)" \
535 "optimize=$(OPTIMIZE)"
924b3ec4 536
137443ea
PP
537#
538# Top targets
539#
0a753a76 540
852c2e52 541all : .\config.h $(GLOBEXE) $(MINIMOD) $(CONFIGPM) $(PERLEXE) $(PERL95EXE) \
eab60bb1 542 $(CAPILIB) $(X2P) $(EXTENSION_DLL) $(EXTENSION_PM)
0a753a76 543
d56e6723 544$(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
0a753a76 545
137443ea 546#------------------------------------------------------------
0a753a76 547
eb480a0b 548$(GLOBEXE) : perlglob$(o)
dc050285 549 $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
d56e6723 550 perlglob$(o) setargv$(o)
0a753a76 551
d56e6723 552perlglob$(o) : perlglob.c
137443ea 553
3e3baf6d
TB
554config.w32 : $(CFGSH_TMPL)
555 copy $(CFGSH_TMPL) config.w32
556
d55594ae 557.\config.h : $(CFGH_TMPL)
3e3baf6d
TB
558 -del /f config.h
559 copy $(CFGH_TMPL) config.h
560
137443ea 561..\config.sh : config.w32 $(MINIPERL) config_sh.PL
924b3ec4 562 $(MINIPERL) -I..\lib config_sh.PL $(CFG_VARS) config.w32 > ..\config.sh
137443ea 563
ac4c12e7
GS
564# this target is for when changes to the main config.sh happen
565# edit config.{b,v,g}c and make this target once for each supported
566# compiler (e.g. `dmake CCTYPE=BORLAND regen_config_h`)
567regen_config_h:
568 perl config_sh.PL $(CFG_VARS) $(CFGSH_TMPL) > ..\config.sh
569 cd ..
570 -del /f perl.exe
571 perl configpm
572 cd win32
573 -del /f $(CFGH_TMPL)
574 -mkdir ..\lib\CORE
e5a95ffb 575 -perl -I..\lib config_h.PL "INST_VER=$(INST_VER)"
ac4c12e7
GS
576 rename config.h $(CFGH_TMPL)
577
83437bec 578$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
137443ea 579 cd .. && miniperl configpm
c90c0ff4 580 if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
d07c2202
GS
581 $(XCOPY) ..\*.h $(COREDIR)\*.*
582 $(XCOPY) *.h $(COREDIR)\*.*
583 $(RCOPY) include $(COREDIR)\*.*
e5a95ffb
GS
584 $(MINIPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" \
585 || $(MAKE) $(MAKEFLAGS) $(CONFIGPM)
137443ea 586
eb480a0b 587$(MINIPERL) : $(MINIDIR) $(MINI_OBJ)
137443ea 588 $(LINK32) -subsystem:console -out:$@ @<<
eb480a0b 589 $(LINK_FLAGS) $(LIBFILES) $(MINI_OBJ)
137443ea
PP
590<<
591
eb480a0b
GS
592$(MINIDIR) :
593 if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
594
852c2e52 595$(MINICORE_OBJ) : $(CORE_NOCFG_H)
eb480a0b
GS
596 $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ ..\$(*F).c
597
852c2e52 598$(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
eb480a0b
GS
599 $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*F).c
600
852c2e52
GS
601# 1. we don't want to rebuild miniperl.exe when config.h changes
602# 2. we don't want to rebuild miniperl.exe with non-default config.h
603$(MINI_OBJ) : $(CORE_NOCFG_H)
604
eb480a0b
GS
605$(WIN32_OBJ) : $(CORE_H)
606$(CORE_OBJ) : $(CORE_H)
eb480a0b
GS
607$(DLL_OBJ) : $(CORE_H)
608$(PERL95_OBJ) : $(CORE_H)
609$(X2P_OBJ) : $(CORE_H)
0a753a76 610
910dfcc8 611perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl
eb480a0b 612 $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) $(OBJECT) \
910dfcc8 613 CCTYPE=$(CCTYPE) > perldll.def
0a753a76 614
eb480a0b 615$(PERLDLL): perldll.def $(PERLDLL_OBJ)
137443ea 616 $(LINK32) -dll -def:perldll.def -out:$@ @<<
eb480a0b 617 $(LINK_FLAGS) $(LIBFILES) $(PERLDLL_OBJ)
137443ea 618<<
d07c2202 619 $(XCOPY) $(PERLIMPLIB) $(COREDIR)
137443ea
PP
620
621perl.def : $(MINIPERL) makeperldef.pl
622 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
623
83437bec
NIS
624$(MINIMOD) : $(MINIPERL) ..\minimod.pl
625 cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
626
eb480a0b
GS
627..\x2p\a2p$(o) : ..\x2p\a2p.c
628 $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\a2p.c
629
630..\x2p\hash$(o) : ..\x2p\hash.c
631 $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\hash.c
632
633..\x2p\str$(o) : ..\x2p\str.c
634 $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\str.c
635
636..\x2p\util$(o) : ..\x2p\util.c
637 $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\util.c
638
639..\x2p\walk$(o) : ..\x2p\walk.c
640 $(CC) -I..\x2p $(CFLAGS) $(OBJOUT_FLAG)$@ -c ..\x2p\walk.c
641
642$(X2P) : $(MINIPERL) $(X2P_OBJ)
643 $(MINIPERL) ..\x2p\find2perl.PL
644 $(MINIPERL) ..\x2p\s2p.PL
d07c2202 645 $(LINK32) -subsystem:console -out:$@ @<<
eb480a0b 646 $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ)
d07c2202
GS
647<<
648
83437bec 649perlmain.c : runperl.c
0a753a76 650 copy runperl.c perlmain.c
137443ea 651
d56e6723 652perlmain$(o) : perlmain.c
8957be0a 653 $(CC) $(CFLAGS_O) -UPERLDLL $(OBJOUT_FLAG)$@ -c perlmain.c
137443ea 654
eb480a0b
GS
655$(PERLEXE): $(PERLDLL) $(CONFIGPM) $(PERLEXE_OBJ)
656 $(LINK32) -subsystem:console -out:$@ $(LINK_FLAGS) $(LIBFILES) \
657 $(PERLEXE_OBJ) $(PERLIMPLIB)
0a753a76 658 copy splittree.pl ..
eb480a0b 659 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
0a753a76 660
e7083a8c
DL
661!IF "$(USE_PERLCRT)" == ""
662
3e3baf6d
TB
663perl95.c : runperl.c
664 copy runperl.c perl95.c
665
d56e6723 666perl95$(o) : perl95.c
eb480a0b 667 $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c perl95.c
3e3baf6d 668
d56e6723 669win32sckmt$(o) : win32sck.c
eb480a0b
GS
670 $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
671 $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c
fb73857a 672
d56e6723 673win32mt$(o) : win32.c
eb480a0b
GS
674 $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
675 $(OBJOUT_FLAG)win32mt$(o) win32.c
fb73857a 676
ac4c12e7
GS
677DynaLoadmt$(o) : $(DYNALOADER).c
678 $(CC) $(CFLAGS_O) -MT -UPERLDLL -DWIN95FIX -c \
679 $(OBJOUT_FLAG)DynaLoadmt$(o) $(DYNALOADER).c
c69f6586 680
fb73857a 681$(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
eb480a0b 682 $(LINK32) -subsystem:console -nodefaultlib -out:$@ $(LINK_FLAGS) \
e7083a8c
DL
683 $(LIBBASEFILES) $(PERL95_OBJ) $(PERLIMPLIB) libcmt.lib
684
685!ENDIF
3e3baf6d 686
137443ea 687$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
eb480a0b 688 if not exist $(AUTODIR) mkdir $(AUTODIR)
a1dd9325 689 cd $(EXTDIR)\$(*B)
bfab39a2 690 ..\$(MINIPERL) -I..\..\lib $(*B)_pm.PL
a1dd9325 691 cd ..\..\win32
68dc0745
PP
692 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
693 cd $(EXTDIR)\$(*B)
694 $(XSUBPP) dl_win32.xs > $(*B).c
0a753a76
PP
695 cd ..\..\win32
696
e3b8966e
GS
697!IF "$(OBJECT)" == "-DPERL_OBJECT"
698PerlCAPI.cpp : $(MINIPERL)
699 $(MINIPERL) GenCAPI.pl $(COREDIR)
700
701PerlCAPI$(o) : PerlCAPI.cpp
d17537aa 702 $(CC) $(CFLAGS_O) $(RUNTIME) -UPERLDLL -c \
e3b8966e
GS
703 $(OBJOUT_FLAG)PerlCAPI$(o) PerlCAPI.cpp
704
705$(CAPILIB) : PerlCAPI.cpp PerlCAPI$(o)
706 lib /OUT:$(CAPILIB) PerlCAPI$(o)
707!ENDIF
708
68dc0745
PP
709$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
710 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
0a753a76 711
2a321948 712$(B_DLL): $(PERLEXE) $(B).xs
a98bd6f4
GS
713 cd $(EXTDIR)\$(*B)
714 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
715 $(MAKE)
716 cd ..\..\win32
717
d55594ae 718$(THREAD_DLL): $(PERLEXE) $(THREAD).xs
059e4e88
GS
719 cd $(EXTDIR)\$(*B)
720 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
721 $(MAKE)
722 cd ..\..\win32
723
2a321948
GS
724$(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs
725 cd $(EXTDIR)\$(*B)
726 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
727 $(MAKE)
728 cd ..\..\win32
d55594ae 729
6dead956
GS
730$(POSIX_DLL): $(PERLEXE) $(POSIX).xs
731 cd $(EXTDIR)\$(*B)
732 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
733 $(MAKE)
734 cd ..\..\win32
735
eb480a0b 736$(IO_DLL): $(PERLEXE) $(IO).xs
68dc0745 737 cd $(EXTDIR)\$(*B)
137443ea
PP
738 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
739 $(MAKE)
0a753a76
PP
740 cd ..\..\win32
741
137443ea 742$(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
68dc0745 743 cd $(EXTDIR)\$(*B)
137443ea
PP
744 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
745 $(MAKE)
68dc0745 746 cd ..\..\win32
0a753a76 747
137443ea 748$(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
68dc0745 749 cd $(EXTDIR)\$(*B)
137443ea
PP
750 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
751 $(MAKE)
0a753a76
PP
752 cd ..\..\win32
753
137443ea 754$(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
68dc0745 755 cd $(EXTDIR)\$(*B)
137443ea
PP
756 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
757 $(MAKE)
68dc0745 758 cd ..\..\win32
0a753a76 759
059e4e88 760$(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
68dc0745 761 cd $(EXTDIR)\$(*B)
137443ea
PP
762 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
763 $(MAKE)
0a753a76
PP
764 cd ..\..\win32
765
eab60bb1
GS
766$(ERRNO_PM): $(PERLEXE) $(ERRNO)_pm.PL
767 cd $(EXTDIR)\$(*B)
768 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
769 $(MAKE)
770 cd ..\..\win32
771
68dc0745 772doc: $(PERLEXE)
3e3baf6d 773 copy ..\README.win32 ..\pod\perlwin32.pod
d07c2202 774 $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=./html \
b3b61bd8 775 --podpath=pod:lib:ext:utils --htmlroot="file://$(INST_HTML::=|)" \
3e3baf6d 776 --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse
68dc0745 777
4a71ed0c 778utils: $(PERLEXE) $(X2P)
3fe9a6f1 779 cd ..\utils
eb480a0b 780 $(MAKE) PERL=$(MINIPERL)
4a71ed0c
GS
781 cd ..\pod
782 $(MAKE) -f ..\win32\pod.mak converters
3fe9a6f1 783 cd ..\win32
4a71ed0c 784 $(PERLEXE) $(PL2BAT) $(UTILS)
3fe9a6f1 785
137443ea 786distclean: clean
dc050285 787 -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
83437bec 788 $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
3e3baf6d 789 -del /f *.def *.map
eab60bb1
GS
790 -del /f $(EXTENSION_DLL) $(EXTENSION_PM)
791 -del /f $(EXTENSION_C) $(DYNALOADER).c $(ERRNO).pm
eb480a0b
GS
792 -del /f $(EXTDIR)\DynaLoader\dl_win32.xs
793 -del /f $(LIBDIR)\.exists $(LIBDIR)\attrs.pm $(LIBDIR)\DynaLoader.pm
794 -del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
795 -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm $(LIBDIR)\Thread.pm
796 -del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
797 -del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm
798 -rmdir /s /q $(LIBDIR)\IO || rmdir /s $(LIBDIR)\IO
799 -rmdir /s /q $(LIBDIR)\Thread || rmdir /s $(LIBDIR)\Thread
800 -rmdir /s /q $(LIBDIR)\B || rmdir /s $(LIBDIR)\B
68dc0745
PP
801 -del /f $(PODDIR)\*.html
802 -del /f $(PODDIR)\*.bat
eb480a0b
GS
803 cd ..\utils
804 -del /f h2ph splain perlbug pl2pm c2ph h2xs perldoc pstruct
805 -del /f *.bat
806 cd ..\win32
807 cd ..\x2p
808 -del /f find2perl s2p
809 -del /f *.bat
810 cd ..\win32
811 -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c config.h.new
812 -del /f $(CONFIGPM)
813 -del /f perl95.c
d444a431 814 -del /f bin\*.bat
3e3baf6d 815 cd $(EXTDIR)
d56e6723 816 -del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib
3e3baf6d 817 cd ..\win32
eb480a0b
GS
818 -rmdir /s /q $(AUTODIR) || rmdir /s $(AUTODIR)
819 -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR)
68dc0745 820
4a71ed0c 821install : all installbare installhtml
6dead956 822
4a71ed0c 823installbare : utils
d07c2202 824 $(PERLEXE) ..\installperl
e7083a8c 825!IF "$(USE_PERLCRT)" == ""
3e3baf6d 826 $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
e7083a8c 827!ENDIF
68dc0745 828 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
e5a95ffb 829 $(XCOPY) bin\*.bat $(INST_SCRIPT)\*.*
4a71ed0c 830 $(XCOPY) bin\network.pl $(INST_LIB)\*.*
6dead956
GS
831
832installhtml : doc
3e3baf6d 833 $(RCOPY) html\*.* $(INST_HTML)\*.*
68dc0745 834
137443ea 835inst_lib : $(CONFIGPM)
68dc0745 836 copy splittree.pl ..
eb480a0b 837 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" $(AUTODIR)
c90c0ff4 838 $(RCOPY) ..\lib $(INST_LIB)\*.*
0a753a76 839
dfb634a9 840minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils
137443ea
PP
841 $(XCOPY) $(MINIPERL) ..\t\perl.exe
842 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
843 attrib -r ..\t\*.*
844 copy test ..\t
845 cd ..\t
846 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
847 cd ..\win32
848
dfb634a9 849test-prep : all utils
68dc0745
PP
850 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
851 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
852 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
fb73857a
PP
853
854test : test-prep
855 cd ..\t
856 $(PERLEXE) -I..\lib harness
857 cd ..\win32
858
859test-notty : test-prep
860 set PERL_SKIP_TTY_TEST=1
137443ea
PP
861 cd ..\t
862 $(PERLEXE) -I..\lib harness
68dc0745 863 cd ..\win32
137443ea
PP
864
865clean :
d56e6723 866 -@erase miniperlmain$(o)
137443ea 867 -@erase $(MINIPERL)
d56e6723
GS
868 -@erase perlglob$(o)
869 -@erase perlmain$(o)
3e3baf6d
TB
870 -@erase config.w32
871 -@erase /f config.h
e3b8966e 872 -@erase PerlCAPI.cpp
137443ea
PP
873 -@erase $(GLOBEXE)
874 -@erase $(PERLEXE)
875 -@erase $(PERLDLL)
876 -@erase $(CORE_OBJ)
e3b8966e 877 -@erase $(CAPILIB)
eb480a0b 878 -rmdir /s /q $(MINIDIR) || rmdir /s $(MINIDIR)
137443ea
PP
879 -@erase $(WIN32_OBJ)
880 -@erase $(DLL_OBJ)
d07c2202 881 -@erase $(X2P_OBJ)
d56e6723 882 -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp
d444a431 883 -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
d07c2202 884 -@erase ..\x2p\*.exe ..\x2p\*.bat
137443ea
PP
885 -@erase *.ilk
886 -@erase *.pdb