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)\perl
16 # uncomment next line if you wish perl to run on Windows95 also
20 # uncomment next line if you are using Visual C++ 2.x
24 # uncomment next line if you want debug version of perl (big,slow)
27 ##################### CHANGE THESE ONLY IF YOU MUST #####################
30 # Programs to compile, build .lib files and link
39 PERLDLL = -D "PERLDLL"
40 !IF "$(RUNTIME)" == ""
43 INCLUDES = -I ".\include" -I "." -I ".."
44 #PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
45 DEFINES = -D "WIN32" -D "_CONSOLE" -D "PERLDLL"
47 LIBFILES = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
48 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
50 !IF "$(RUNTIME)" == "-MD"
53 WINIOMAYBE = win32io.obj
56 !IF "$(CFG)" == "Debug"
57 ! IF "$(CCTYPE)" == "MSVC20"
58 OPTIMIZE = -Od $(RUNTIME) -Z7 -D "_DEBUG"
60 OPTIMIZE = -Od $(RUNTIME)d -Z7 -D "_DEBUG"
62 LINK_DBG = -debug -pdb:none
64 ! IF "$(CCTYPE)" == "MSVC20"
65 OPTIMIZE = -Od $(RUNTIME) -D "NDEBUG"
67 OPTIMIZE = -Od $(RUNTIME) -D "NDEBUG"
72 CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
73 LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
75 #################### do not edit below this line #######################
76 ############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
82 .SUFFIXES : .c .obj .dll .lib .exe
85 $(CC) -c $(CFLAGS) -Fo$@ $<
88 $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def -out:$@ $(LINK_FLAGS) $< $(LIBPERL)
91 INST_BIN=$(INST_TOP)\bin
92 INST_LIB=$(INST_TOP)\lib
93 INST_POD=$(INST_LIB)\pod
94 INST_HTML=$(INST_POD)\html
98 EXTUTILSDIR=$(LIBDIR)\extutils
102 PERLIMPLIB=..\perl.lib
103 MINIPERL=..\miniperl.exe
106 GLOBEXE=..\perlglob.exe
107 CONFIGPM=..\lib\Config.pm
108 MINIMOD=..\lib\ExtUtils\Miniperl.pm
110 PL2BAT=bin\PL2BAT.BAT
112 XCOPY=xcopy /f /r /i /d
113 RCOPY=xcopy /f /r /i /e /d
117 # filenames given to xsubpp must have forward slashes (since it puts
118 # full pathnames in #line strings)
119 XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
175 WIN32_C = perllib.c \
180 WIN32_OBJ = win32.obj \
184 DLL_OBJ = perllib.obj $(DYNALOADER).obj
214 ".\include\dirent.h"\
216 ".\include\sys\socket.h"\
220 EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
222 DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
223 SOCKET=$(EXTDIR)\Socket\Socket
224 FCNTL=$(EXTDIR)\Fcntl\Fcntl
225 OPCODE=$(EXTDIR)\Opcode\Opcode
226 SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
229 SOCKET_DLL=..\lib\auto\Socket\Socket.dll
230 FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
231 OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
232 SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
233 IO_DLL=..\lib\auto\IO\IO.dll
235 STATICLINKMODULES=DynaLoader
243 POD2HTML=$(PODDIR)\pod2html
244 POD2MAN=$(PODDIR)\pod2man
245 POD2LATEX=$(PODDIR)\pod2latex
246 POD2TEXT=$(PODDIR)\pod2text
252 ALL: $(PERLEXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD)
254 $(DYNALOADER).obj : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
256 #------------------------------------------------------------
258 $(GLOBEXE): perlglob.obj
259 $(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
261 perlglob.obj : perlglob.c
263 ..\miniperlmain.obj : ..\miniperlmain.c $(CORE_H)
265 ..\config.sh : config.w32 $(MINIPERL) config_sh.PL
266 $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" "INST_TOP=$(INST_TOP)"\
267 "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" config.w32 > ..\config.sh
269 $(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
270 cd .. && miniperl configpm
271 if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
272 $(XCOPY) ..\*.h ..\lib\CORE\*.*
273 $(XCOPY) *.h ..\lib\CORE\*.*
274 $(RCOPY) include ..\lib\CORE\*.*
275 $(MINIPERL) -I..\lib config_h.PL || $(MAKE) CCTYPE=$(CCTYPE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
277 $(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
278 $(LINK32) -subsystem:console -out:$@ @<<
279 $(LINK_FLAGS) ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
282 $(WIN32_OBJ) : $(CORE_H)
283 $(CORE_OBJ) : $(CORE_H)
284 $(DLL_OBJ) : $(CORE_H)
286 perldll.def : $(MINIPERL) $(CONFIGPM)
287 $(MINIPERL) -w makedef.pl > perldll.def
289 $(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
290 $(LINK32) -dll -def:perldll.def -out:$@ @<<
291 $(LINK_FLAGS) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
293 $(XCOPY) $(PERLIMPLIB) ..\lib\CORE
295 perl.def : $(MINIPERL) makeperldef.pl
296 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
298 $(MINIMOD) : $(MINIPERL) ..\minimod.pl
299 cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
301 perlmain.c : runperl.c
302 copy runperl.c perlmain.c
304 perlmain.obj : perlmain.c
305 $(CC) $(CFLAGS) -U "PERLDLL" -c perlmain.c
307 $(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
308 $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) perlmain.obj $(WINIOMAYBE) $(PERLIMPLIB)
312 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
316 $(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
317 if not exist ..\lib\auto md ..\lib\auto
318 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
320 $(XSUBPP) dl_win32.xs > $(*B).c
323 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
324 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
326 $(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
328 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
332 $(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
334 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
338 $(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
340 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
344 $(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
346 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
350 $(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
352 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
358 nmake -f ../win32/pod.mak
363 nmake PERL=$(MINIPERL)
364 $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
366 $(XCOPY) *.bat ..\win32\bin\*.*
370 -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
371 $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
373 -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
375 -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
377 -del /f $(PODDIR)\*.html
378 -del /f $(PODDIR)\*.bat
379 -rmdir /s /q ..\lib\auto
380 -rmdir /s /q ..\lib\CORE
382 install : ALL doc utils
383 if not exist $(INST_TOP) mkdir $(INST_TOP)
384 echo I $(INST_TOP) L $(LIBDIR)
385 $(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
386 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
387 $(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
388 $(XCOPY) bin\*.* $(INST_BIN)\*.*
389 $(RCOPY) ..\lib $(INST_LIB)\*.*
390 $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
391 $(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
392 $(XCOPY) ..\pod\*.html $(INST_HTML)\*.*
394 inst_lib : $(CONFIGPM)
396 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
397 $(RCOPY) ..\lib $(INST_LIB)\*.*
399 minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
400 $(XCOPY) $(MINIPERL) ..\t\perl.exe
401 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
405 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
409 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
410 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
411 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
413 $(PERLEXE) -I..\lib harness
417 -@erase miniperlmain.obj
427 -@erase ..\*.obj *.obj ..\*.lib ..\*.exp