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