summaryrefslogtreecommitdiff
path: root/win32/Makefile.ce
blob: b8fd8cb6d4fd678c0c46f35b99b085ea95caf95d (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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
#
# perl makefile for wince
# During the cross-compilation, it first uses Makefile file to build
# miniperl on HOST and then build required platform
#

SRCDIR     = ..
PV         = 519

# INSTALL_ROOT specifies a path where this perl will be installed on CE device
INSTALL_ROOT=/netzwerk/sprache/perl
INST_TOP=$(INSTALL_ROOT)
INST_VER=

# PERLCEDIR shoud be set to current directory
PERLCEDIR  = $(MAKEDIR)

# WCEROOT is a directory where Windows CE Tools was installed
WCEROOT    = D:\Windows CE Tools

# HPERL stands for host perl, which is perl on local desktop machine
# which is usually ..\miniperl.exe
#HPERL     = N:\Programme\perl\bin\perl.exe
HPERL = $(MAKEDIR)\..\miniperl.exe

CEPATH     = D:\Programme\Microsoft eMbedded Tools\EVC\WCE211\BIN
CELIBDLLDIR  = h:\src\wince\celib-palm-3.0
CECONSOLEDIR = h:\src\wince\w32console

# specify following options to build perl on local machine, by MSVC
MSVCDIR         = D:\MSVStudio\VC98
CCHOME		= $(MSVCDIR)
CCINCDIR	= $(CCHOME)\include
CCLIBDIR	= $(CCHOME)\lib

# cecopy program. Make shure it is in your path, as well as cemkdir, cedel
CECOPY     = cecopy

#
# Comment out next assign to disable perl's I/O subsystem and use compiler's
# stdio for IO - depending on your compiler vendor and run time library you may
# then get a number of fails from make test i.e. bugs - complain to them not us ;-).
# You will also be unable to take full advantage of perl5.8's support for multiple
# encodings and may see lower IO performance. You have been warned.
USE_PERLIO	= define

#
# set this if you wish to use perl's malloc
# This will make perl run few times faster
# WARNING: Turning this on/off WILL break binary compatibility with extensions
# you may have compiled with/without it.
#
PERL_MALLOC	= define


NOOP	   = @echo
# keep this untouched!
NULL	   =

#
# uncomment exactly one of the following
#
# Embedded Visual C++ 4 and older
CCTYPE		= MSVC60
# Smart Devices for Visual C++ 2005 (aka Visual C++ 8.x) (full version)
#CCTYPE		= MSVC80
# Smart Devices for Visual C++ 2008 (aka Visual C++ 9.x) (full version)
#CCTYPE		= MSVC90

#CFG=DEBUG
CFG=RELEASE

!if "$(MACHINE)" == ""
MACHINE=wince-arm-hpc-wce300
#MACHINE=wince-arm-hpc-wce211
#MACHINE=wince-sh3-hpc-wce211
#MACHINE=wince-mips-hpc-wce211
#MACHINE=wince-sh3-hpc-wce200
#MACHINE=wince-mips-hpc-wce200
#MACHINE=wince-arm-pocket-wce300
#MACHINE=wince-mips-pocket-wce300
#MACHINE=wince-sh3-pocket-wce300
#MACHINE=wince-x86em-pocket-wce300
#MACHINE=wince-mips-palm-wce211
#MACHINE=wince-sh3-palm-wce211
#MACHINE=wince-x86em-palm-wce211
#MACHINE=wince-x86-hpc-wce300
#MACHINE=wince-arm-pocket-wce400
!endif

# set this to your email address
#
#EMAIL		=

##################### CHANGE THESE ONLY IF YOU MUST #####################

######################################################################
# machines

!if "$(MACHINE)" == "wince-sh3-hpc-wce211"
CC         = shcl.exe
ARCH       = SH3
CPU        = SH3
TARGETCPU  = SH3
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS HPC Pro
MCFLAGS    = -MDd -DSH3 -D_SH3_ -DSHx -DPROCESSOR_SH3 -DPALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.11
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-mips-hpc-wce211"
CC         = clmips.exe
ARCH       = MIPS
CPU        = MIPS
TARGETCPU  = MIPS
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS HPC Pro
MCFLAGS    = -D _MT -D _DLL \
             -D MIPS -D mips -D _MIPS_ -D _mips_ -DPROCESSOR_MIPS \
             -D PALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.11
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-mips-hpc-wce200"
CC         = clmips.exe
ARCH       = MIPS
CPU        = MIPS
TARGETCPU  = MIPS
CEVersion  = 200
OSVERSION  = WCE200
PLATFORM   = MS HPC
# MUST USE -MD to get the right FPE stuff...
MCFLAGS    = -D _MT -D _DLL -MD \
             -D MIPS -D mips -D _MIPS_ -D _mips_ -DPROCESSOR_MIPS \
             -D PALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-sh3-hpc-wce200"
CC         = shcl.exe
ARCH       = SH3
CPU        = SH3
TARGETCPU  = SH3
CEVersion  = 200
OSVERSION  = WCE200
PLATFORM   = MS HPC
# MUST USE -MD to get the right FPE stuff...
MCFLAGS    = -D _MT -D _DLL -MD \
             -D SH3 -D sh3 -D _SH3_ -D _sh3_ -D SHx -DPROCESSOR_SH3 \
             -D PALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-arm-hpc-wce211"
CC         = clarm.exe
ARCH       = ARM
CPU        = ARM
TARGETCPU  = ARM
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS HPC Pro
MCFLAGS    = -D _MT -D _DLL -D ARM -D arm -D _arm_ -D _ARM_ \
             -DPROCESSOR_ARM -DPALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.11
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-arm-hpc-wce300"
CC         = clarm.exe
ARCH       = ARM
CPU        = ARM
TARGETCPU  = ARM
CEVersion  = 300
OSVERSION  = WCE300
#PLATFORM   = HPC2000
MCFLAGS    = -D _MT -D _DLL -D ARM -D arm -D _arm_ -D _ARM_ \
             -DPROCESSOR_ARM -DPALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,3.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-mips-palm-wce211"
CC         = clmips.exe
ARCH       = MIPS
CPU        = MIPS
TARGETCPU  = MIPS
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS Palm Size PC
MCFLAGS    = -DMIPS -D_MIPS_ -DPROCESSOR_MIPS -D PALM_SIZE -D _DLL -D _MT \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.11
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-sh3-palm-wce211"
CC         = shcl.exe
ARCH       = SH3
CPU        = SH3
TARGETCPU  = SH3
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS Palm Size PC
MCFLAGS    = -D _MT -D _DLL -DSH3 -D_SH3_ -DSHx -DPROCESSOR_SH3 -DPALM_SIZE \
             -I $(CELIBDLLDIR)\inc
SUBSYS	   = -subsystem:windowsce,2.11
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-x86em-palm-wce211"
CC         = cl.exe
ARCH       = X86EM
CPU        = X86
TARGETCPU  = X86
CEVersion  = 211
OSVERSION  = WCE211
PLATFORM   = MS Palm Size PC
MCFLAGS    = -MDd -DX86 -D_X86_ -DPROCESSOR_X86 \
             -D_WIN32_WCE_EMULATION -DPALM_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:x86
SUBSYS     = -subsystem:windows
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-x86em-pocket-wce300"
CC         = cl.exe
ARCH       = X86EM
CPU        = X86
TARGETCPU  = X86
CEVersion  = 300
OSVERSION  = WCE300
PLATFORM   = MS Pocket PC
MCFLAGS    = -DX86 -D_X86_ -DPROCESSOR_X86 -D _MT -D _DLL \
             -D_WIN32_WCE_EMULATION -DPALM_SIZE -DPOCKET_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:x86
SUBSYS     = -subsystem:windows
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-mips-pocket-wce300"
CC         = clmips.exe
ARCH       = MIPS
CPU        = MIPS
TARGETCPU  = MIPS
CEVersion  = 300
OSVERSION  = WCE300
PLATFORM   = MS Pocket PC
MCFLAGS    = -D MIPS -D mips -D _MIPS_ -D _mips_ -DPROCESSOR_MIPS \
             -D _MT -D _DLL -DPALM_SIZE -DPOCKET_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:mips
SUBSYS     = -subsystem:windowsce,3.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
#STDLIBPATH = $(WCEROOT)\$(OSVERSION)\$(PLATFORM)\lib\$(CPU)
LDLIBPATH  = -libpath:$(CELIBPATH)
#"-libpath:$(STDLIBPATH)"
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-sh3-pocket-wce300"
CC         = shcl.exe
ARCH       = SH3
CPU        = SH3
TARGETCPU  = SH3
CEVersion  = 300
OSVERSION  = WCE300
PLATFORM   = MS Pocket PC
MCFLAGS    = -D _MT -D _DLL -DSH3 -D_SH3_ -DSHx -DPROCESSOR_SH3 \
             -DPALM_SIZE -DPOCKET_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:sh3
SUBSYS     = -subsystem:windowsce,3.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-arm-pocket-wce300"
CC         = clarm.exe
ARCH       = ARM
CPU        = ARM
TARGETCPU  = ARM
CEVersion  = 300
OSVERSION  = WCE300
PLATFORM   = MS Pocket PC
MCFLAGS    = -D ARM -D arm -D _ARM_ -D _arm_ -DPROCESSOR_ARM \
             -D _MT -D _DLL -DPALM_SIZE -DPOCKET_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:arm
SUBSYS     = -subsystem:windowsce,3.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-x86-hpc-wce300"
CC         = cl.exe
ARCH       = X86EM
CPU        = X86
TARGETCPU  = X86
CEVersion  = 400
OSVERSION  = WCE400
PLATFORM   = MS Pocket PC
MCFLAGS    = -DX86 -D_X86_ -Dx86 -DPROCESSOR_X86 -D _MT -D _DLL \
             -DPALM_SIZE -DPOCKET_SIZE -I $(CELIBDLLDIR)\inc
MACH       = -machine:IX86
SUBSYS     = -subsystem:windowsce,2.0
CELIBPATH  = $(CELIBDLLDIR)\wince-x86-hpc-wce300-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif

!if "$(MACHINE)" == "wince-arm-pocket-wce400"
#CC         = clarm.exe #set in WCEARMV4.BAT
ARCH       = ARM
CPU        = ARM
TARGETCPU  = ARM
CEVersion  = 400
#OSVERSION  = WCE300 #set in WCEARMV4.BAT
PLATFORM   = MS Pocket PC
MCFLAGS    = -D ARM -D arm -D _ARM_ -D _arm_ -DPROCESSOR_ARM \
             -D _MT -D _DLL -DPALM_SIZE -DPOCKET_SIZE \
             -I $(CELIBDLLDIR)\inc
MACH       = -machine:arm
SUBSYS     = -subsystem:windowsce,4.00
CELIBPATH  = $(CELIBDLLDIR)\$(MACHINE)-release
LDLIBPATH  = -libpath:$(CELIBPATH)
STARTOBJS  = $(CECONSOLEDIR)/$(MACHINE)/wmain.obj \
             $(CECONSOLEDIR)/$(MACHINE)/w32console.obj
!endif


######################################################################
# common section

CEDEFS    = -D_WINDOWS -D_WIN32_WCE=$(CEVersion) -DUNDER_CE=$(CEVersion) \
            $(MCFLAGS) -D PERL

CECFLAGS  = $(CEDEFS) -Zi

!if "$(CFG)" == "DEBUG"
CECFLAGS  = $(CECFLAGS) -Od
!endif

!if "$(CFG)" == "RELEASE"
# -O2 and -Ot give internal compiler error in perl.c and lexer.
# Also the dll cannot be loaded by perl.exe...
!if "$(CPU)" == "SH3"
!else
CECFLAGS  = $(CECFLAGS) -O1
!endif
!  IF "$(CCTYPE)" != "MSVC60"
#turn on LTCG optimization for CCs that have it
CECFLAGS	= $(CECFLAGS) -GL
!  ENDIF
!  IF "$(CCTYPE)" == "MSVC80" || "$(CCTYPE)" == "MSVC90"
#no stack security cookie for CCs where its on by default
CECFLAGS	= $(CECFLAGS) -GS-
!  ENDIF
!endif

RCDEFS    = /l 0x407 /r /d "UNICODE" /d UNDER_CE=$(CEVersion) \
            /d _WIN32_WCE=$(CEVersion)

#PATH=$(CEPATH);$(PATH)

# attention, for eVC 4, these paths are not generated correctly since the
# WinCE SDK is organized differently from eVC 3, replace the next 2 macros
# with absolute paths to the correct directories on your system
#INCLUDE=$(WCEROOT)\$(OSVERSION)\$(PLATFORM)\include
#LIB=$(WCEROOT)\$(OSVERSION)\$(PLATFORM)\lib\$(ARCH)

######################################################################

!message
!message Compiling for $(MACHINE)
!message LIB=$(LIB)
!message INCLUDE=$(INCLUDE)
!message PATH=$(CEPATH)
!message

######################################################################
#
# Additional compiler flags can be specified here.
#

BUILDOPT	= $(BUILDOPT) $(CECFLAGS) -DUSE_CROSS_COMPILE


!IF "$(CRYPT_SRC)$(CRYPT_LIB)" == ""
D_CRYPT		= undef
!ELSE
D_CRYPT		= define
CRYPT_FLAG	= -DHAVE_DES_FCRYPT
!ENDIF

!IF "$(PERL_MALLOC)" == ""
PERL_MALLOC	= undef
!ENDIF

!IF "$(USE_MULTI)" == ""
USE_MULTI	= undef
!ENDIF

!IF "$(USE_ITHREADS)" == ""
USE_ITHREADS	= undef
!ENDIF

!IF "$(USE_IMP_SYS)" == ""
USE_IMP_SYS	= undef
!ENDIF

!IF "$(USE_PERLIO)" == ""
USE_PERLIO	= undef
!ENDIF

!IF "$(USE_PERLCRT)" == ""
USE_PERLCRT	= undef
!ENDIF

!IF "$(USE_IMP_SYS)$(USE_MULTI)" == "defineundef"
USE_MULTI	= define
!ENDIF

!IF "$(USE_ITHREADS)$(USE_MULTI)" == "defineundef"
USE_MULTI	= define
!ENDIF

!IF "$(USE_MULTI)" != "undef"
BUILDOPT	= $(BUILDOPT) -DPERL_IMPLICIT_CONTEXT
!ENDIF

!IF "$(USE_IMP_SYS)" != "undef"
BUILDOPT	= $(BUILDOPT) -DPERL_IMPLICIT_SYS
!ENDIF

!IF "$(USE_PERLIO)" == "define"
BUILDOPT	= $(BUILDOPT) -DUSE_PERLIO
!ENDIF

!IF "$(CROSS_NAME)" == ""
CROSS_NAME	= $(MACHINE)
!ENDIF

# new option - automatically defined in perl.h...
#BUILDOPT        = $(BUILDOPT) -DUSE_ENVIRON_ARRAY

PROCESSOR_ARCHITECTURE = $(TARGETCPU)
ARCHNAME	= $(PLATFORM)-$(OSVERSION)-$(PROCESSOR_ARCHITECTURE)
ARCHDIR		= ..\lib\$(ARCHNAME)
COREDIR		= ..\lib\CORE
AUTODIR		= ..\lib\auto
LIBDIR		= ..\lib
EXTDIR		= ..\ext
DISTDIR		= ..\dist
CPANDIR		= ..\cpan
PODDIR		= ..\pod
EXTUTILSDIR	= $(LIBDIR)\ExtUtils

LINK32		= link
LIB32		= $(LINK32) -lib
RSC		= rc

INCLUDES	= -I.\include -I. -I..
DEFINES		= -DWIN32 -D_CONSOLE -DNO_STRICT $(CRYPT_FLAG) $(CECFLAGS)
LOCDEFS		= -DPERLDLL -DPERL_CORE
CXX_FLAG	= -TP

PERLEXE_RES	= perl.res
PERLDLL_RES	=

!if "$(CFG)" == "RELEASE"
CELIB           = celib.lib
!endif

!if "$(CFG)" == "DEBUG"
CELIB           = celib.lib
!endif

#use ws2.lib instead of winsock.lib for WSAGetLastError
CELIBS          = -nodefaultlib \
                  ws2.lib $(CELIB) coredll.lib

#this libc's purpose is WinCE entrypoint to main wrapper, not a real C std lib
!if $(CEVersion) > 200
LIBC          = corelibc.lib
!else
LIBC          = msvcrt.lib
!endif

LIBBASEFILES	= $(CRYPT_LIB) $(CELIBS)

LIBFILES	= $(LIBBASEFILES) $(LIBC)

CFLAGS		= -nologo -GF -W3 $(INCLUDES) $(DEFINES) $(LOCDEFS) \
		$(PCHFLAGS) $(OPTIMIZE)

LINK_FLAGS	= -nologo -debug -opt:ref,icf -machine:$(PROCESSOR_ARCHITECTURE)

!if "$(CFG)" == "RELEASE" && "$(CCTYPE)" != "MSVC60"
#see matching flag in CECFLAGS
LINK_FLAGS	= $(LINK_FLAGS) -ltcg
!endif

OBJOUT_FLAG	= -Fo
EXEOUT_FLAG	= -Fe

CFLAGS_O	= $(CFLAGS) $(BUILDOPT)

o = .obj

#
# Rules
#

.SUFFIXES : .c $(o) .dll .lib .exe .rc .res

.c$(o):
	$(CC) -c -I$(<D) $(CFLAGS_O) $(OBJOUT_FLAG)$@ $<

.c.i:
	$(CC) -c -I$(<D) $(CFLAGS_O) -P $(OBJOUT_FLAG)$@ $<

.y.c:
	$(NOOP)

$(o).dll:
	$(LINK32) -dll $(SUBSYS) $(LDLIBPATH) \
            -implib:$(*B).lib -def:$(*B).def \
	    -out:$@ $(LINK_FLAGS) $(LIBFILES) $< $(LIBPERL)

.rc.res:
	$(RSC) -i.. $<

# This must be relative to ../lib/CORE, else the ext dll build fails...
PERLIMPLIB_EXP	= perl$(PV).lib
PERLIMPLIB	= $(PERLCEDIR)\$(MACHINE)\perl$(PV).lib
PERLDLL		= $(MACHINE)\perl$(PV).dll

DLLDIR          = $(MACHINE)\dll
PERLEXE		= $(MACHINE)\perl.exe

CONFIGPM	= ..\lib\Config.pm ..\lib\Config_heavy.pl
GENUUDMAP	= ..\generate_uudmap.exe

UUDMAP_H	= ..\uudmap.h
BITCOUNT_H	= ..\bitcount.h
MG_DATA_H	= ..\mg_data.h
GENERATED_HEADERS = $(UUDMAP_H) $(BITCOUNT_H) $(MG_DATA_H)

# Unicode data files generated by mktables
FIRSTUNIFILE     = ..\lib\unicore\Decomposition.pl
UNIDATAFILES	 = ..\lib\unicore\Decomposition.pl \
		   ..\lib\unicore\CombiningClass.pl ..\lib\unicore\Name.pl \
		   ..\lib\unicore\Heavy.pl ..\lib\unicore\mktables.lst \
		   ..\lib\unicore\UCD.pl ..\lib\unicore\Name.pm \
		   ..\lib\unicore\TestProp.pl

PERLEXE_MANIFEST= .\perlexe.manifest
PERLEXE_ICO	= .\perlexe.ico
PERLEXE_RES	= .\perlexe.res
PERLDLL_RES	=

# Directories of Unicode data files generated by mktables
UNIDATADIR1	= ..\lib\unicore\To
UNIDATADIR2	= ..\lib\unicore\lib

# Nominate a target which causes extensions to be re-built
# This used to be $(PERLEXE), but at worst it is the .dll that they depend
# on and really only the interface - i.e. the .def file used to export symbols
# from the .dll
PERLDEP		= perldll.def

MAKE		= nmake -nologo
MAKE_BARE	= nmake

CFGSH_TMPL	= config.ce
CFGH_TMPL	= config_H.ce

XCOPY		= xcopy /f /r /i /d /y
RCOPY		= xcopy /f /r /i /e /d /y
NOOP		= @rem
NULL		=

DEL		= del

MICROCORE_SRC	=		\
		..\av.c		\
		..\caretx.c	\
		..\deb.c	\
		..\doio.c	\
		..\doop.c	\
		..\dump.c	\
		..\globals.c	\
		..\gv.c		\
		..\mro.c	\
		..\hv.c		\
		..\locale.c	\
		..\keywords.c	\
		..\mathoms.c    \
		..\mg.c		\
		..\numeric.c	\
		..\op.c		\
		..\pad.c	\
		..\perl.c	\
		..\perlapi.c	\
		..\perly.c	\
		..\pp.c		\
		..\pp_ctl.c	\
		..\pp_hot.c	\
		..\pp_pack.c	\
		..\pp_sort.c	\
		..\pp_sys.c	\
		..\reentr.c	\
		..\regcomp.c	\
		..\regexec.c	\
		..\run.c	\
		..\scope.c	\
		..\sv.c		\
		..\taint.c	\
		..\toke.c	\
		..\universal.c	\
		..\utf8.c	\
		..\util.c

EXTRACORE_SRC	= $(EXTRACORE_SRC) perllib.c

!IF "$(PERL_MALLOC)" == "define"
EXTRACORE_SRC	= $(EXTRACORE_SRC) ..\malloc.c
!ENDIF

EXTRACORE_SRC	= $(EXTRACORE_SRC) ..\perlio.c .\win32io.c

WIN32_SRC	=		\
		.\wince.c	\
		.\wincesck.c	\
		.\win32thread.c

!IF "$(CRYPT_SRC)" != ""
WIN32_SRC	= $(WIN32_SRC) .\$(CRYPT_SRC)
!ENDIF

CORE_NOCFG_H	=		\
		..\av.h		\
		..\cop.h	\
		..\cv.h		\
		..\dosish.h	\
		..\embed.h	\
		..\form.h	\
		..\gv.h		\
		..\handy.h	\
		..\hv.h		\
		..\hv_func.h	\
		..\iperlsys.h	\
		..\mg.h		\
		..\nostdio.h	\
		..\op.h		\
		..\opcode.h	\
		..\perl.h	\
		..\perlapi.h	\
		..\perlsdio.h	\
		..\perly.h	\
		..\pp.h		\
		..\proto.h	\
		..\regexp.h	\
		..\scope.h	\
		..\sv.h		\
		..\thread.h	\
		..\unixish.h	\
		..\utf8.h	\
		..\util.h	\
		..\warnings.h	\
		..\XSUB.h	\
		..\EXTERN.h	\
		..\perlvars.h	\
		..\intrpvar.h	\
		.\include\dirent.h	\
		.\include\netdb.h	\
		.\include\sys\errno2.h	\
		.\include\sys\socket.h	\
		.\win32.h

DYNAMIC_EXT	= Socket IO Fcntl Opcode SDBM_File POSIX attributes B re \
		Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob \
		Sys/Hostname

STATIC_EXT	= DynaLoader

DYNALOADER	= $(EXTDIR)\DynaLoader\DynaLoader

ERRNO_PM	= $(LIBDIR)\Errno.pm


EXTENSION_PM	=		\
		$(ERRNO_PM)

CFG_VARS = \
 "INST_TOP=$(INST_TOP)" \
 "INST_VER=$(INST_VER)" \
 "INST_ARCH=$(INST_ARCH)" \
 "archname=$(ARCHNAME)" \
 "cc=$(CC)" \
 "ld=$(LINK32)"	 \
 "ccflags=$(OPTIMIZE) $(DEFINES) $(BUILDOPT)" \
 "cppflags=$(OPTIMIZE) $(DEFINES) $(BUILDOPT)" \
 "cf_by=vkon" \
 "cf_email=$(EMAIL)" \
#9cef8306
 "d_mymalloc=$(PERL_MALLOC)" \
 "libs=$(LIBFILES)" \
 "incpath=$(CCINCDIR)" \
 "libperl=$(PERLIMPLIB_EXP)" \
 "libpth=$(LIBPATH)" \
 "libc=$(LIBC)" \
 "make=$(MAKE_BARE)" \
 "static_ext=$(STATIC_EXT)" \
 "dynamic_ext=$(DYNAMIC_EXT)" \
 "usethreads=$(USE_ITHREADS)" \
 "useithreads=$(USE_ITHREADS)" \
 "usemultiplicity=$(USE_MULTI)" \
 "useperlio=$(USE_PERLIO)" \
 "use64bitint=undef" \
 "uselargefiles=undef" \
 "LINK_FLAGS=$(LDLIBPATH) $(LINK_FLAGS) $(SUBSYS)" \
 "optimize=$(OPTIMIZE)" \
 "WIN64=$(WIN64)"

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


#
# Top targets
#

all: hostminiperl force_config_h ..\lib\buildcustomize.pl .\config.h ..\git_version.h $(CONFIGPM) $(UNIDATAFILES) $(PERLEXE) MakePPPort Extensions

$(DYNALOADER)$(o) : $(DYNALOADER).c config.h $(EXTDIR)\DynaLoader\dlutils.c

#convenience target
configpm_targ : $(CONFIGPM)

force_config_h:
	-@$(DEL) /f config.h
	-@$(DEL) /f config.sh
	-@$(DEL) /f ..\config.h
	-@$(DEL) /f ..\config.sh
	-@$(DEL) $(PERLEXE_RES)
	-@mkdir ..\host
	-@copy $(HPERL) ..\host\miniperl.exe
	-@copy $(GENUUDMAP) ..\host\generate_uudmap.exe
	-@$(MAKE) -f Makefile distclean
	-@copy ..\host\miniperl.exe $(HPERL)
	-@copy ..\host\generate_uudmap.exe $(GENUUDMAP)
	$(GENUUDMAP) $(GENERATED_HEADERS)
	type NUL > force_config_h

$(UUDMAP_H) $(MG_DATA_H) : $(BITCOUNT_H)

$(BITCOUNT_H) :
	$(GENUUDMAP) $(GENERATED_HEADERS)

$(CONFIGPM) : $(HPERL) ..\config.sh config_h.PL ..\git_version.h
	cd .. && $(HPERL) -Ilib configpm --no-glossary
	if exist lib\* $(RCOPY) lib\*.* ..\lib\$(NULL)
	$(XCOPY) ..\*.h $(COREDIR)\*.*
	$(XCOPY) *.h $(COREDIR)\*.*
	$(RCOPY) include $(COREDIR)\*.*
	if errorlevel 1 $(MAKE) /$(MAKEFLAGS) $(CONFIGPM)

.\config.h: $(CONFIGPM) ..\config.sh
	-@$(DEL) /f config.h
	-$(HPERL) -I..\lib config_h.PL "INST_VER=$(INST_VER)" "CORE_DIR=$(COREDIR)" "CONFIG_H=config.h"
	copy config.h ..\config.h

..\config.sh : config.ce config_sh.PL FindExt.pm
	-@$(DEL) /f config.sh
	$(HPERL) -I..\lib -I. config_sh.PL $(CFG_VARS) config.ce > ..\config.sh

..\git_version.h : ..\make_patchnum.pl
	cd .. && $(HPERL) -Ilib make_patchnum.pl && cd win32

# make sure that we recompile perl.c if the git version changes
$(DLLDIR)\perl.obj : ..\git_version.h

MakePPPort: $(HPERL) $(CONFIGPM) Extensions_nonxs
	$(HPERL) -I..\lib ..\mkppport

MakePPPort_clean:
	-if exist $(HPERL) $(HPERL) -I..\lib ..\mkppport --clean

#----------------------------------------------------------------------------------
NOT_COMPILE_EXT =
!if "$(MACHINE)" == "wince-sh3-palm-wce211"
NOT_COMPILE_EXT = $(NOT_COMPILE_EXT) !XS/Typemap
!endif
!if "$(MACHINE)" == "wince-mips-palm-wce211"
NOT_COMPILE_EXT = $(NOT_COMPILE_EXT) !XS/Typemap
!endif

Extensions: ..\make_ext.pl $(CONFIGPM)
	$(HPERL) -I..\lib -I. ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR)  --all \
	!POSIX !Win32 !Win32API/File !Time/HiRes !Time/Piece !re !SDBM_File $(NOT_COMPILE_EXT)


Extensions_nonxs: ..\make_ext.pl ..\lib\buildcustomize.pl $(CONFIGPM) ..\pod\perlfunc.pod
	$(XCOPY) ..\*.h $(COREDIR)\*.*
	$(HPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR) --nonxs

Extensions_clean:
	-if exist $(HPERL) $(HPERL) -I..\lib ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(CPANDIR) --dir=$(DISTDIR) --dir=$(EXTDIR)  --all --target=clean 

#----------------------------------------------------------------------------------

$(PERLEXE_RES): perlexe.rc perl.rc $(PERLEXE_MANIFEST) $(PERLEXE_ICO)
	rc $(RCDEFS) perlexe.rc

clean: Extensions_clean
        -if exist .\$(MACHINE)\dll rmdir /s /q .\$(MACHINE)\dll
  -@$(DEL) .\$(MACHINE)\*.obj
  -@$(DEL) .\$(MACHINE)\*.exe
  -@$(DEL) .\$(MACHINE)\*.dll
  -@$(DEL) .\$(MACHINE)\*.lib
        -@$(DEL) .\$(MACHINE)\*.exp
        -@$(DEL) .\$(MACHINE)\*.pdb
	-@$(DEL) ..\git_version.h
  -@$(DEL) config.h perl.res
  -@$(DEL) ..\t\test_state

XDLLOBJS = \
$(DLLDIR)\av.obj \
$(DLLDIR)\caretx.obj \
$(DLLDIR)\deb.obj \
$(DLLDIR)\doio.obj \
$(DLLDIR)\doop.obj \
$(DLLDIR)\dump.obj \
$(DLLDIR)\globals.obj \
$(DLLDIR)\gv.obj \
$(DLLDIR)\mro.obj \
$(DLLDIR)\hv.obj \
$(DLLDIR)\locale.obj \
$(DLLDIR)\keywords.obj \
$(DLLDIR)\mathoms.obj \
$(DLLDIR)\mg.obj \
$(DLLDIR)\numeric.obj \
$(DLLDIR)\op.obj \
$(DLLDIR)\pad.obj \
$(DLLDIR)\perl.obj \
$(DLLDIR)\perlapi.obj \
$(DLLDIR)\perlio.obj \
$(DLLDIR)\perly.obj \
$(DLLDIR)\pp.obj \
$(DLLDIR)\pp_ctl.obj \
$(DLLDIR)\pp_hot.obj \
$(DLLDIR)\pp_pack.obj \
$(DLLDIR)\pp_sort.obj \
$(DLLDIR)\pp_sys.obj \
$(DLLDIR)\reentr.obj \
$(DLLDIR)\regcomp.obj \
$(DLLDIR)\regexec.obj \
$(DLLDIR)\run.obj \
$(DLLDIR)\scope.obj \
$(DLLDIR)\sv.obj \
$(DLLDIR)\taint.obj \
$(DLLDIR)\toke.obj \
$(DLLDIR)\universal.obj \
$(DLLDIR)\utf8.obj \
$(DLLDIR)\util.obj \
$(DLLDIR)\win32thread.obj \
$(DLLDIR)\wince.obj \
$(DLLDIR)\win32io.obj \
$(DLLDIR)\wincesck.obj \
$(DLLDIR)\perllib.obj \
$(DLLDIR)\DynaLoader.obj
!IF "$(PERL_MALLOC)" == "define"
XDLLOBJS	= $(XDLLOBJS) $(DLLDIR)\malloc.obj
!ENDIF
!IF "$(CRYPT_SRC)" != ""
XDLLOBJS	= $(XDLLOBJS) $(DLLDIR)\fcrypt.obj
!ENDIF

#sanity checks to make sure all our external files (celib, w32console, and
#MS CE SDK) are locatable
lib_check :
    @if not exist $(CECONSOLEDIR)\$(MACHINE)\w32console.obj cmd /k \
        "echo w32console.obj doesn't seem to exist, check your w32console directory \
        & exit 1"
    @if not exist $(CELIBDLLDIR)\$(MACHINE)-release\celib.lib cmd /k \
        "echo celib.lib doesn't seem to exist, check your celib directory \
        & exit 1"
    @for %X in ( $(LIBC) ) do @if exist %~^$LIB:X ( exit 0 ) \
        else ( echo $(LIBC) doesn't seem to exist, check your build enviroment & exit 1 )

#specific header files to check picked at random
header_check  :
    @if not exist $(CELIBDLLDIR)\inc\cewin32.h  cmd /k \
        "echo cewin32.h doesn't seem to exist, check your celib directory \
        & exit 1"
    @for %X in (ceconfig.h) do @if exist %~^$INCLUDE:X ( exit 0 ) \
        else ( echo ceconfig.h doesn't seem to exist, check your build enviroment & exit 1 )

{$(SRCDIR)}.c{$(DLLDIR)}.obj:
    $(CC) -c $(CFLAGS_O) -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ $<

# compiler explains that it will optimize toke.c if we'll give it an
# option -QMOb<num> with num>=4178
$(DLLDIR)\toke.obj:
    $(CC) -c $(CFLAGS_O) -QMOb9000 -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ ..\toke.c

{$(SRCDIR)/win32}.c{$(DLLDIR)}.obj:
    $(CC) -c $(CFLAGS_O) -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ $<

# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
# This is the only file that depends on perlhost.h, vmem.h, and vdir.h
!IF "$(USE_IMP_SYS)" == "define"
$(DLLDIR)\perllib$(o)	: perllib.c .\perlhost.h .\vdir.h .\vmem.h
	$(CC) -c -I. $(CFLAGS_O) $(CXX_FLAG) $(OBJOUT_FLAG)$@ perllib.c
	rem (frustrated) mv perllib.obj $(DLLDIR)
!ENDIF

perldll.def : $(HPERL) $(CONFIGPM) ..\embed.fnc ..\makedef.pl create_perllibst_h.pl .\config.h
	$(HPERL) -I..\lib create_perllibst_h.pl
	$(HPERL) -I..\lib -w ..\makedef.pl PLATFORM=wince $(OPTIMIZE) $(DEFINES) $(BUILDOPT) \
	    CCTYPE=$(CCTYPE) -DPERL_DLL=$(PERLDLL) TARG_DIR=..\ > perldll.def

$(PERLDLL) : header_check lib_check $(DLLDIR) perldll.def $(XDLLOBJS) $(PERLDLL_RES)
	$(LINK32) -dll -def:perldll.def -base:0x28000000 -out:$@ \
                  $(SUBSYS) $(LDLIBPATH) \
		  $(LINK_FLAGS) $(LIBFILES) \
		  $(XDLLOBJS) $(PERLDLL_RES)

$(DLLDIR) :
	if not exist "$(DLLDIR)" mkdir "$(DLLDIR)"

$(EXTDIR)\DynaLoader\DynaLoader.c :
	$(HPERL) -I..\lib -I. ..\make_ext.pl "MAKE=$(MAKE)" --dir=$(EXTDIR) --dynaloader

$(DLLDIR)\DynaLoader.obj: $(EXTDIR)\DynaLoader\DynaLoader.c
    $(CC) -c $(CFLAGS_O) -DPERL_EXTERNAL_GLOB -Fo$(DLLDIR)\ \
          $(EXTDIR)\DynaLoader\DynaLoader.c

XPERLEXEOBJS = \
$(MACHINE)\perlmaince.obj

..\lib\buildcustomize.pl :
	$(HPERL) -I..\lib -f ..\write_buildcustomize.pl ..

$(PERLEXE) : $(PERLDLL) $(CONFIGPM) $(XPERLEXEOBJS) $(PERLEXE_RES) $(STARTOBJS)
	$(XCOPY) $(MACHINE)\*.lib $(COREDIR)
	$(LINK32) $(SUBSYS) $(LDLIBPATH) \
            -entry:wWinMainCRTStartup \
            -out:$(MACHINE)\perl.exe \
            -stack:0x100000 $(LINK_FLAGS) $(STARTOBJS) $(XPERLEXEOBJS) \
            $(PERLIMPLIB) $(PERLEXE_RES) $(LIBFILES)

$(MACHINE)\perlmaince.obj : perlmaince.c
	$(CC) $(CFLAGS_O) -UPERLDLL -Fo$(MACHINE)\ -c perlmaince.c

iodll:     $(IO_DLL)
socketdll: $(SOCKET_DLL)
dumperdll: $(DUMPER_DLL)

dlls: socketdll iodll dumperdll
	-xmkdir -p $(MACHINE)/lib/auto/IO
	copy ../lib/auto/IO/IO.bs $(MACHINE)/lib/auto/IO
	copy ../lib/auto/IO/IO.dll $(MACHINE)/lib/auto/IO
	-xmkdir $(MACHINE)/lib/auto/Socket
	copy ../lib/auto/Socket/Socket.bs $(MACHINE)/lib/auto/Socket
	copy ../lib/auto/Socket/Socket.dll $(MACHINE)/lib/auto/Socket
	-xmkdir -p $(MACHINE)/lib/auto/Data/Dumper
	copy ../lib/auto/Data/Dumper/Dumper.bs $(MACHINE)/lib/auto/Data/Dumper
	copy ../lib/auto/Data/Dumper/Dumper.dll $(MACHINE)/lib/auto/Data/Dumper

makedist: all dlls
	$(COPY) $(CELIBPATH)\celib.dll $(MACHINE)
	copy perl.txt $(MACHINE)
	copy registry.bat $(MACHINE)
	copy ../lib/Config.pm $(MACHINE)/lib
	cd $(MACHINE)
	-@$(DEL) perl-$(MACHINE).tar.gz
	sh -c "tar cf perl-$(MACHINE).tar *.exe *.dll *.txt *.bat lib"
	gzip -9 perl-$(MACHINE).tar
	mv perl-$(MACHINE).tar.gz h:/freenet/new
	cd ..

install: all
	-cemkdir "$(INSTALL_ROOT)"
	-cemkdir "$(INSTALL_ROOT)\bin"
	-cemkdir "$(INSTALL_ROOT)\lib"
	$(CECOPY) "pc:$(MACHINE)/perl.exe" "ce:$(INSTALL_ROOT)/bin"
	$(CECOPY) "pc:$(MACHINE)/perl$(PV).dll" "ce:$(INSTALL_ROOT)/bin"
	$(CECOPY) "pc:../lib/Config.pm" "ce:$(INSTALL_ROOT)/lib"

$(UNIDATAFILES) : $(HPERL) $(CONFIGPM) ..\lib\unicore\mktables MakePPPort
	cd ..\lib\unicore && \
	$(HPERL) -I.. -I..\..\lib mktables -P ..\..\pod -maketest -makelist -p -check $@ $(FIRSTUNIFILE)

dist: all
	$(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME)

zipdist: all
	$(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME)
	$(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip

zip:
	$(HPERL) -I..\lib ce-helpers\makedist.pl --distdir=dist-$(CROSS_NAME) --cross-name=$(CROSS_NAME) --zip

hostminiperl: ..\miniperl.exe

..\miniperl.exe:
	set PATH=$(CCHOME)\bin;$(PATH)
	$(MAKE) -f Makefile "CCHOME=$(MSVCDIR)" "CCINCDIR=$(CCHOME)\include" "CCLIBDIR=$(CCHOME)\lib" "INCLUDE=$(CCHOME)\include" "LIB=$(CCHOME)\lib" "LINK_FLAGS=" .\config.h ..\miniperl.exe

host-install:
	perl -MConfig -MExtUtils::Install -we "install({'../lib/CORE', qq#$$Config{installprefixexp}/lib/CORE#},1)"
	perl -MConfig -MExtUtils::Install -we "install({'../lib', qq#$$Config{installprefixexp}/lib#},1)"
	perl -MConfig -MFile::Copy -we "copy qq#./$(MACHINE)/perl$(PV).lib#, qq#$$Config{installprefixexp}/lib/CORE#"
	perl -MConfig -we "system qq#perl -pi.bak -we \"s{((arch^|priv)libexp)='.*'}{\$$1='# . \
	 quotemeta($$Config{installprefixexp}) . \
	 qq#/lib'}\" $$Config{installprefixexp}/lib/Config.pm#"