[differences between cumulative patch application and perl5.004_01]
[p5sagit/p5-mst-13.2.git] / win32 / Makefile
CommitLineData
68dc0745 1#
2# Makefile to build perl on Windowns NT using Microsoft NMAKE.
3#
4#
5# This is set up to build a perl.exe that runs off a shared library
6# (perl.dll). Also makes individual DLLs for the XS extensions.
7#
137443ea 8
9#
10# Set these to wherever you want "nmake install" to put your
11# newly built perl.
137443ea 12INST_DRV=c:
13INST_TOP=$(INST_DRV)\perl
14
c90c0ff4 15#
c90c0ff4 16# uncomment next line if you are using Visual C++ 2.x
17#CCTYPE=MSVC20
18
19#
20# uncomment next line if you want debug version of perl (big,slow)
21#CFG=Debug
137443ea 22
d484a829 23#
3e3baf6d 24# set the install locations of the compiler include/libraries
25#CCHOME = f:\msvc20
26CCHOME = $(MSVCDIR)
27CCINCDIR = $(CCHOME)\include
28CCLIBDIR = $(CCHOME)\lib
29
30#
d484a829 31# set this to your email address (perl will guess a value from
32# from your loginname and your hostname, which may not be right)
33#EMAIL =
34
137443ea 35##################### CHANGE THESE ONLY IF YOU MUST #####################
36
37#
38# Programs to compile, build .lib files and link
39#
68dc0745 40
137443ea 41CC=cl.exe
42LINK32=link.exe
43LIB32=$(LINK32) -lib
68dc0745 44#
137443ea 45# Options
46#
c90c0ff4 47!IF "$(RUNTIME)" == ""
137443ea 48RUNTIME = -MD
c90c0ff4 49!ENDIF
3e3baf6d 50INCLUDES = -I.\include -I. -I..
137443ea 51#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
3e3baf6d 52DEFINES = -DWIN32 -D_CONSOLE -DPERLDLL
137443ea 53SUBSYS = console
137443ea 54
55!IF "$(RUNTIME)" == "-MD"
3e3baf6d 56LIBC = msvcrt.lib
137443ea 57WINIOMAYBE =
58!ELSE
3e3baf6d 59LIBC = libcmt.lib
137443ea 60WINIOMAYBE = win32io.obj
61!ENDIF
62
63!IF "$(CFG)" == "Debug"
64! IF "$(CCTYPE)" == "MSVC20"
3e3baf6d 65OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG
137443ea 66! ELSE
3e3baf6d 67OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG
137443ea 68! ENDIF
96e4d5b1 69LINK_DBG = -debug -pdb:none
137443ea 70!ELSE
71! IF "$(CCTYPE)" == "MSVC20"
3e3baf6d 72OPTIMIZE = -Od $(RUNTIME) -DNDEBUG
137443ea 73! ELSE
3e3baf6d 74OPTIMIZE = -Od $(RUNTIME) -DNDEBUG
137443ea 75! ENDIF
76LINK_DBG = -release
77!ENDIF
68dc0745 78
3e3baf6d 79# we don't add LIBC here, the compiler do it based on -MD/-MT
80LIBFILES = oldnames.lib kernel32.lib user32.lib gdi32.lib \
81 winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
82 oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
83 version.lib odbc32.lib odbccp32.lib
84
137443ea 85CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
86LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
3e3baf6d 87OBJOUT_FLAG = -Fo
137443ea 88
89#################### do not edit below this line #######################
90############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
91
92#
93# Rules
94#
95.SUFFIXES :
96.SUFFIXES : .c .obj .dll .lib .exe
97
98.c.obj:
3e3baf6d 99 $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $<
137443ea 100
101.obj.dll:
3e3baf6d 102 $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
103 -out:$@ $(LINK_FLAGS) $< $(LIBPERL)
68dc0745 104
68dc0745 105#
106INST_BIN=$(INST_TOP)\bin
107INST_LIB=$(INST_TOP)\lib
137443ea 108INST_POD=$(INST_LIB)\pod
68dc0745 109INST_HTML=$(INST_POD)\html
110LIBDIR=..\lib
0a753a76 111EXTDIR=..\ext
68dc0745 112PODDIR=..\pod
0a753a76 113EXTUTILSDIR=$(LIBDIR)\extutils
68dc0745 114
115#
116# various targets
54310121 117PERLIMPLIB=..\perl.lib
68dc0745 118MINIPERL=..\miniperl.exe
119PERLDLL=..\perl.dll
120PERLEXE=..\perl.exe
121GLOBEXE=..\perlglob.exe
137443ea 122CONFIGPM=..\lib\Config.pm
83437bec 123MINIMOD=..\lib\ExtUtils\Miniperl.pm
68dc0745 124
125PL2BAT=bin\PL2BAT.BAT
3e3baf6d 126GLOBBAT = perlglob.bat
127
137443ea 128MAKE=nmake -nologo
3e3baf6d 129CFGSH_TMPL = config.vc
130CFGH_TMPL = config_H.vc
131PERL95EXE=..\perl95.exe
c90c0ff4 132XCOPY=xcopy /f /r /i /d
133RCOPY=xcopy /f /r /i /e /d
68dc0745 134NULL=
135
136#
137# filenames given to xsubpp must have forward slashes (since it puts
138# full pathnames in #line strings)
137443ea 139XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
68dc0745 140
137443ea 141CORE_C= ..\av.c \
68dc0745 142 ..\deb.c \
143 ..\doio.c \
144 ..\doop.c \
145 ..\dump.c \
146 ..\globals.c \
147 ..\gv.c \
148 ..\hv.c \
149 ..\mg.c \
150 ..\op.c \
151 ..\perl.c \
152 ..\perlio.c \
153 ..\perly.c \
154 ..\pp.c \
155 ..\pp_ctl.c \
156 ..\pp_hot.c \
157 ..\pp_sys.c \
158 ..\regcomp.c \
159 ..\regexec.c \
160 ..\run.c \
161 ..\scope.c \
162 ..\sv.c \
163 ..\taint.c \
164 ..\toke.c \
165 ..\universal.c \
166 ..\util.c
0a753a76 167
3e3baf6d 168CORE_OBJ= ..\av.obj \
137443ea 169 ..\deb.obj \
170 ..\doio.obj \
171 ..\doop.obj \
172 ..\dump.obj \
173 ..\globals.obj \
3e3baf6d 174 ..\gv.obj \
175 ..\hv.obj \
176 ..\mg.obj \
177 ..\op.obj \
137443ea 178 ..\perl.obj \
179 ..\perlio.obj \
180 ..\perly.obj \
3e3baf6d 181 ..\pp.obj \
137443ea 182 ..\pp_ctl.obj \
183 ..\pp_hot.obj \
184 ..\pp_sys.obj \
185 ..\regcomp.obj \
186 ..\regexec.obj \
187 ..\run.obj \
188 ..\scope.obj \
3e3baf6d 189 ..\sv.obj \
137443ea 190 ..\taint.obj \
191 ..\toke.obj \
3e3baf6d 192 ..\universal.obj\
137443ea 193 ..\util.obj
194
195WIN32_C = perllib.c \
196 win32.c \
197 win32io.c \
3e3baf6d 198 win32sck.c
137443ea 199
200WIN32_OBJ = win32.obj \
201 win32io.obj \
3e3baf6d 202 win32sck.obj
137443ea 203
204DLL_OBJ = perllib.obj $(DYNALOADER).obj
205
3e3baf6d 206CORE_H = ..\av.h \
207 ..\cop.h \
208 ..\cv.h \
209 ..\dosish.h \
210 ..\embed.h \
211 ..\form.h \
212 ..\gv.h \
213 ..\handy.h \
214 ..\hv.h \
215 ..\mg.h \
216 ..\nostdio.h \
217 ..\op.h \
218 ..\opcode.h \
219 ..\perl.h \
220 ..\perlio.h \
221 ..\perlsdio.h \
222 ..\perlsfio.h \
223 ..\perly.h \
224 ..\pp.h \
225 ..\proto.h \
226 ..\regexp.h \
227 ..\scope.h \
228 ..\sv.h \
229 ..\unixish.h \
230 ..\util.h \
231 ..\XSUB.h \
232 .\config.h \
233 ..\EXTERN.h \
234 .\include\dirent.h \
235 .\include\netdb.h \
236 .\include\sys\socket.h \
237 .\win32.h
137443ea 238
0a753a76 239EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
0a753a76 240
68dc0745 241DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
242SOCKET=$(EXTDIR)\Socket\Socket
243FCNTL=$(EXTDIR)\Fcntl\Fcntl
244OPCODE=$(EXTDIR)\Opcode\Opcode
245SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
246IO=$(EXTDIR)\IO\IO
247
248SOCKET_DLL=..\lib\auto\Socket\Socket.dll
249FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
250OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
251SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
252IO_DLL=..\lib\auto\IO\IO.dll
253
254STATICLINKMODULES=DynaLoader
255DYNALOADMODULES= \
256 $(SOCKET_DLL) \
257 $(FCNTL_DLL) \
258 $(OPCODE_DLL) \
259 $(SDBM_FILE_DLL)\
260 $(IO_DLL)
261
262POD2HTML=$(PODDIR)\pod2html
263POD2MAN=$(PODDIR)\pod2man
264POD2LATEX=$(PODDIR)\pod2latex
265POD2TEXT=$(PODDIR)\pod2text
266
137443ea 267#
268# Top targets
269#
0a753a76 270
3e3baf6d 271all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) $(GLOBBAT)
0a753a76 272
137443ea 273$(DYNALOADER).obj : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
0a753a76 274
137443ea 275#------------------------------------------------------------
0a753a76 276
137443ea 277$(GLOBEXE): perlglob.obj
278 $(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
0a753a76 279
3e3baf6d 280perlglob.bat : ..\lib\File\DosGlob.pm $(MINIPERL)
281 $(MINIPERL) $(PL2BAT) - < ..\lib\File\DosGlob.pm > $(*B).bat
282
137443ea 283perlglob.obj : perlglob.c
284
285..\miniperlmain.obj : ..\miniperlmain.c $(CORE_H)
286
3e3baf6d 287config.w32 : $(CFGSH_TMPL)
288 copy $(CFGSH_TMPL) config.w32
289
290.\config.h : $(CFGSH_TMPL)
291 -del /f config.h
292 copy $(CFGH_TMPL) config.h
293
137443ea 294..\config.sh : config.w32 $(MINIPERL) config_sh.PL
3e3baf6d 295 $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" \
296 "INST_TOP=$(INST_TOP)" "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" \
297 "cf_email=$(EMAIL)" "libs=$(LIBFILES)" \
298 "libpth=$(CCLIBDIR)" "libc=$(LIBC)" \
299 config.w32 > ..\config.sh
137443ea 300
83437bec 301$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
137443ea 302 cd .. && miniperl configpm
c90c0ff4 303 if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
137443ea 304 $(XCOPY) ..\*.h ..\lib\CORE\*.*
305 $(XCOPY) *.h ..\lib\CORE\*.*
c90c0ff4 306 $(RCOPY) include ..\lib\CORE\*.*
3e3baf6d 307 $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) \
308 RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
137443ea 309
310$(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
311 $(LINK32) -subsystem:console -out:$@ @<<
312 $(LINK_FLAGS) ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
313<<
314
315$(WIN32_OBJ) : $(CORE_H)
316$(CORE_OBJ) : $(CORE_H)
317$(DLL_OBJ) : $(CORE_H)
0a753a76 318
137443ea 319perldll.def : $(MINIPERL) $(CONFIGPM)
3e3baf6d 320 $(MINIPERL) -w makedef.pl $(CCTYPE) > perldll.def
0a753a76 321
137443ea 322$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
323 $(LINK32) -dll -def:perldll.def -out:$@ @<<
324 $(LINK_FLAGS) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
325<<
326 $(XCOPY) $(PERLIMPLIB) ..\lib\CORE
327
328perl.def : $(MINIPERL) makeperldef.pl
329 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
330
83437bec 331$(MINIMOD) : $(MINIPERL) ..\minimod.pl
332 cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
333
334perlmain.c : runperl.c
0a753a76 335 copy runperl.c perlmain.c
137443ea 336
337perlmain.obj : perlmain.c
3e3baf6d 338 $(CC) $(CFLAGS) -UPERLDLL -c perlmain.c
137443ea 339
340$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
3e3baf6d 341 $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) \
342 perlmain.obj $(WINIOMAYBE) $(PERLIMPLIB)
137443ea 343 copy perl.exe $@
344 del perl.exe
0a753a76 345 copy splittree.pl ..
137443ea 346 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
0a753a76 347 attrib -r ..\t\*.*
348 copy test ..\t
0a753a76 349
3e3baf6d 350perl95.c : runperl.c
351 copy runperl.c perl95.c
352
353perl95.obj : perl95.c
354 $(CC) $(CFLAGS) -MT -UPERLDLL -c perl95.c
355
356win32iomt.obj : win32io.c
357 $(CC) $(CFLAGS) -MT -c $(OBJOUT_FLAG)win32iomt.obj win32io.c
358
359$(PERL95EXE): $(PERLDLL) $(CONFIGPM) perl95.obj win32iomt.obj
360 $(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) \
361 perl95.obj win32iomt.obj $(PERLIMPLIB)
362 copy perl95.exe $@
363 del perl95.exe
364
137443ea 365$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
68dc0745 366 if not exist ..\lib\auto md ..\lib\auto
367 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
368 cd $(EXTDIR)\$(*B)
369 $(XSUBPP) dl_win32.xs > $(*B).c
0a753a76 370 cd ..\..\win32
371
68dc0745 372$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
373 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
0a753a76 374
137443ea 375$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
68dc0745 376 cd $(EXTDIR)\$(*B)
137443ea 377 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
378 $(MAKE)
0a753a76 379 cd ..\..\win32
380
137443ea 381$(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
68dc0745 382 cd $(EXTDIR)\$(*B)
137443ea 383 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
384 $(MAKE)
68dc0745 385 cd ..\..\win32
0a753a76 386
137443ea 387$(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
68dc0745 388 cd $(EXTDIR)\$(*B)
137443ea 389 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
390 $(MAKE)
0a753a76 391 cd ..\..\win32
392
137443ea 393$(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
68dc0745 394 cd $(EXTDIR)\$(*B)
137443ea 395 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
396 $(MAKE)
68dc0745 397 cd ..\..\win32
0a753a76 398
137443ea 399$(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
68dc0745 400 cd $(EXTDIR)\$(*B)
137443ea 401 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
402 $(MAKE)
0a753a76 403 cd ..\..\win32
404
68dc0745 405doc: $(PERLEXE)
3e3baf6d 406 copy ..\README.win32 ..\pod\perlwin32.pod
407 $(PERLEXE) ..\installhtml --podroot=.. --htmldir=./html \
408 --podpath=pod:lib:ext:utils --htmlroot="//$(INST_HTML::=|)" \
409 --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse
68dc0745 410
3fe9a6f1 411utils: $(PERLEXE)
412 cd ..\utils
413 nmake PERL=$(MINIPERL)
414 $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
415 h2xs perldoc pstruct
416 $(XCOPY) *.bat ..\win32\bin\*.*
417 cd ..\win32
418
137443ea 419distclean: clean
420 -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
83437bec 421 $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
3e3baf6d 422 -del /f *.def *.map
54310121 423 -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
424 $(OPCODE_DLL)
425 -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
426 $(DYNALOADER).c
68dc0745 427 -del /f $(PODDIR)\*.html
428 -del /f $(PODDIR)\*.bat
54310121 429 -rmdir /s /q ..\lib\auto
430 -rmdir /s /q ..\lib\CORE
3e3baf6d 431 cd $(EXTDIR)
432 -del /s *.lib *.def *.map *.bs Makefile *.obj pm_to_blib
433 cd ..\win32
68dc0745 434
3e3baf6d 435install : all doc utils
68dc0745 436 if not exist $(INST_TOP) mkdir $(INST_TOP)
437 echo I $(INST_TOP) L $(LIBDIR)
438 $(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
3e3baf6d 439 $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
68dc0745 440 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
3e3baf6d 441 $(XCOPY) $(GLOBBAT) $(INST_BIN)\*.*
68dc0745 442 $(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
3fe9a6f1 443 $(XCOPY) bin\*.* $(INST_BIN)\*.*
c90c0ff4 444 $(RCOPY) ..\lib $(INST_LIB)\*.*
68dc0745 445 $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
446 $(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
3e3baf6d 447 $(RCOPY) html\*.* $(INST_HTML)\*.*
68dc0745 448
137443ea 449inst_lib : $(CONFIGPM)
68dc0745 450 copy splittree.pl ..
137443ea 451 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
c90c0ff4 452 $(RCOPY) ..\lib $(INST_LIB)\*.*
0a753a76 453
137443ea 454minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
455 $(XCOPY) $(MINIPERL) ..\t\perl.exe
456 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
457 attrib -r ..\t\*.*
458 copy test ..\t
459 cd ..\t
460 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
461 cd ..\win32
462
68dc0745 463test : all
464 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
465 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
466 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
137443ea 467 cd ..\t
468 $(PERLEXE) -I..\lib harness
68dc0745 469 cd ..\win32
137443ea 470
471clean :
472 -@erase miniperlmain.obj
473 -@erase $(MINIPERL)
474 -@erase perlglob.obj
475 -@erase perlmain.obj
3e3baf6d 476 -@erase config.w32
477 -@erase /f config.h
137443ea 478 -@erase $(GLOBEXE)
479 -@erase $(PERLEXE)
480 -@erase $(PERLDLL)
481 -@erase $(CORE_OBJ)
482 -@erase $(WIN32_OBJ)
483 -@erase $(DLL_OBJ)
484 -@erase ..\*.obj *.obj ..\*.lib ..\*.exp
485 -@erase *.ilk
486 -@erase *.pdb
487
488