This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Irix update
[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
68dc0745
PP
97
98PL2BAT=bin\PL2BAT.BAT
137443ea 99MAKE=nmake -nologo
3fe9a6f1 100XCOPY=xcopy /i /d /f /r
68dc0745
PP
101NULL=
102
103#
104# filenames given to xsubpp must have forward slashes (since it puts
105# full pathnames in #line strings)
137443ea 106XSUBPP=..\$(MINIPERL) -I..\..\lib ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
68dc0745 107
137443ea 108CORE_C= ..\av.c \
68dc0745
PP
109 ..\deb.c \
110 ..\doio.c \
111 ..\doop.c \
112 ..\dump.c \
113 ..\globals.c \
114 ..\gv.c \
115 ..\hv.c \
116 ..\mg.c \
117 ..\op.c \
118 ..\perl.c \
119 ..\perlio.c \
120 ..\perly.c \
121 ..\pp.c \
122 ..\pp_ctl.c \
123 ..\pp_hot.c \
124 ..\pp_sys.c \
125 ..\regcomp.c \
126 ..\regexec.c \
127 ..\run.c \
128 ..\scope.c \
129 ..\sv.c \
130 ..\taint.c \
131 ..\toke.c \
132 ..\universal.c \
133 ..\util.c
0a753a76 134
137443ea
PP
135CORE_OBJ=..\av.obj \
136 ..\deb.obj \
137 ..\doio.obj \
138 ..\doop.obj \
139 ..\dump.obj \
140 ..\globals.obj \
141 ..\gv.obj \
142 ..\hv.obj \
143 ..\mg.obj \
144 ..\op.obj \
145 ..\perl.obj \
146 ..\perlio.obj \
147 ..\perly.obj \
148 ..\pp.obj \
149 ..\pp_ctl.obj \
150 ..\pp_hot.obj \
151 ..\pp_sys.obj \
152 ..\regcomp.obj \
153 ..\regexec.obj \
154 ..\run.obj \
155 ..\scope.obj \
156 ..\sv.obj \
157 ..\taint.obj \
158 ..\toke.obj \
159 ..\universal.obj \
160 ..\util.obj
161
162WIN32_C = perllib.c \
163 win32.c \
164 win32io.c \
165 win32sck.c \
166
167WIN32_OBJ = win32.obj \
168 win32io.obj \
169 win32sck.obj \
170
171DLL_OBJ = perllib.obj $(DYNALOADER).obj
172
173CORE_H = "..\av.h"\
174 "..\cop.h"\
175 "..\cv.h"\
176 "..\dosish.h"\
177 "..\embed.h"\
178 "..\form.h"\
179 "..\gv.h"\
180 "..\handy.h"\
181 "..\hv.h"\
182 "..\mg.h"\
183 "..\nostdio.h"\
184 "..\op.h"\
185 "..\opcode.h"\
186 "..\perl.h"\
187 "..\perlio.h"\
188 "..\perlsdio.h"\
189 "..\perlsfio.h"\
190 "..\perly.h"\
191 "..\pp.h"\
192 "..\proto.h"\
193 "..\regexp.h"\
194 "..\scope.h"\
195 "..\sv.h"\
196 "..\unixish.h"\
197 "..\util.h"\
198 "..\XSUB.h"\
199 ".\config.h"\
200 "..\EXTERN.h"\
201 ".\include\dirent.h"\
202 ".\include\netdb.h"\
203 ".\include\sys\socket.h"\
204 ".\win32.h"
205
206
0a753a76 207EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
0a753a76 208
68dc0745
PP
209DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
210SOCKET=$(EXTDIR)\Socket\Socket
211FCNTL=$(EXTDIR)\Fcntl\Fcntl
212OPCODE=$(EXTDIR)\Opcode\Opcode
213SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
214IO=$(EXTDIR)\IO\IO
215
216SOCKET_DLL=..\lib\auto\Socket\Socket.dll
217FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
218OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
219SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
220IO_DLL=..\lib\auto\IO\IO.dll
221
222STATICLINKMODULES=DynaLoader
223DYNALOADMODULES= \
224 $(SOCKET_DLL) \
225 $(FCNTL_DLL) \
226 $(OPCODE_DLL) \
227 $(SDBM_FILE_DLL)\
228 $(IO_DLL)
229
230POD2HTML=$(PODDIR)\pod2html
231POD2MAN=$(PODDIR)\pod2man
232POD2LATEX=$(PODDIR)\pod2latex
233POD2TEXT=$(PODDIR)\pod2text
234
137443ea
PP
235#
236# Top targets
237#
0a753a76 238
137443ea 239ALL: $(PERLEXE) $(GLOBEXE) $(DYNALOADMODULES)
0a753a76 240
137443ea 241$(DYNALOADER).obj : $(DYNALOADER).c $(CORE_H) $(EXTDIR)\DynaLoader\dlutils.c
0a753a76 242
137443ea 243#------------------------------------------------------------
0a753a76 244
137443ea
PP
245$(GLOBEXE): perlglob.obj
246 $(LINK32) $(LINK_FLAGS) -out:$@ -subsystem:$(SUBSYS) perlglob.obj setargv.obj
0a753a76 247
137443ea
PP
248perlglob.obj : perlglob.c
249
250..\miniperlmain.obj : ..\miniperlmain.c $(CORE_H)
251
252..\config.sh : config.w32 $(MINIPERL) config_sh.PL
253 $(MINIPERL) -I..\lib config_sh.PL "INST_DRV=$(INST_DRV)" "INST_TOP=$(INST_TOP)"\
254 "cc=$(CC)" "ccflags=$(RUNTIME) -DWIN32" config.w32 > ..\config.sh
255
256$(CONFIGPM) : $(MINIPERL) ..\config.sh config_h.PL
257 cd .. && miniperl configpm
68dc0745 258 if exist lib\* $(XCOPY) /e lib\*.* ..\lib\$(NULL)
137443ea
PP
259 $(XCOPY) ..\*.h ..\lib\CORE\*.*
260 $(XCOPY) *.h ..\lib\CORE\*.*
261 $(XCOPY) /S include ..\lib\CORE\*.*
262 $(MINIPERL) -I..\lib config_h.PL || $(MAKE) RUNTIME=$(RUNTIME) CFG=$(CFG) $(CONFIGPM)
263
264$(MINIPERL) : ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
265 $(LINK32) -subsystem:console -out:$@ @<<
266 $(LINK_FLAGS) ..\miniperlmain.obj $(CORE_OBJ) $(WIN32_OBJ)
267<<
268
269$(WIN32_OBJ) : $(CORE_H)
270$(CORE_OBJ) : $(CORE_H)
271$(DLL_OBJ) : $(CORE_H)
0a753a76 272
137443ea 273perldll.def : $(MINIPERL) $(CONFIGPM)
68dc0745 274 $(MINIPERL) -w makedef.pl > perldll.def
0a753a76 275
137443ea
PP
276$(PERLDLL): perldll.def $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
277 $(LINK32) -dll -def:perldll.def -out:$@ @<<
278 $(LINK_FLAGS) $(CORE_OBJ) $(WIN32_OBJ) $(DLL_OBJ)
279<<
280 $(XCOPY) $(PERLIMPLIB) ..\lib\CORE
281
282perl.def : $(MINIPERL) makeperldef.pl
283 $(MINIPERL) -I..\lib makeperldef.pl $(NULL) > perl.def
284
285perlmain.c : runperl.c
0a753a76 286 copy runperl.c perlmain.c
137443ea
PP
287
288perlmain.obj : perlmain.c
289 $(CC) $(CFLAGS) -U "PERLDLL" -c perlmain.c
290
291$(PERLEXE): $(PERLDLL) $(CONFIGPM) perlmain.obj
292 $(LINK32) -subsystem:console -out:perl.exe $(LINK_FLAGS) perlmain.obj $(WINIOMAYBE) $(PERLIMPLIB)
293 copy perl.exe $@
294 del perl.exe
0a753a76 295 copy splittree.pl ..
137443ea 296 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
0a753a76
PP
297 attrib -r ..\t\*.*
298 copy test ..\t
0a753a76 299
137443ea 300$(DYNALOADER).c: $(MINIPERL) $(EXTDIR)\DynaLoader\dl_win32.xs $(CONFIGPM)
68dc0745
PP
301 if not exist ..\lib\auto md ..\lib\auto
302 $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
303 cd $(EXTDIR)\$(*B)
304 $(XSUBPP) dl_win32.xs > $(*B).c
0a753a76
PP
305 cd ..\..\win32
306
68dc0745
PP
307$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
308 copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
0a753a76 309
137443ea 310$(IO_DLL): $(PERLEXE) $(CONFIGPM) $(IO).xs
68dc0745 311 cd $(EXTDIR)\$(*B)
137443ea
PP
312 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
313 $(MAKE)
0a753a76
PP
314 cd ..\..\win32
315
137443ea 316$(SDBM_FILE_DLL) : $(PERLEXE) $(SDBM_FILE).xs
68dc0745 317 cd $(EXTDIR)\$(*B)
137443ea
PP
318 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
319 $(MAKE)
68dc0745 320 cd ..\..\win32
0a753a76 321
137443ea 322$(FCNTL_DLL): $(PERLEXE) $(FCNTL).xs
68dc0745 323 cd $(EXTDIR)\$(*B)
137443ea
PP
324 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
325 $(MAKE)
0a753a76
PP
326 cd ..\..\win32
327
137443ea 328$(OPCODE_DLL): $(PERLEXE) $(OPCODE).xs
68dc0745 329 cd $(EXTDIR)\$(*B)
137443ea
PP
330 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
331 $(MAKE)
68dc0745 332 cd ..\..\win32
0a753a76 333
137443ea 334$(SOCKET_DLL): $(SOCKET).xs $(PERLEXE)
68dc0745 335 cd $(EXTDIR)\$(*B)
137443ea
PP
336 ..\..\miniperl -I..\..\lib Makefile.PL INSTALLDIRS=perl
337 $(MAKE)
0a753a76
PP
338 cd ..\..\win32
339
68dc0745 340doc: $(PERLEXE)
137443ea
PP
341 cd $(PODDIR)
342 nmake -f ../win32/pod.mak
343 cd ..\win32
68dc0745 344
3fe9a6f1
PP
345utils: $(PERLEXE)
346 cd ..\utils
347 nmake PERL=$(MINIPERL)
348 $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
349 h2xs perldoc pstruct
350 $(XCOPY) *.bat ..\win32\bin\*.*
351 cd ..\win32
352
137443ea
PP
353distclean: clean
354 -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) \
355 $(PERLIMPLIB) ..\miniperl.lib
68dc0745 356 -del /f *.def
54310121
PP
357 -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
358 $(OPCODE_DLL)
359 -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
360 $(DYNALOADER).c
68dc0745
PP
361 -del /f $(PODDIR)\*.html
362 -del /f $(PODDIR)\*.bat
54310121
PP
363 -rmdir /s /q ..\lib\auto
364 -rmdir /s /q ..\lib\CORE
68dc0745
PP
365 -rmdir /s /q debug
366
3fe9a6f1 367install : ALL doc utils
68dc0745
PP
368 if not exist $(INST_TOP) mkdir $(INST_TOP)
369 echo I $(INST_TOP) L $(LIBDIR)
370 $(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
371 $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
372 $(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
3fe9a6f1 373 $(XCOPY) bin\*.* $(INST_BIN)\*.*
68dc0745
PP
374 $(XCOPY) /e ..\lib $(INST_LIB)\*.*
375 $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
376 $(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
377 $(XCOPY) ..\pod\*.html $(INST_HTML)\*.*
378
137443ea 379inst_lib : $(CONFIGPM)
68dc0745 380 copy splittree.pl ..
137443ea 381 $(MINIPERL) -I..\lib ..\splittree.pl "../LIB" "../LIB/auto"
68dc0745 382 $(XCOPY) /e ..\lib $(INST_LIB)\*.*
0a753a76 383
137443ea
PP
384minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM)
385 $(XCOPY) $(MINIPERL) ..\t\perl.exe
386 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
387 attrib -r ..\t\*.*
388 copy test ..\t
389 cd ..\t
390 $(MINIPERL) -I..\lib test base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t
391 cd ..\win32
392
68dc0745
PP
393test : all
394 $(XCOPY) $(PERLEXE) ..\t\$(NULL)
395 $(XCOPY) $(PERLDLL) ..\t\$(NULL)
396 $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
137443ea
PP
397 cd ..\t
398 $(PERLEXE) -I..\lib harness
68dc0745 399 cd ..\win32
137443ea
PP
400
401clean :
402 -@erase miniperlmain.obj
403 -@erase $(MINIPERL)
404 -@erase perlglob.obj
405 -@erase perlmain.obj
406 -@erase $(GLOBEXE)
407 -@erase $(PERLEXE)
408 -@erase $(PERLDLL)
409 -@erase $(CORE_OBJ)
410 -@erase $(WIN32_OBJ)
411 -@erase $(DLL_OBJ)
412 -@erase ..\*.obj *.obj ..\*.lib ..\*.exp
413 -@erase *.ilk
414 -@erase *.pdb
415
416