summaryrefslogtreecommitdiff
path: root/win32/Makefile
blob: 1136d15097bb7f3de4aa5f4a49c38c24a842dc48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#
# Makefile to build perl on Windowns NT using Microsoft NMAKE.
#
#
# This is set up to build a perl.exe that runs off a shared library
# (perl.dll).  Also makes individual DLLs for the XS extensions.
#
# There's no support for building an all-static perl yet.
# Doesn't build any of the stuff in ..\utils yet.
# No support for installing documentation, uh, yet.
#


#
# Set this to wherever you want "nmake install" to put your
# newly built perl.  If you change this, you better change
# all occurrences of this prefix in $(INST_TOP)\lib\Config.pm
# as well.

INST_TOP=C:\perl

#################### do not edit below this line ########################
#
INST_BIN=$(INST_TOP)\bin
INST_LIB=$(INST_TOP)\lib
INST_POD=$(INST_TOP)\pod
INST_HTML=$(INST_POD)\html
LIBDIR=..\lib
EXTDIR=..\ext
PODDIR=..\pod
EXTUTILSDIR=$(LIBDIR)\extutils

#
# various targets
PERLLIB=..\libperl.lib
PERLIMPLIB=..\perl.lib
MINIPERL=..\miniperl.exe
PERLDLL=..\perl.dll
PERLEXE=..\perl.exe
GLOBEXE=..\perlglob.exe

PL2BAT=bin\PL2BAT.BAT
MAKE=nmake /nologo
XCOPY=xcopy /i /d /f /r
NULL=

#
# filenames given to xsubpp must have forward slashes (since it puts
# full pathnames in #line strings)
XSUBPP=..\$(MINIPERL) ..\$(EXTUTILSDIR)\xsubpp -C++ -prototypes

CORE_C=			\
	..\av.c		\
	..\deb.c	\
	..\doio.c	\
	..\doop.c	\
	..\dump.c	\
	..\globals.c	\
	..\gv.c		\
	..\hv.c		\
	..\mg.c		\
	..\op.c		\
	..\perl.c	\
	..\perlio.c	\
	..\perly.c	\
	..\pp.c		\
	..\pp_ctl.c	\
	..\pp_hot.c	\
	..\pp_sys.c	\
	..\regcomp.c	\
	..\regexec.c	\
	..\run.c	\
	..\scope.c	\
	..\sv.c		\
	..\taint.c	\
	..\toke.c	\
	..\universal.c	\
	..\util.c

EXTENSIONS=DynaLoader Socket IO Fcntl Opcode SDBM_File

DYNALOADER=$(EXTDIR)\DynaLoader\DynaLoader
SOCKET=$(EXTDIR)\Socket\Socket
FCNTL=$(EXTDIR)\Fcntl\Fcntl
OPCODE=$(EXTDIR)\Opcode\Opcode
SDBM_FILE=$(EXTDIR)\SDBM_File\SDBM_File
IO=$(EXTDIR)\IO\IO

SOCKET_DLL=..\lib\auto\Socket\Socket.dll
FCNTL_DLL=..\lib\auto\Fcntl\Fcntl.dll
OPCODE_DLL=..\lib\auto\Opcode\Opcode.dll
SDBM_FILE_DLL=..\lib\auto\SDBM_File\SDBM_File.dll
IO_DLL=..\lib\auto\IO\IO.dll

STATICLINKMODULES=DynaLoader
DYNALOADMODULES=	\
	$(SOCKET_DLL)	\
	$(FCNTL_DLL)	\
	$(OPCODE_DLL)	\
	$(SDBM_FILE_DLL)\
	$(IO_DLL)

POD2HTML=$(PODDIR)\pod2html
POD2MAN=$(PODDIR)\pod2man
POD2LATEX=$(PODDIR)\pod2latex
POD2TEXT=$(PODDIR)\pod2text

ALL: $(PERLEXE) $(GLOBEXE) $(DYNALOADMODULES)

!IF "$(CFG)" ==""
CFG=Release
!ENDIF

modules.lib : $(DYNALOADER).c
	$(MAKE) -A -f modules.mak CFG="modules - Win32 $(CFG)"

$(GLOBEXE):
	$(MAKE) -f perlglob.mak CFG="perlglob - Win32 Release"

$(PERLLIB): $(CORE_C)
	$(MAKE) -f libperl.mak CFG="libperl - Win32 $(CFG)"

$(MINIPERL): $(PERLLIB)
	$(MAKE) -A -f miniperl.mak CFG="miniperl - Win32 $(CFG)"
	copy config.w32 ..\config.sh
	cd ..
	miniperl configpm
	cd win32
	if exist lib\* $(XCOPY) /e lib\*.* ..\lib\$(NULL)
	copy bin\test.bat ..\t

$(PERLDLL): $(MINIPERL) $(PERLLIB)
	$(MINIPERL) -w makedef.pl > perldll.def
	$(MAKE) -A -f perldll.mak CFG="perldll - Win32 $(CFG)"

$(PERLEXE): $(MINIPERL) modules.lib $(PERLDLL)
#	$(MINIPERL) makemain.pl $(STATICLINKMODUES) > perlmain.c
#	$(MINIPERL) makeperldef.pl $(STATICLINKMODUES) > perl.def
	$(MINIPERL) makeperldef.pl $(NULL) > perl.def
	copy runperl.c perlmain.c
	$(MAKE) -A -f perl.mak CFG="perl - Win32 $(CFG)"
	copy ..\_perl.exe $(PERLEXE)
	del ..\_perl.exe
	del ..\*.exp
	copy splittree.pl .. 
	$(MINIPERL) ..\splittree.pl "../LIB" "../LIB/auto"
	attrib -r ..\t\*.*
	copy test ..\t
	$(XCOPY) ..\*.h ..\lib\CORE\*.*
	$(XCOPY) $(PERLIMPLIB) ..\lib\CORE
	$(XCOPY) $(PERLLIB) ..\lib\CORE
	$(XCOPY) *.h ..\lib\CORE
	$(XCOPY) /S include ..\lib\CORE

$(DYNALOADER).c: $(EXTDIR)\DynaLoader\dl_win32.xs
	if not exist ..\lib\auto md ..\lib\auto
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) dl_win32.xs > $(*B).c
	cd ..\..\win32

$(EXTDIR)\DynaLoader\dl_win32.xs: dl_win32.xs
	copy dl_win32.xs $(EXTDIR)\DynaLoader\dl_win32.xs

$(SOCKET).c: $(SOCKET).xs
	if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
	$(MINIPERL) genxsdef.pl $(*B) > $(*B).def
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) $(*B).xs > $(*B).c
	cd ..\..\win32

$(IO).c:  $(IO).xs
	if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
	$(MINIPERL) genxsdef.pl $(*B) > $(*B).def
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	$(XCOPY) /s $(EXTDIR)\$(*B)\lib\*.* $(LIBDIR)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) $(*B).xs > $(*B).c
	cd ..\..\win32

$(SDBM_FILE).c:  $(SDBM_FILE).xs
	if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
	$(MINIPERL) genxsdef.pl $(*B) > $(*B).def
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) -typemap ./typemap $(*B).xs > $(*B).c
	cd ..\..\win32

$(FCNTL).c:  $(FCNTL).xs
	if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
	$(MINIPERL) genxsdef.pl $(*B) > $(*B).def
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) $(*B).xs > $(*B).c
	cd ..\..\win32

$(OPCODE).c:  $(OPCODE).xs
	if not exist ..\lib\auto\$(*B) md ..\lib\auto\$(*B)
	$(MINIPERL) genxsdef.pl $(*B) > $(*B).def
	$(XCOPY) $(EXTDIR)\$(*B)\$(*B).pm $(LIBDIR)\$(NULL)
	$(XCOPY) $(EXTDIR)\$(*B)\*.pm $(LIBDIR)\$(NULL)
	cd $(EXTDIR)\$(*B)
	$(XSUBPP) $(*B).xs > $(*B).c
	cd ..\..\win32

$(SOCKET_DLL): $(SOCKET).c $(PERLDLL)
	$(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"

$(IO_DLL): $(IO).c $(PERLDLL)
	$(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"

$(SDBM_FILE_DLL): $(SDBM_FILE).c $(PERLDLL)
	$(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"

$(FCNTL_DLL): $(FCNTL).c $(PERLDLL)
	$(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"

$(OPCODE_DLL): $(OPCODE).c $(PERLDLL)
	$(MAKE) -f $(*B).mak CFG="$(*B) - Win32 $(CFG)"

doc: $(PERLEXE)
	$(PERLEXE) $(POD2HTML).PL
	$(PERLEXE) $(POD2MAN).PL
	$(PERLEXE) $(POD2LATEX).PL
	$(PERLEXE) $(POD2TEXT).PL
	$(PERLEXE) $(PL2BAT) $(POD2HTML)
	$(PERLEXE) $(PL2BAT) $(POD2MAN)
	$(PERLEXE) $(PL2BAT) $(POD2LATEX)
	$(PERLEXE) $(PL2BAT) $(POD2TEXT)
        cd $(PODDIR)
        $(PERLEXE) pod2html.bat *.pod
        cd ..\win32

utils: $(PERLEXE)
	cd ..\utils
	nmake PERL=$(MINIPERL)
	$(PERLEXE) ..\win32\$(PL2BAT) h2ph splain perlbug pl2pm c2ph \
			h2xs perldoc pstruct
	$(XCOPY) *.bat ..\win32\bin\*.*
	cd ..\win32

distclean:
	-del /f $(MINIPERL) $(PERLEXE) $(PERLDLL) $(GLOBEXE) $(PERLLIB) \
		$(PERLIMPLIB) ..\miniperl.lib modules.lib
	-del /f *.def
	-del /f $(SOCKET_DLL) $(IO_DLL) $(SDBM_FILE_DLL) $(FCNTL_DLL) \
		$(OPCODE_DLL)
	-del /f $(SOCKET).c $(IO).c $(SDBM_FILE).c $(FCNTL).c $(OPCODE).c \
		$(DYNALOADER).c
	-del /f $(PODDIR)\*.html
	-del /f $(PODDIR)\*.bat
	-rmdir /s /q ..\lib\auto
	-rmdir /s /q ..\lib\CORE
	-rmdir /s /q release
	-rmdir /s /q debug

install : ALL doc utils
	if not exist $(INST_TOP) mkdir $(INST_TOP)
	echo I $(INST_TOP) L $(LIBDIR)
	$(XCOPY) $(PERLEXE) $(INST_BIN)\*.*
	$(XCOPY) $(GLOBEXE) $(INST_BIN)\*.*
	$(XCOPY) $(PERLDLL) $(INST_BIN)\*.*
	$(XCOPY) bin\*.* $(INST_BIN)\*.*
	$(XCOPY) /e ..\lib $(INST_LIB)\*.*
	$(XCOPY) ..\pod\*.bat $(INST_BIN)\*.*
	$(XCOPY) ..\pod\*.pod $(INST_POD)\*.*
	$(XCOPY) ..\pod\*.html $(INST_HTML)\*.*

inst_lib : 
	copy splittree.pl .. 
	$(MINIPERL) ..\splittree.pl "../LIB" "../LIB/auto"
	$(XCOPY) /e ..\lib $(INST_LIB)\*.*

test : all
	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
	$(XCOPY) $(PERLDLL) ..\t\$(NULL)
	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
        cd ..\t
        $(PERLEXE) test
	cd ..\win32