3da20e77aa5455c0d3939f302c04676621c9b4b8
[p5sagit/p5-mst-13.2.git] / win32 / Makefile
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 #
8 # There's no support for building an all-static perl yet.
9 # Doesn't build any of the stuff in ..\utils yet.
10 # No support for installing documentation, uh, yet.
11 #
12
13
14 #
15 # Set this to wherever you want "nmake install" to put your
16 # newly built perl.  If you change this, you better change
17 # all occurrences of this prefix in $(INST_TOP)\lib\Config.pm
18 # as well.
19
20 INST_TOP=C:\perl
21
22 #################### do not edit below this line ########################
23 #
24 INST_BIN=$(INST_TOP)\bin
25 INST_LIB=$(INST_TOP)\lib
26 INST_POD=$(INST_TOP)\pod
27 INST_HTML=$(INST_POD)\html
28 LIBDIR=..\lib
29 EXTDIR=..\ext
30 PODDIR=..\pod
31 EXTUTILSDIR=$(LIBDIR)\extutils
32
33 #
34 # various targets
35 PERLLIB=..\libperl.lib
36 PERLIMPLIB=..\perl.lib
37 MINIPERL=..\miniperl.exe
38 PERLDLL=..\perl.dll
39 PERLEXE=..\perl.exe
40 GLOBEXE=..\perlglob.exe
41
42 PL2BAT=bin\PL2BAT.BAT
43 MAKE=nmake /nologo
44 XCOPY=xcopy /i /d /f /r
45 NULL=
46
47 #
48 # filenames given to xsubpp must have forward slashes (since it puts
49 # full pathnames in #line strings)
50 XSUBPP=..\$(MINIPERL) ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes
51
52 CORE_C=                 \
53         ..\av.c         \
54         ..\deb.c        \
55         ..\doio.c       \
56         ..\doop.c       \
57         ..\dump.c       \
58         ..\globals.c    \
59         ..\gv.c         \
60         ..\hv.c         \
61         ..\mg.c         \
62         ..\op.c         \
63         ..\perl.c       \
64         ..\perlio.c     \
65         ..\perly.c      \
66         ..\pp.c         \
67         ..\pp_ctl.c     \
68         ..\pp_hot.c     \
69         ..\pp_sys.c     \
70         ..\regcomp.c    \
71         ..\regexec.c    \
72         ..\run.c        \
73         ..\scope.c      \
74         ..\sv.c         \
75         ..\taint.c      \
76         ..\toke.c       \
77         ..\universal.c  \
78         ..\util.c
79
80 EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File
81
82 DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
83 SOCKET=$(EXTDIR)\Socket\Socket
84 FCNTL=$(EXTDIR)\Fcntl\Fcntl
85 OPCODE=$(EXTDIR)\Opcode\Opcode
86 SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
87 IO=$(EXTDIR)\IO\IO
88
89 SOCKET_DLL=..\lib\auto\Socket\Socket.dll
90 FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
91 OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
92 SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
93 IO_DLL=..\lib\auto\IO\IO.dll
94
95 STATICLINKMODULES=DynaLoader
96 DYNALOADMODULES=        \
97         $(SOCKET_DLL)   \
98         $(FCNTL_DLL)    \
99         $(OPCODE_DLL)   \
100         $(SDBM_FILE_DLL)\
101         $(IO_DLL)
102
103 POD2HTML=$(PODDIR)\pod2html
104 POD2MAN=$(PODDIR)\pod2man
105 POD2LATEX=$(PODDIR)\pod2latex
106 POD2TEXT=$(PODDIR)\pod2text
107
108 ALL: $(PERLEXE) $(GLOBEXE) $(DYNALOADMODULES)
109
110 !IF "$(CFG)" ==""
111 CFG=Release
112 !ENDIF
113
114 modules.lib : $(DYNALOADER).c
115         $(MAKE) -A -f modules.mak CFG="modules - Win32 $(CFG)"
116
117 $(GLOBEXE):
118         $(MAKE) -f perlglob.mak CFG="perlglob - Win32 Release"
119
120 $(PERLLIB): $(CORE_C)
121         $(MAKE) -f libperl.mak CFG="libperl - Win32 $(CFG)"
122
123 $(MINIPERL): $(PERLLIB)
124         $(MAKE) -A -f miniperl.mak CFG="miniperl - Win32 $(CFG)"
125         copy config.w32 ..\config.sh
126         cd ..
127         miniperl configpm
128         cd win32
129         if exist lib\* $(XCOPY) /e lib\*.* ..\lib\$(NULL)
130         copy bin\test.bat ..\t
131
132 $(PERLDLL): $(MINIPERL) $(PERLLIB)
133         $(MINIPERL) -w makedef.pl > perldll.def
134         $(MAKE) -A -f perldll.mak CFG="perldll - Win32 $(CFG)"
135
136 $(PERLEXE): $(MINIPERL) modules.lib $(PERLDLL)
137 #       $(MINIPERL) makemain.pl $(STATICLINKMODUES) > perlmain.c
138 #       $(MINIPERL) makeperldef.pl $(STATICLINKMODUES) > perl.def
139         $(MINIPERL) makeperldef.pl $(NULL) > perl.def
140         copy runperl.c perlmain.c
141         $(MAKE) -A -f perl.mak CFG="perl - Win32 $(CFG)"
142         copy ..\_perl.exe $(PERLEXE)
143         del ..\_perl.exe
144         del ..\*.exp
145         copy splittree.pl .. 
146         $(MINIPERL) ..\splittree.pl "../LIB" "../LIB/auto"
147         attrib -r ..\t\*.*
148         copy test ..\t
149         $(XCOPY) ..\*.h ..\lib\CORE\*.*
150         $(XCOPY) $(PERLIMPLIB) ..\lib\CORE
151         $(XCOPY) $(PERLLIB) ..\lib\CORE
152         $(XCOPY) *.h ..\lib\CORE
153         $(XCOPY) /S include ..\lib\CORE
154
155 $(DYNALOADER).c: $(EXTDIR)\DynaLoader\dl_win32.xs
156         if not exist ..\lib\auto md ..\lib\auto
157         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
158         cd $(EXTDIR)\$(*B)
159         $(XSUBPP) dl_win32.xs > $(*B).c
160         cd ..\..\win32
161
162 $(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
163         copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs
164
165 $(SOCKET).c: $(SOCKET).xs
166         if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
167         $(MINIPERL) genxsdef.pl $(*B) > $(*B).def
168         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
169         cd $(EXTDIR)\$(*B)
170         $(XSUBPP) $(*B).xs > $(*B).c
171         cd ..\..\win32
172
173 $(IO).c:  $(IO).xs
174         if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
175         $(MINIPERL) genxsdef.pl $(*B) > $(*B).def
176         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
177         $(XCOPY) /s $(EXTDIR)\$(*B)\lib\*.* $(LIBDIR)
178         cd $(EXTDIR)\$(*B)
179         $(XSUBPP) $(*B).xs > $(*B).c
180         cd ..\..\win32
181
182 $(SDBM_FILE).c:  $(SDBM_FILE).xs
183         if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
184         $(MINIPERL) genxsdef.pl $(*B) > $(*B).def
185         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
186         cd $(EXTDIR)\$(*B)
187         $(XSUBPP) -typemap ./typemap $(*B).xs > $(*B).c
188         cd ..\..\win32
189
190 $(FCNTL).c:  $(FCNTL).xs
191         if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
192         $(MINIPERL) genxsdef.pl $(*B) > $(*B).def
193         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
194         cd $(EXTDIR)\$(*B)
195         $(XSUBPP) $(*B).xs > $(*B).c
196         cd ..\..\win32
197
198 $(OPCODE).c:  $(OPCODE).xs
199         if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
200         $(MINIPERL) genxsdef.pl $(*B) > $(*B).def
201         $(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
202         $(XCOPY) $(EXTDIR)\$(*B)\*.pm $(LIBDIR)\$(NULL)
203         cd $(EXTDIR)\$(*B)
204         $(XSUBPP) $(*B).xs > $(*B).c
205         cd ..\..\win32
206
207 $(SOCKET_DLL): $(SOCKET).c $(PERLDLL)
208         $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"
209
210 $(IO_DLL): $(IO).c $(PERLDLL)
211         $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"
212
213 $(SDBM_FILE_DLL): $(SDBM_FILE).c $(PERLDLL)
214         $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"
215
216 $(FCNTL_DLL): $(FCNTL).c $(PERLDLL)
217         $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"
218
219 $(OPCODE_DLL): $(OPCODE).c $(PERLDLL)
220         $(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"
221
222 doc: $(PERLEXE)
223         cd $(PODDIR)
224         nmake -f ../win32/pod.mak
225         cd ..\win32
226
227 utils: $(PERLEXE)
228         cd ..\utils
229         nmake PERL=$(MINIPERL)
230         $(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
231                         h2xs perldoc pstruct
232         $(XCOPY) *.bat ..\win32\bin\*.*
233         cd ..\win32
234
235 distclean:
236         -del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) $(PERLLIB) \
237                 $(PERLIMPLIB) ..\miniperl.lib modules.lib
238         -del /f *.def
239         -del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
240                 $(OPCODE_DLL)
241         -del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
242                 $(DYNALOADER).c
243         -del /f $(PODDIR)\*.html
244         -del /f $(PODDIR)\*.bat
245         -rmdir /s /q ..\lib\auto
246         -rmdir /s /q ..\lib\CORE
247         -rmdir /s /q release
248         -rmdir /s /q debug
249
250 install : ALL doc utils
251         if not exist $(INST_TOP) mkdir $(INST_TOP)
252         echo I $(INST_TOP) L $(LIBDIR)
253         $(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
254         $(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
255         $(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
256         $(XCOPY) bin\*.* $(INST_BIN)\*.*
257         $(XCOPY) /e ..\lib $(INST_LIB)\*.*
258         $(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
259         $(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
260         $(XCOPY) ..\pod\*.html $(INST_HTML)\*.*
261
262 inst_lib : 
263         copy splittree.pl .. 
264         $(MINIPERL) ..\splittree.pl "../LIB" "../LIB/auto"
265         $(XCOPY) /e ..\lib $(INST_LIB)\*.*
266
267 test : all
268         $(XCOPY) $(PERLEXE) ..\t\$(NULL)
269         $(XCOPY) $(PERLDLL) ..\t\$(NULL)
270         $(XCOPY) $(GLOBEXE) ..\t\$(NULL)
271         cd ..\t
272         $(PERLEXE) test
273         cd ..\win32