This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
More detailed IO::Socket documentation
[perl5.git] / win32 / Makefile
CommitLineData
68dc0745
PP
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
PP
8
9#
10# Set these to wherever you want "nmake install" to put your
11# newly built perl.
68dc0745 12#
0a753a76 13
137443ea
PP
14INST_DRV=c:
15INST_TOP=$(INST_DRV)\perl
16
17
18##################### CHANGE THESE ONLY IF YOU MUST #####################
19
20#
21# Programs to compile, build .lib files and link
22#
68dc0745 23
137443ea
PP
24CC=cl.exe
25LINK32=link.exe
26LIB32=$(LINK32) -lib
68dc0745 27#
137443ea
PP
28# Options
29#
30PERLDLL = -D "PERLDLL"
31RUNTIME = -MD
32INCLUDES = -I ".\include" -I "." -I ".."
33#PCHFLAGS = -Fp"$(INTDIR)/modules.pch" -YX
34DEFINES = -D "WIN32" -D "_CONSOLE" -D "PERLDLL"
35SUBSYS = console
36LIBFILES = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib \
37 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib
38
39!IF "$(RUNTIME)" == "-MD"
40WINIOMAYBE =
41!ELSE
42WINIOMAYBE = win32io.obj
43!ENDIF
44
45!IF "$(CFG)" == "Debug"
46! IF "$(CCTYPE)" == "MSVC20"
47OPTIMIZE = -Od $(RUNTIME) -Z7 -D "_DEBUG"
48! ELSE
49OPTIMIZE = -Od $(RUNTIME)d -Z7 -D "_DEBUG"
50! ENDIF
96e4d5b1 51LINK_DBG = -debug -pdb:none
137443ea
PP
52!ELSE
53! IF "$(CCTYPE)" == "MSVC20"
54OPTIMIZE = -Od $(RUNTIME) -D "NDEBUG"
55! ELSE
96e4d5b1 56OPTIMIZE = -Od $(RUNTIME) -D "NDEBUG"
137443ea
PP
57! ENDIF
58LINK_DBG = -release
59!ENDIF
68dc0745 60
137443ea
PP
61CFLAGS = -nologo -W3 $(INCLUDES) $(DEFINES) $(PCHFLAGS) $(OPTIMIZE)
62LINK_FLAGS = -nologo $(LIBFILES) $(LINK_DBG) -machine:I386
63
64#################### do not edit below this line #######################
65############# NO USER-SERVICEABLE PARTS BEYOND THIS POINT ##############
66
67#
68# Rules
69#
70.SUFFIXES :
71.SUFFIXES : .c .obj .dll .lib .exe
72
73.c.obj:
74 $(CC) -c $(CFLAGS) -Fo$@ $<
75
76.obj.dll:
77 $(LINK32) -dll -subsystem:windows -implib:$(*B).lib -def:$(*B).def -out:$@ $(LINK_FLAGS) $< $(LIBPERL)
68dc0745 78
68dc0745
PP
79#
80INST_BIN=$(INST_TOP)\bin
81INST_LIB=$(INST_TOP)\lib
137443ea 82INST_POD=$(INST_LIB)\pod
68dc0745
PP
83INST_HTML=$(INST_POD)\html
84LIBDIR=..\lib
0a753a76 85EXTDIR=..\ext
68dc0745 86PODDIR=..\pod
0a753a76 87EXTUTILSDIR=$(LIBDIR)\extutils
68dc0745
PP
88
89#
90# various targets
54310121 91PERLIMPLIB=..\perl.lib
68dc0745
PP
92MINIPERL=..\miniperl.exe
93PERLDLL=..\perl.dll
94PERLEXE=..\perl.exe
95GLOBEXE=..\perlglob.exe
137443ea 96CONFIGPM=..\lib\Config.pm
83437bec 97MINIMOD=..\lib\ExtUtils\Miniperl.pm
68dc0745
PP
98
99PL2BAT=bin\PL2BAT.BAT
137443ea 100MAKE=nmake -nologo
3fe9a6f1 101XCOPY=xcopy /i /d /f /r
68dc0745
PP
102NULL=
103
104#
105# filenames given to xsubpp must have forward slashes (since it puts
106# full pathnames in #line strings)
137443ea 107XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
68dc0745 108
137443ea 109CORE_C= ..\av.c \
68dc0745
PP
110 ..\deb.c \
111 ..\doio.c \
112 ..\doop.c \
113 ..\dump.c \
114 ..\globals.c \
115 ..\gv.c \
116 ..\hv.c \
117 ..\mg.c \
118 ..\op.c \
119 ..\perl.c \
120 ..\perlio.c \
121 ..\perly.c \
122 ..\pp.c \
123 ..\pp_ctl.c \
124 ..\pp_hot.c \
125 ..\pp_sys.c \
126 ..\regcomp.c \
127 ..\regexec.c \
128 ..\run.c \
129 ..\scope.c \
130 ..\sv.c \
131 ..\taint.c \
132 ..\toke.c \
133 ..\universal.c \
134 ..\util.c
0a753a76 135
137443ea
PP
136CORE_OBJ=..\av.obj \
137 ..\deb.obj \
138 ..\doio.obj \
139 ..\doop.obj \
140 ..\dump.obj \
141 ..\globals.obj \
142 ..\gv.obj \
143 ..\hv.obj \
144 ..\mg.obj \
145 ..\op.obj \
146 ..\perl.obj \
147 ..\perlio.obj \
148 ..\perly.obj \
149 ..\pp.obj \
150 ..\pp_ctl.obj \
151 ..\pp_hot.obj \
152 ..\pp_sys.obj \
153 ..\regcomp.obj \
154 ..\regexec.obj \
155 ..\run.obj \
156 ..\scope.obj \
157 ..\sv.obj \
158 ..\taint.obj \
159 ..\toke.obj \
160 ..\universal.obj \
161 ..\util.obj
162
163WIN32_C = perllib.c \
164 win32.c \
165 win32io.c \
166 win32sck.c \
167
168WIN32_OBJ = win32.obj \
169 win32io.obj \
170 win32sck.obj \
171
172DLL_OBJ = perllib.obj $(DYNALOADER).obj
173
174CORE_H = "..\av.h"\
175 "..\cop.h"\
176 "..\cv.h"\
177 "..\dosish.h"\
178 "..\embed.h"\
179 "..\form.h"\
180 "..\gv.h"\
181 "..\handy.h"\
182 "..\hv.h"\
183 "..\mg.h"\
184 "..\nostdio.h"\
185 "..\op.h"\
186 "..\opcode.h"\
187 "..\perl.h"\
188 "..\perlio.h"\
189 "..\perlsdio.h"\
190 "..\perlsfio.h"\
191 "..\perly.h"\
192 "..\pp.h"\
193 "..\proto.h"\
194 "..\regexp.h"\
195 "..\scope.h"\
196 "..\sv.h"\
197 "..\unixish.h"\
198 "..\util.h"\
199 "..\XSUB.h"\
200 ".\config.h"\
201 "..\EXTERN.h"\
202 ".\include\dirent.h"\
203 ".\include\netdb.h"\
204 ".\include\sys\socket.h"\
205 ".\win32.h"
206
207
0a753a76 208EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
0a753a76 209
68dc0745
PP
210DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
211SOCKET=$(EXTDIR)\Socket\Socket
212FCNTL=$(EXTDIR)\Fcntl\Fcntl
213OPCODE=$(EXTDIR)\Opcode\Opcode
214SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
215IO=$(EXTDIR)\IO\IO
216
217SOCKET_DLL=..\lib\auto\Socket\Socket.dll
218FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
219OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
220SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
221IO_DLL=..\lib\auto\IO\IO.dll
222
223STATICLINKMODULES=DynaLoader
224DYNALOADMODULES= \
225 $(SOCKET_DLL) \
226 $(FCNTL_DLL) \
227 $(OPCODE_DLL) \
228 $(SDBM_FILE_DLL)\
229 $(IO_DLL)
230
231POD2HTML=$(PODDIR)\pod2html
232POD2MAN=$(PODDIR)\pod2man
233POD2LATEX=$(PODDIR)\pod2latex
234POD2TEXT=$(PODDIR)\pod2text
235
137443ea
PP
236#
237# Top targets
238#
0a753a76 239
83437bec 240ALL: $(PERLEXE) $(GLOBEXE) $(DYNALOADMODULES) $(MINIMOD)
0a753a76 241
137443ea 242$(DYNALOADER).obj : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
0a753a76 243
137443ea 244#------------------------------------------------------------
0a753a76 245
137443ea
PP
246$(GLOBEXE): perlglob.obj
247 $(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
0a753a76 248
137443ea
PP
249perlglob.obj : perlglob.c
250
251..\miniperlmain.obj : ..\miniperlmain.c $(CORE_H)
252
253..\config.sh : config.w32 $(MINIPERL) config_sh.PL
254 $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" "INST_TOP=$(INST_TOP)"\
255 "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" config.w32 > ..\config.sh
256
83437bec 257$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL ..\minimod.pl
137443ea 258 cd .. && miniperl configpm
68dc0745 259 if exist lib\* $(XCOPY) /e lib\*.* ..\lib\$(NULL)
137443ea
PP
260 $(XCOPY) ..\*.h ..\lib\CORE\*.*
261 $(XCOPY) *.h ..\lib\CORE\*.*
262 $(XCOPY) /S include ..\lib\CORE\*.*
263 $(MINIPERL) -I..\lib config_h.PL || $(MAKE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
264
265$(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
266 $(LINK32) -subsystem:console -out:$@ @<<
267 $(LINK_FLAGS) ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
268<<
269
270$(WIN32_OBJ) : $(CORE_H)
271$(CORE_OBJ) : $(CORE_H)
272$(DLL_OBJ) : $(CORE_H)
0a753a76 273
137443ea 274perldll.def : $(MINIPERL) $(CONFIGPM)
68dc0745 275 $(MINIPERL) -w makedef.pl > perldll.def
0a753a76 276
137443ea
PP
277$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
278 $(LINK32) -dll -def:perldll.def -out:$@ @<<
279 $(LINK_FLAGS) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
280<<
281 $(XCOPY) $(PERLIMPLIB) ..\lib\CORE
282
283perl.def : $(MINIPERL) makeperldef.pl
284 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
285
83437bec
NIS
286$(MINIMOD) : $(MINIPERL) ..\minimod.pl
287 cd .. && miniperl minimod.pl > lib\ExtUtils\Miniperl.pm
288
289perlmain.c : runperl.c
0a753a76 290 copy runperl.c perlmain.c
137443ea
PP
291
292perlmain.obj : perlmain.c
293 $(CC) $(CFLAGS) -U "PERLDLL" -c perlmain.c
294
295$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
296 $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) perlmain.obj $(WINIOMAYBE) $(PERLIMPLIB)
297 copy perl.exe $@
298 del perl.exe
0a753a76 299 copy splittree.pl ..
137443ea 300 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
0a753a76
PP
301 attrib -r ..\t\*.*
302 copy test ..\t
0a753a76 303
137443ea 304$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
68dc0745
PP
305 if not exist ..\lib\auto md ..\lib\auto
306 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
307 cd $(EXTDIR)\$(*B)
308 $(XSUBPP) dl_win32.xs > $(*B).c
0a753a76
PP
309 cd ..\..\win32
310
68dc0745
PP
311$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
312 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
0a753a76 313
137443ea 314$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
68dc0745 315 cd $(EXTDIR)\$(*B)
137443ea
PP
316 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
317 $(MAKE)
0a753a76
PP
318 cd ..\..\win32
319
137443ea 320$(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
68dc0745 321 cd $(EXTDIR)\$(*B)
137443ea
PP
322 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
323 $(MAKE)
68dc0745 324 cd ..\..\win32
0a753a76 325
137443ea 326$(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
68dc0745 327 cd $(EXTDIR)\$(*B)
137443ea
PP
328 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
329 $(MAKE)
0a753a76
PP
330 cd ..\..\win32
331
137443ea 332$(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
68dc0745 333 cd $(EXTDIR)\$(*B)
137443ea
PP
334 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
335 $(MAKE)
68dc0745 336 cd ..\..\win32
0a753a76 337
137443ea 338$(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
68dc0745 339 cd $(EXTDIR)\$(*B)
137443ea
PP
340 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
341 $(MAKE)
0a753a76
PP
342 cd ..\..\win32
343
68dc0745 344doc: $(PERLEXE)
137443ea
PP
345 cd $(PODDIR)
346 nmake -f ../win32/pod.mak
347 cd ..\win32
68dc0745 348
3fe9a6f1
PP
349utils: $(PERLEXE)
350 cd ..\utils
351 nmake PERL=$(MINIPERL)
352 $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
353 h2xs perldoc pstruct
354 $(XCOPY) *.bat ..\win32\bin\*.*
355 cd ..\win32
356
137443ea
PP
357distclean: clean
358 -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
83437bec 359 $(PERLIMPLIB) ..\miniperl.lib $(MINIMOD)
68dc0745 360 -del /f *.def
54310121
PP
361 -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
362 $(OPCODE_DLL)
363 -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
364 $(DYNALOADER).c
68dc0745
PP
365 -del /f $(PODDIR)\*.html
366 -del /f $(PODDIR)\*.bat
54310121
PP
367 -rmdir /s /q ..\lib\auto
368 -rmdir /s /q ..\lib\CORE
68dc0745 369
3fe9a6f1 370install : ALL doc utils
68dc0745
PP
371 if not exist $(INST_TOP) mkdir $(INST_TOP)
372 echo I $(INST_TOP) L $(LIBDIR)
373 $(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
374 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
375 $(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
3fe9a6f1 376 $(XCOPY) bin\*.* $(INST_BIN)\*.*
68dc0745
PP
377 $(XCOPY) /e ..\lib $(INST_LIB)\*.*
378 $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
379 $(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
380 $(XCOPY) ..\pod\*.html $(INST_HTML)\*.*
381
137443ea 382inst_lib : $(CONFIGPM)
68dc0745 383 copy splittree.pl ..
137443ea 384 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
68dc0745 385 $(XCOPY) /e ..\lib $(INST_LIB)\*.*
0a753a76 386
137443ea
PP
387minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
388 $(XCOPY) $(MINIPERL) ..\t\perl.exe
389 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
390 attrib -r ..\t\*.*
391 copy test ..\t
392 cd ..\t
393 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
394 cd ..\win32
395
68dc0745
PP
396test : all
397 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
398 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
399 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
137443ea
PP
400 cd ..\t
401 $(PERLEXE) -I..\lib harness
68dc0745 402 cd ..\win32
137443ea
PP
403
404clean :
405 -@erase miniperlmain.obj
406 -@erase $(MINIPERL)
407 -@erase perlglob.obj
408 -@erase perlmain.obj
409 -@erase $(GLOBEXE)
410 -@erase $(PERLEXE)
411 -@erase $(PERLDLL)
412 -@erase $(CORE_OBJ)
413 -@erase $(WIN32_OBJ)
414 -@erase $(DLL_OBJ)
415 -@erase ..\*.obj *.obj ..\*.lib ..\*.exp
416 -@erase *.ilk
417 -@erase *.pdb
418
419