2 # Makefile to build perl on Windowns NT using Microsoft NMAKE.
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.
10 # Set these to wherever you want "nmake install" to put your
13 INST_TOP=$(INST_DRV)\perl5004.5x
16 # uncomment to enable threads-capabilities
17 #USE_THREADS=-DUSE_THREADS
20 # uncomment next line if you are using Visual C++ 2.x
24 # uncomment next line if you want to use the perl object
28 # uncomment next line if you want debug version of perl (big,slow)
32 # if you have the source for des_fcrypt(), uncomment this and make sure the
33 # file exists (see README.win32)
34 #CRYPT_SRC=des_fcrypt.c
37 # if you didn't set CRYPT_SRC and if you have des_fcrypt() available in a
38 # library, uncomment this, and make sure the library exists (see README.win32)
39 #CRYPT_LIB=des_fcrypt.lib
42 # set the install locations of the compiler include/libraries
45 CCINCDIR = $(CCHOME)\include
46 CCLIBDIR = $(CCHOME)\lib
49 # set this to your email address (perl will guess a value from
50 # from your loginname and your hostname, which may not be right)
53 ##################### CHANGE THESE ONLY IF YOU MUST #####################
55 !IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
59 CRYPT_FLAG=-DHAVE_DES_FCRYPT
62 BUILDOPT = $(USE_THREADS)
63 #BUILDOPT = $(USE_THREADS) -DMULTIPLICITY
64 #BUILDOPT = $(USE_THREADS) -DPERL_GLOBAL_STRUCT -DMULTIPLICITY
65 # -DUSE_PERLIO -D__STDC__=1 -DUSE_SFIO -DI_SFIO -I\sfio97\include
67 !IF "$(PROCESSOR_ARCHITECTURE)" == ""
68 PROCESSOR_ARCHITECTURE = x86
71 !IF "$(USE_THREADS)" == ""
72 ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)
74 ARCHNAME = MSWin32-$(PROCESSOR_ARCHITECTURE)-thread
77 ARCHDIR = ..\lib\$(ARCHNAME)
81 # Programs to compile, build .lib files and link
90 !IF "$(RUNTIME)" == ""
93 INCLUDES = -I.\include -I. -I..
94 #PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
95 DEFINES = -DWIN32 -D_CONSOLE $(BUILDOPT) $(CRYPT_FLAG) $(OBJECT)
96 LOCDEFS = -DPERLDLL -DPERL_CORE
99 !IF "$(RUNTIME)" == "-MD"
107 !IF "$(CFG)" == "Debug"
108 ! IF "$(CCTYPE)" == "MSVC20"
109 OPTIMIZE = -Od $(RUNTIME) -Z7 -D_DEBUG -DDEBUGGING
111 OPTIMIZE = -Od $(RUNTIME)d -Z7 -D_DEBUG -DDEBUGGING
113 LINK_DBG = -debug -pdb:none
115 ! IF "$(CCTYPE)" == "MSVC20"
116 OPTIMIZE = -O1 $(RUNTIME) -DNDEBUG
118 OPTIMIZE = -O1 $(RUNTIME) -DNDEBUG
123 # we don't add LIBC here, the compiler do it based on -MD/-MT
124 LIBFILES = $(CRYPT_LIB) oldnames.lib kernel32.lib user32.lib gdi32.lib \
125 winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
126 oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib \
127 version.lib odbc32.lib odbccp32.lib
129 !IF "$(OBJECT)" == "-DPERL_OBJECT"
130 CFLAGS = -nologo -Gf -W3 -TP $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
132 CFLAGS = -nologo -Gf -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) $(PCHFLAGS) $(OPTIMIZE)
134 LINK_FLAGS = -nologo $(LINK_DBG) -machine:$(PROCESSOR_ARCHITECTURE)
138 #################### do not edit below this line #######################
139 ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
147 .SUFFIXES : .c $(o) .dll .lib .exe
150 $(CC) -c -I$(<D) $(CFLAGS) $(OBJOUT_FLAG)$@ $<
153 $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def \
154 -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)
160 INST_BIN=$(INST_TOP)\bin
161 INST_LIB=$(INST_TOP)\lib
162 INST_POD=$(INST_LIB)\pod
163 INST_HTML=$(INST_POD)\html
167 EXTUTILSDIR=$(LIBDIR)\extutils
171 PERLIMPLIB=..\perl.lib
172 MINIPERL=..\miniperl.exe
175 GLOBEXE=..\perlglob.exe
176 CONFIGPM=..\lib\Config.pm
177 MINIMOD=..\lib\ExtUtils\Miniperl.pm
181 GLOBBAT = bin\perlglob.bat
184 CFGSH_TMPL = config.vc
185 CFGH_TMPL = config_H.vc
186 PERL95EXE=..\perl95.exe
187 XCOPY=xcopy /f /r /i /d
188 RCOPY=xcopy /f /r /i /e /d
192 !IF "$(CRYPT_SRC)" != ""
193 CRYPT_OBJ=$(CRYPT_SRC:.c=.obj)
197 # filenames given to xsubpp must have forward slashes (since it puts
198 # full pathnames in #line strings)
199 XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
230 CORE_OBJ= ..\av$(o) \
259 WIN32_C = perllib.c \
264 WIN32_OBJ = win32$(o) \
268 PERL95_OBJ = perl95$(o) \
273 DLL_OBJ = perllib$(o) $(DYNALOADER)$(o)
275 X2P_OBJ = ..\x2p\a2p$(o) \
315 .\include\sys\socket.h \
318 DYNAMIC_EXT=Socket IO Fcntl Opcode SDBM_File attrs Thread B
319 STATIC_EXT=DynaLoader
321 DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
322 SOCKET=$(EXTDIR)\Socket\Socket
323 FCNTL=$(EXTDIR)\Fcntl\Fcntl
324 OPCODE=$(EXTDIR)\Opcode\Opcode
325 SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
327 ATTRS=$(EXTDIR)\attrs\attrs
328 THREAD=$(EXTDIR)\Thread\Thread
331 SOCKET_DLL=..\lib\auto\Socket\Socket.dll
332 FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
333 OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
334 SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
335 IO_DLL=..\lib\auto\IO\IO.dll
336 ATTRS_DLL=..\lib\auto\attrs\attrs.dll
337 THREAD_DLL=..\lib\auto\Thread\Thread.dll
338 B_DLL=..\lib\auto\B\B.dll
340 STATICLINKMODULES=DynaLoader
351 POD2HTML=$(PODDIR)\pod2html
352 POD2MAN=$(PODDIR)\pod2man
353 POD2LATEX=$(PODDIR)\pod2latex
354 POD2TEXT=$(PODDIR)\pod2text
360 all: $(PERLEXE) $(PERL95EXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD) \
363 $(DYNALOADER)$(o) : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
365 #------------------------------------------------------------
367 $(GLOBEXE): perlglob$(o)
368 $(LINK32) $(LINK_FLAGS) $(LIBFILES) -out:$@ -subsystem:$(SUBSYS) \
369 perlglob$(o) setargv$(o)
371 perlglob$(o) : perlglob.c
373 ..\miniperlmain$(o) : ..\miniperlmain.c $(CORE_H)
375 config.w32 : $(CFGSH_TMPL)
376 copy $(CFGSH_TMPL) config.w32
378 .\config.h : $(CFGH_TMPL)
380 copy $(CFGH_TMPL) config.h
382 ..\config.sh : config.w32 $(MINIPERL) config_sh.PL
383 $(MINIPERL) -I..\lib config_sh.PL \
384 "INST_DRV=$(INST_DRV)" \
385 "INST_TOP=$(INST_TOP)" \
386 "archname=$(ARCHNAME)" \
388 "ccflags=$(OPTIMIZE) $(DEFINES)" \
389 "cf_email=$(EMAIL)" \
390 "d_crypt=$(D_CRYPT)" \
392 "incpath=$(CCINCDIR)" \
393 "libpth=$(CCLIBDIR)" \
395 "static_ext=$(STATIC_EXT)" \
396 "dynamic_ext=$(DYNAMIC_EXT)" \
397 "LINK_FLAGS=$(LINK_FLAGS)" \
398 "optimize=$(OPTIMIZE)" \
399 config.w32 > ..\config.sh
401 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
402 cd .. && miniperl configpm
403 if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
404 $(XCOPY) ..\*.h $(COREDIR)\*.*
405 $(XCOPY) *.h $(COREDIR)\*.*
406 $(RCOPY) include $(COREDIR)\*.*
407 $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) \
408 RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
410 $(MINIPERL) : ..\miniperlmain$(o) $(CORE_OBJ) $(WIN32_OBJ)
411 $(LINK32) -subsystem:console -out:$@ @<<
412 $(LINK_FLAGS) $(LIBFILES) ..\miniperlmain$(o) $(CORE_OBJ) $(WIN32_OBJ)
415 $(WIN32_OBJ) : $(CORE_H)
416 $(CORE_OBJ) : $(CORE_H)
417 $(DLL_OBJ) : $(CORE_H)
418 $(PERL95_OBJ) : $(CORE_H)
419 $(X2P_OBJ) : $(CORE_H)
421 perldll.def : $(MINIPERL) $(CONFIGPM) ..\global.sym makedef.pl
422 $(MINIPERL) -w makedef.pl $(OPTIMIZE) $(DEFINES) \
423 CCTYPE=$(CCTYPE) > perldll.def
425 $(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
426 $(LINK32) -dll -def:perldll.def -out:$@ @<<
427 $(LINK_FLAGS) $(LIBFILES) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
429 $(XCOPY) $(PERLIMPLIB) $(COREDIR)
431 perl.def : $(MINIPERL) makeperldef.pl
432 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
434 $(MINIMOD) : $(MINIPERL) ..\minimod.pl
435 cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
438 $(LINK32) -subsystem:console -out:$@ @<<
439 $(LINK_FLAGS) $(LIBFILES) $(X2P_OBJ)
442 perlmain.c : runperl.c
443 copy runperl.c perlmain.c
445 perlmain$(o) : perlmain.c
446 $(CC) $(CFLAGS) -UPERLDLL -c perlmain.c
448 $(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain$(o)
449 $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) $(LIBFILES) \
450 perlmain$(o) $(WINIOMAYBE) $(PERLIMPLIB)
454 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
457 copy runperl.c perl95.c
459 perl95$(o) : perl95.c
460 $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c perl95.c
462 win32sckmt$(o) : win32sck.c
463 $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32sckmt$(o) win32sck.c
465 win32mt$(o) : win32.c
466 $(CC) $(CFLAGS) -MT -UPERLDLL -DWIN95FIX -c $(OBJOUT_FLAG)win32mt$(o) win32.c
468 $(PERL95EXE): $(PERLDLL) $(CONFIGPM) $(PERL95_OBJ)
469 $(LINK32) -subsystem:console -out:perl95.exe $(LINK_FLAGS) $(LIBFILES) \
470 $(PERL95_OBJ) $(PERLIMPLIB)
474 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
475 if not exist ..\lib\auto mkdir ..\lib\auto
476 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
478 $(XSUBPP) dl_win32.xs > $(*B).c
481 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
482 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
484 $(B_DLL): $(PERLEXE) $(B).xs
486 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
490 $(THREAD_DLL): $(PERLEXE) $(THREAD).xs
492 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
496 $(ATTRS_DLL): $(PERLEXE) $(ATTRS).xs
498 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
502 $(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
504 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
508 $(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
510 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
514 $(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
516 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
520 $(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
522 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
526 $(SOCKET_DLL): $(PERLEXE) $(SOCKET).xs
528 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
534 $(MAKE) -f ..\win32\pod.mak checkpods pod2html pod2latex \
536 $(XCOPY) *.bat ..\win32\bin\*.*
538 copy ..\README.win32 ..\pod\perlwin32.pod
539 $(PERLEXE) -I..\lib ..\installhtml --podroot=.. --htmldir=./html \
540 --podpath=pod:lib:ext:utils --htmlroot="//$(INST_HTML::=|)" \
541 --libpod=perlfunc:perlguts:perlvar:perlrun:perlop --recurse
545 nmake PERL=$(MINIPERL)
546 $(PERLEXE) -I..\lib ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph
547 $(PERLEXE) ..\win32\$(PL2BAT) h2xs perldoc pstruct
548 $(XCOPY) *.bat ..\win32\bin\*.*
550 $(PERLEXE) $(PL2BAT) bin\network.pl bin\www.pl bin\runperl.pl \
551 bin\pl2bat.pl bin\perlglob.pl
554 -del /f $(MINIPERL) $(PERLEXE) $(PERL95EXE) $(PERLDLL) $(GLOBEXE) \
555 $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
557 -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
558 $(OPCODE_DLL) $(ATTRS_DLL) $(THREAD_DLL) $(B_DLL)
559 -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
560 $(DYNALOADER).c $(ATTRS).c $(THREAD).c $(B).c
561 -del /f $(PODDIR)\*.html
562 -del /f $(PODDIR)\*.bat
563 -del /f ..\config.sh ..\splittree.pl perlmain.c dlutils.c \
564 config.h.new perl95.c
566 -rmdir /s /q ..\lib\auto || rmdir /s ..\lib\auto
567 -rmdir /s /q $(COREDIR) || rmdir /s $(COREDIR)
569 -del /s *.lib *.def *.map *.bs Makefile *$(o) pm_to_blib
572 install : all doc utils
573 $(PERLEXE) ..\installperl
574 $(XCOPY) $(PERL95EXE) $(INST_BIN)\*.*
575 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
576 $(XCOPY) bin\*.bat $(INST_BIN)\*.*
577 $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
578 $(RCOPY) html\*.* $(INST_HTML)\*.*
580 inst_lib : $(CONFIGPM)
582 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
583 $(RCOPY) ..\lib $(INST_LIB)\*.*
585 minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils
586 $(XCOPY) $(MINIPERL) ..\t\perl.exe
587 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
591 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
594 test-prep : all utils
595 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
596 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
597 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
601 $(PERLEXE) -I..\lib harness
604 test-notty : test-prep
605 set PERL_SKIP_TTY_TEST=1
607 $(PERLEXE) -I..\lib harness
611 -@erase miniperlmain$(o)
624 -@erase ..\*$(o) ..\*.lib ..\*.exp *$(o) *.lib *.exp
625 -@erase ..\t\*.exe ..\t\*.dll ..\t\*.bat
626 -@erase ..\x2p\*.exe ..\x2p\*.bat