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